コード例 #1
0
ファイル: CfrTaskRunner.cs プロジェクト: 386845154a/NanUI-1
        /// <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)));
        }
コード例 #2
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 CfxTaskRunnerGetForCurrentThreadRenderProcessCall();

            call.RequestExecution(CfxRemoteCallContext.CurrentContext.connection);
            return(CfrTaskRunner.Wrap(call.__retval));
        }
コード例 #3
0
ファイル: CfrTaskRunner.cs プロジェクト: 386845154a/NanUI-1
        /// <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
ファイル: CfrTaskRunner.cs プロジェクト: tianqiq/ChromiumFX
        /// <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)));
        }
コード例 #5
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 CfxTaskRunnerIsSameRenderProcessCall();

            call.@this = proxyId;
            call.that  = CfrObject.Unwrap(that);
            call.RequestExecution(this);
            return(call.__retval);
        }
コード例 #6
0
ファイル: CfrTaskRunner.cs プロジェクト: 386845154a/NanUI-1
        /// <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
ファイル: CfrTaskRunner.cs プロジェクト: tianqiq/ChromiumFX
        /// <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);
        }
コード例 #8
0
        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
ファイル: CfrTaskRunner.cs プロジェクト: 386845154a/NanUI-1
        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);
            }
        }