Esempio n. 1
0
        /// <summary>
        /// Execute the function using the current V8 context. This function should
        /// only be called from within the scope of a CfrV8Handler or
        /// CfrV8Accessor callback, or in combination with calling enter() and
        /// exit() on a stored CfrV8Context reference. |object| is the receiver
        /// ('this' object) of the function. If |object| is NULL the current 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 function is called incorrectly or an exception is
        /// thrown.
        /// </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 CfrV8Value ExecuteFunction(CfrV8Value @object, CfrV8Value[] arguments)
        {
            var connection = RemotePtr.connection;
            var call       = new CfxV8ValueExecuteFunctionRemoteCall();

            call.@this = RemotePtr.ptr;
            if (!CfrObject.CheckConnection(@object, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "object");
            }
            call.@object = CfrObject.Unwrap(@object).ptr;
            if (arguments != null)
            {
                call.arguments = new IntPtr[arguments.Length];
                for (int i = 0; i < arguments.Length; ++i)
                {
                    if (!CheckConnection(arguments[i], connection))
                    {
                        throw new ArgumentException("Render process connection mismatch.", "arguments[" + i + "]");
                    }
                    call.arguments[i] = CfrObject.Unwrap(arguments[i]).ptr;
                }
            }
            call.RequestExecution(connection);
            return(CfrV8Value.Wrap(new RemotePtr(connection, call.__retval)));
        }
Esempio n. 2
0
        /// <summary>
        /// Execute the function using the current V8 context. This function should
        /// only be called from within the scope of a CfrV8Handler or
        /// CfrV8Accessor callback, or in combination with calling enter() and
        /// exit() on a stored CfrV8Context reference. |object| is the receiver
        /// ('this' object) of the function. If |object| is NULL the current 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 function is called incorrectly or an exception is
        /// thrown.
        /// </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 CfrV8Value ExecuteFunction(CfrV8Value @object, CfrV8Value[] arguments)
        {
            var call = new CfxV8ValueExecuteFunctionRemoteCall();

            call.@this   = RemotePtr.ptr;
            call.@object = CfrObject.Unwrap(@object).ptr;
            if (arguments != null)
            {
                call.arguments = new IntPtr[arguments.Length];
                for (int i = 0; i < arguments.Length; ++i)
                {
                    call.arguments[i] = CfrObject.Unwrap(arguments[i]).ptr;
                }
            }
            call.RequestExecution(RemotePtr.connection);
            return(CfrV8Value.Wrap(new RemotePtr(call.__retval)));
        }