Exemple #1
0
        /// <summary>
        /// Create a new CfrV8Value object of type function. This function should only
        /// be called from within the scope of a CfrRenderProcessHandler,
        /// CfrV8Handler or CfrV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfrV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfrV8Value CreateFunction(string name, CfrV8Handler handler)
        {
            var call = new CfxV8ValueCreateFunctionRemoteCall();

            call.name    = name;
            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution();
            return(CfrV8Value.Wrap(new RemotePtr(call.__retval)));
        }
        /// <summary>
        /// Create a new CfrV8Value object of type function. This function should only
        /// be called from within the scope of a CfrRenderProcessHandler,
        /// CfrV8Handler or CfrV8Accessor callback, or in combination with calling
        /// enter() and exit() on a stored CfrV8Context reference.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>.
        /// </remarks>
        public static CfrV8Value CreateFunction(string name, CfrV8Handler handler)
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxV8ValueCreateFunctionRemoteCall();

            call.name = name;
            if (!CfrObject.CheckConnection(handler, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "handler");
            }
            call.handler = CfrObject.Unwrap(handler).ptr;
            call.RequestExecution(connection);
            return(CfrV8Value.Wrap(new RemotePtr(connection, call.__retval)));
        }