Exemplo n.º 1
0
 internal static CfxTaskRunner Wrap(IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         return(null);
     }
     lock (weakCache) {
         var wrapper = (CfxTaskRunner)weakCache.Get(nativePtr);
         if (wrapper == null)
         {
             wrapper = new CfxTaskRunner(nativePtr);
             weakCache.Add(wrapper);
         }
         else
         {
             CfxApi.cfx_release(nativePtr);
         }
         return(wrapper);
     }
 }
Exemplo n.º 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 CfxTaskRunner GetForCurrentThread()
 {
     return(CfxTaskRunner.Wrap(CfxApi.cfx_task_runner_get_for_current_thread()));
 }
Exemplo n.º 3
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(CfxTaskRunner that)
 {
     return(0 != CfxApi.cfx_task_runner_is_same(NativePtr, CfxTaskRunner.Unwrap(that)));
 }
Exemplo n.º 4
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 CfxTaskRunner GetForThread(CfxThreadId threadId)
 {
     return(CfxTaskRunner.Wrap(CfxApi.cfx_task_runner_get_for_thread((int)threadId)));
 }
Exemplo n.º 5
0
 internal static CfxTaskRunner Wrap(IntPtr nativePtr)
 {
     if(nativePtr == IntPtr.Zero) return null;
     lock(weakCache) {
         var wrapper = (CfxTaskRunner)weakCache.Get(nativePtr);
         if(wrapper == null) {
             wrapper = new CfxTaskRunner(nativePtr);
             weakCache.Add(wrapper);
         } else {
             CfxApi.cfx_release(nativePtr);
         }
         return wrapper;
     }
 }
Exemplo n.º 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(CfxTaskRunner that)
 {
     return 0 != CfxApi.cfx_task_runner_is_same(NativePtr, CfxTaskRunner.Unwrap(that));
 }