Esempio n. 1
0
        /// <summary>
        /// Returns the entered (bottom) 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 CfrV8Context GetEnteredContext()
        {
            var call = new CfxV8ContextGetEnteredContextRenderProcessCall();

            call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);
            return(CfrV8Context.Wrap(call.__retval));
        }
Esempio n. 2
0
        /// <summary>
        /// Returns the entered (bottom) 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 CfrV8Context GetEnteredContext()
        {
            var call = new CfxV8ContextGetEnteredContextRemoteCall();

            call.RequestExecution();
            return(CfrV8Context.Wrap(new RemotePtr(call.__retval)));
        }
Esempio n. 3
0
        /// <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 CfrV8Value ExecuteFunctionWithContext(CfrV8Context context, CfrV8Value @object, CfrV8Value[] arguments)
        {
            var connection = RemotePtr.connection;
            var call       = new CfxV8ValueExecuteFunctionWithContextRemoteCall();

            call.@this = RemotePtr.ptr;
            if (!CfrObject.CheckConnection(context, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "context");
            }
            call.context = CfrObject.Unwrap(context).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. 4
0
        /// <summary>
        /// Returns the entered (bottom) 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 CfrV8Context GetEnteredContext()
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxV8ContextGetEnteredContextRemoteCall();

            call.RequestExecution(connection);
            return(CfrV8Context.Wrap(new RemotePtr(connection, call.__retval)));
        }
Esempio n. 5
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(CfrV8Context that)
        {
            var call = new CfxV8ContextIsSameRenderProcessCall();

            call.self = CfrObject.Unwrap(this);
            call.that = CfrObject.Unwrap(that);
            call.RequestExecution(this);
            return(call.__retval);
        }
Esempio n. 6
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(CfrV8Context that)
        {
            var call = new CfxV8ContextIsSameRemoteCall();

            call.@this = RemotePtr.ptr;
            call.that  = CfrObject.Unwrap(that).ptr;
            call.RequestExecution(RemotePtr.connection);
            return(call.__retval);
        }
Esempio n. 7
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(CfrV8Context that)
        {
            var connection = RemotePtr.connection;
            var call       = new CfxV8ContextIsSameRemoteCall();

            call.@this = RemotePtr.ptr;
            if (!CfrObject.CheckConnection(that, connection))
            {
                throw new ArgumentException("Render process connection mismatch.", "that");
            }
            call.that = CfrObject.Unwrap(that).ptr;
            call.RequestExecution(connection);
            return(call.__retval);
        }
Esempio n. 8
0
        internal static CfrV8Context Wrap(IntPtr proxyId)
        {
            if (proxyId == IntPtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrV8Context)weakCache.Get(proxyId);
                if (cfrObj == null)
                {
                    cfrObj = new CfrV8Context(proxyId);
                    weakCache.Add(proxyId, cfrObj);
                }
                return(cfrObj);
            }
        }
Esempio n. 9
0
        /// <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 CfrV8Value ExecuteFunctionWithContext(CfrV8Context context, CfrV8Value @object, CfrV8Value[] arguments)
        {
            var call = new CfxV8ValueExecuteFunctionWithContextRemoteCall();

            call.@this   = RemotePtr.ptr;
            call.context = CfrObject.Unwrap(context).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)));
        }
Esempio n. 10
0
        /// <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 CfrV8Value ExecuteFunctionWithContext(CfrV8Context context, CfrV8Value @object, CfrV8Value[] arguments)
        {
            var call = new CfxV8ValueExecuteFunctionWithContextRenderProcessCall();

            call.self    = CfrObject.Unwrap(this);
            call.context = CfrObject.Unwrap(context);
            call.@object = CfrObject.Unwrap(@object);
            if (arguments != null)
            {
                call.arguments = new IntPtr[arguments.Length];
                for (int i = 0; i < arguments.Length; ++i)
                {
                    call.arguments[i] = CfrObject.Unwrap(arguments[i]);
                }
            }
            call.RequestExecution(this);
            return(CfrV8Value.Wrap(call.__retval));
        }
Esempio n. 11
0
        internal static CfrV8Context Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrV8Context)weakCache.Get(remotePtr.ptr);
                if (cfrObj == null)
                {
                    cfrObj = new CfrV8Context(remotePtr);
                    weakCache.Add(remotePtr.ptr, cfrObj);
                }
                return(cfrObj);
            }
        }
 internal ChromiumFxConverter(CfrV8Context context) 
 {
     _CfrV8Context = context;
 }
Esempio n. 13
0
 internal static CfrV8Context Wrap(IntPtr proxyId)
 {
     if(proxyId == IntPtr.Zero) return null;
     var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;
     lock(weakCache) {
         var cfrObj = (CfrV8Context)weakCache.Get(proxyId);
         if(cfrObj == null) {
             cfrObj = new CfrV8Context(proxyId);
             weakCache.Add(proxyId, cfrObj);
         }
         return cfrObj;
     }
 }
Esempio n. 14
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(CfrV8Context that)
 {
     var call = new CfxV8ContextIsSameRenderProcessCall();
     call.self = CfrObject.Unwrap(this);
     call.that = CfrObject.Unwrap(that);
     call.RequestExecution(this);
     return call.__retval;
 }