Class 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 CefV8Context::GetTaskRunner() method.
 internal void Associate(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     var webView = new CefV8_WebView(context,context.GetTaskRunner());
     var taskCompletionSource =  _TaskCompletionSources.GetOrDefault(frame.Identifier);  
     if (taskCompletionSource!=null)
     {
         _TaskCompletionSources.Remove(frame.Identifier);
         taskCompletionSource.TrySetResult(webView);
     }
     _Associated.Add(frame.Identifier, webView);  
 }
        /// <summary>
        /// Execute the function using the specified V8 context. |object| is the
        /// receiver ('this' object) of the function. If |object| is empty the
        /// specified context's global object will be used. |arguments| is the list of
        /// arguments that will be passed to the function. Returns the function return
        /// value on success. Returns NULL if this method is called incorrectly or an
        /// exception is thrown.
        /// </summary>
        public CefV8Value ExecuteFunctionWithContext(CefV8Context context, CefV8Value obj, CefV8Value[] arguments)
        {
            var            n_arguments = CreateArguments(arguments);
            cef_v8value_t *n_retval;

            fixed(cef_v8value_t **n_arguments_ptr = n_arguments)
            {
                n_retval = cef_v8value_t.execute_function_with_context(
                    _self,
                    context.ToNative(),
                    obj != null ? obj.ToNative() : null,
                    n_arguments != null ? (UIntPtr)n_arguments.Length : UIntPtr.Zero,
                    n_arguments_ptr
                    );
            }

            return(CefV8Value.FromNativeOrNull(n_retval));
        }
 /// <summary>
 /// Called for global uncaught exceptions in a frame. Execution of this
 /// callback is disabled by default. To enable set
 /// CefSettings.uncaught_exception_stack_size &gt; 0.
 /// </summary>
 protected virtual void OnUncaughtException(CefBrowser browser, CefFrame frame, CefV8Context context, CefV8Exception exception, CefV8StackTrace stackTrace)
 {
 }
 /// <summary>
 /// Called immediately before the V8 context for a frame is released. No
 /// references to the context should be kept after this method is called.
 /// </summary>
 protected virtual void OnContextReleased(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
 }
 protected override void OnContextReleased(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     _MVVMCefApp.Reset(frame);
 }
 protected override void OnContextCreated(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     _MVVMCefApp.Associate(browser, frame, context);
 }
Beispiel #7
0
 /// <summary>
 /// Called immediately before the V8 context for a frame is released. No
 /// references to the context should be kept after this method is called.
 /// </summary>
 protected virtual void OnContextReleased(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Called for global uncaught exceptions in a frame. Execution of this
 /// callback is disabled by default. To enable set
 /// CefSettings.uncaught_exception_stack_size &gt; 0.
 /// </summary>
 protected virtual void OnUncaughtException(CefBrowser browser, CefFrame frame, CefV8Context context, CefV8Exception exception, CefV8StackTrace stackTrace)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Returns true if this object is pointing to the same handle as |that|
 /// object.
 /// </summary>
 public bool IsSame(CefV8Context that)
 {
     if (that == null) return false;
     return cef_v8context_t.is_same(_self, that.ToNative()) != 0;
 }
Beispiel #10
0
 /// <summary>
 /// Returns true if this object is pointing to the same handle as |that|
 /// object.
 /// </summary>
 public bool IsSame(CefV8Context that)
 {
     if (that == null) return false;
     return cef_v8context_t.is_same(_self, that.ToNative()) != 0;
 }
Beispiel #11
0
 internal void Associate(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     _Associated.Add(frame.Identifier, new CefV8_WebView(context, context.GetTaskRunner()));
 }
Beispiel #12
0
 /// <summary>
 /// Returns the entered (bottom) context object in the V8 context stack.
 /// </summary>
 public static CefV8Context GetEnteredContext()
 {
     return(CefV8Context.FromNative(
                cef_v8context_t.get_entered_context()
                ));
 }
Beispiel #13
0
 /// <summary>
 /// Returns the current (top) context object in the V8 context stack.
 /// </summary>
 public static CefV8Context GetCurrentContext()
 {
     return(CefV8Context.FromNative(
                cef_v8context_t.get_current_context()
                ));
 }
Beispiel #14
0
        /// <summary>
        /// Execute the function using the specified V8 context. |object| is the
        /// receiver ('this' object) of the function. If |object| is empty the
        /// specified context's global object will be used. |arguments| is the list of
        /// arguments that will be passed to the function. Returns the function return
        /// value on success. Returns NULL if this method is called incorrectly or an
        /// exception is thrown.
        /// </summary>
        public CefV8Value ExecuteFunctionWithContext(CefV8Context context, CefV8Value obj, CefV8Value[] arguments)
        {
            var n_arguments = CreateArguments(arguments);
            cef_v8value_t* n_retval;

            fixed (cef_v8value_t** n_arguments_ptr = n_arguments)
            {
                n_retval = cef_v8value_t.execute_function_with_context(
                    _self,
                    context.ToNative(),
                    obj != null ? obj.ToNative() : null,
                    n_arguments != null ? (UIntPtr)n_arguments.Length : UIntPtr.Zero,
                    n_arguments_ptr
                    );
            }

            return CefV8Value.FromNativeOrNull(n_retval);
        }
 protected override void OnContextReleased(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     MessageRouter.OnContextReleased(browser, frame, context);
 }
 protected override void OnContextReleased(CefBrowser browser, CefFrame frame, CefV8Context context)
 {
     Debug.WriteLine(DBGPREFIX + "OnContextReleased called");
     _messageRouter.OnContextReleased(browser, frame, context);
 }
 public TestCefGlueWindow(CefFrame iFrame, CefV8CompleteContext iContext)
 {
     _CefFrame = iFrame;
     _CefV8Context = iContext.Context;
 }