示例#1
0
        /// <summary>
        /// Returns the task runner for the current thread. Only CEF threads will have
        /// task runners. An NULL reference will be returned if this function is called
        /// on an invalid thread.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public static CfrTaskRunner GetForCurrentThread()
        {
            var call = new CfxTaskRunnerGetForCurrentThreadRemoteCall();

            call.RequestExecution();
            return(CfrTaskRunner.Wrap(new RemotePtr(call.__retval)));
        }
        /// <summary>
        /// Returns the task runner for the current thread. Only CEF threads will have
        /// task runners. An NULL reference will be returned if this function is called
        /// on an invalid thread.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public static CfrTaskRunner GetForCurrentThread()
        {
            var call = new CfxTaskRunnerGetForCurrentThreadRenderProcessCall();

            call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);
            return(CfrTaskRunner.Wrap(call.__retval));
        }
示例#3
0
        /// <summary>
        /// Returns the task runner for the specified CEF thread.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public static CfrTaskRunner GetForThread(CfxThreadId threadId)
        {
            var call = new CfxTaskRunnerGetForThreadRemoteCall();

            call.threadId = (int)threadId;
            call.RequestExecution();
            return(CfrTaskRunner.Wrap(new RemotePtr(call.__retval)));
        }
示例#4
0
        /// <summary>
        /// Returns the task runner for the current thread. Only CEF threads will have
        /// task runners. An NULL reference will be returned if this function is called
        /// on an invalid thread.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public static CfrTaskRunner GetForCurrentThread()
        {
            var connection = CfxRemoteCallContext.CurrentContext.connection;
            var call       = new CfxTaskRunnerGetForCurrentThreadRemoteCall();

            call.RequestExecution(connection);
            return(CfrTaskRunner.Wrap(new RemotePtr(connection, call.__retval)));
        }
        /// <summary>
        /// Returns true (1) if this object is pointing to the same task runner 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_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public bool IsSame(CfrTaskRunner that)
        {
            var call = new CfxTaskRunnerIsSameRenderProcessCall();

            call.@this = proxyId;
            call.that  = CfrObject.Unwrap(that);
            call.RequestExecution(this);
            return(call.__retval);
        }
示例#6
0
        /// <summary>
        /// Returns true (1) if this object is pointing to the same task runner 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_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public bool IsSame(CfrTaskRunner that)
        {
            var call = new CfxTaskRunnerIsSameRemoteCall();

            call.@this = RemotePtr.ptr;
            call.that  = CfrObject.Unwrap(that).ptr;
            call.RequestExecution(RemotePtr.connection);
            return(call.__retval);
        }
示例#7
0
        /// <summary>
        /// Returns true (1) if this object is pointing to the same task runner 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_task_capi.h">cef/include/capi/cef_task_capi.h</see>.
        /// </remarks>
        public bool IsSame(CfrTaskRunner that)
        {
            var connection = RemotePtr.connection;
            var call       = new CfxTaskRunnerIsSameRemoteCall();

            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);
        }
        internal static CfrTaskRunner Wrap(IntPtr proxyId)
        {
            if (proxyId == IntPtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrTaskRunner)weakCache.Get(proxyId);
                if (cfrObj == null)
                {
                    cfrObj = new CfrTaskRunner(proxyId);
                    weakCache.Add(proxyId, cfrObj);
                }
                return(cfrObj);
            }
        }
示例#9
0
        internal static CfrTaskRunner Wrap(RemotePtr remotePtr)
        {
            if (remotePtr == RemotePtr.Zero)
            {
                return(null);
            }
            var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache;

            lock (weakCache) {
                var cfrObj = (CfrTaskRunner)weakCache.Get(remotePtr.ptr);
                if (cfrObj == null)
                {
                    cfrObj = new CfrTaskRunner(remotePtr);
                    weakCache.Add(remotePtr.ptr, cfrObj);
                }
                return(cfrObj);
            }
        }