Click or drag to resize
CfxV8Context Class

[This is preliminary documentation and is subject to change.]

Structure representing a V8 context handle. V8 handles can only be accessed from the thread on which they are created. Valid threads for creating a V8 handle include the render process main thread (TID_RENDERER) and WebWorker threads. A task runner for posting tasks on the associated thread can be retrieved via the CfxV8Context.GetTaskRunner() function.
Inheritance Hierarchy
SystemObject
  ChromiumCfxObject
    ChromiumCfxBase
      ChromiumCfxLibraryBase
        ChromiumCfxV8Context

Namespace: Chromium
Assembly: ChromiumFX (in ChromiumFX.dll)
Syntax
public class CfxV8Context : CfxLibraryBase

The CfxV8Context type exposes the following members.

Properties
  NameDescription
Public propertyBrowser
Returns the browser for this context. This function will return an NULL reference for WebWorker contexts.
Public propertyFrame
Returns the frame for this context. This function will return an NULL reference for WebWorker contexts.
Public propertyGlobal
Returns the global object for this context. The context must be entered before calling this function.
Public propertyIsValid
Returns true (1) if the underlying handle is valid and it can be accessed on the current thread. Do not call any other functions if this function returns false (0).
Public propertyNativePtr
Provides access to the underlying native cef struct. This is a refcounted library struct derived from cef_base_t. Add a ref in order to keep it alive when this managed object go out of scope.
(Inherited from CfxLibraryBase.)
Public propertyTaskRunner
Returns the task runner associated with this context. V8 handles can only be accessed from the thread on which they are created. This function can be called on any render process thread.
Top
Methods
  NameDescription
Public methodEnter
Enter this context. A context must be explicitly entered before creating a V8 Object, Array, Function or Date asynchronously. exit() must be called the same number of times as enter() before releasing this context. V8 objects belong to the context in which they are created. Returns true (1) if the scope was entered successfully.
Public methodEval
Execute a string of JavaScript code in this V8 context. The |scriptUrl| parameter is the URL where the script in question can be found, if any. The |startLine| parameter is the base line number to use for error reporting. On success |retval| will be set to the return value, if any, and the function will return true (1). On failure |exception| will be set to the exception, if any, and the function will return false (0).
Public methodExit
Exit this context. Call this function only after calling enter(). Returns true (1) if the scope was exited successfully.
Public methodStatic memberGetCurrentContext
Returns the current (top) context object in the V8 context stack.
Public methodStatic memberGetEnteredContext
Returns the entered (bottom) context object in the V8 context stack.
Public methodStatic memberInContext
Returns true (1) if V8 is currently inside a context.
Public methodIsSame
Returns true (1) if this object is pointing to the same handle as |that| object.
Top
Remarks
See also the original CEF documentation in cef/include/capi/cef_v8_capi.h.
See Also