Example #1
0
 /// <summary>
 /// Returns true (1) if this object is pointing to the same handle as |that|
 /// object.
 /// </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 bool IsSame(CfxV8Context that)
 {
     return(0 != CfxApi.V8Context.cfx_v8context_is_same(NativePtr, CfxV8Context.Unwrap(that)));
 }
Example #2
0
 /// <summary>
 /// Returns the current (top) context object in the V8 context stack.
 /// </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 CfxV8Context GetCurrentContext()
 {
     return(CfxV8Context.Wrap(CfxApi.V8Context.cfx_v8context_get_current_context()));
 }
        /// <summary>
        /// Execute the function using the specified V8 context. |object| is the
        /// receiver ('this' object) of the function. If |object| is NULL 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 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 CfxV8Value ExecuteFunctionWithContext(CfxV8Context context, CfxV8Value @object, CfxV8Value[] arguments)
        {
            UIntPtr arguments_length;

            IntPtr[] arguments_ptrs;
            if (arguments != null)
            {
                arguments_length = (UIntPtr)arguments.Length;
                arguments_ptrs   = new IntPtr[arguments.Length];
                for (int i = 0; i < arguments.Length; ++i)
                {
                    arguments_ptrs[i] = CfxV8Value.Unwrap(arguments[i]);
                }
            }
            else
            {
                arguments_length = UIntPtr.Zero;
                arguments_ptrs   = null;
            }
            PinnedObject arguments_pinned = new PinnedObject(arguments_ptrs);
            var          __retval         = CfxApi.V8Value.cfx_v8value_execute_function_with_context(NativePtr, CfxV8Context.Unwrap(context), CfxV8Value.Unwrap(@object), arguments_length, arguments_pinned.PinnedPtr);

            arguments_pinned.Free();
            return(CfxV8Value.Wrap(__retval));
        }