Exemple #1
0
 public unsafe int PostTask(cef_task_t *task)
 {
     fixed(cef_task_runner_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_task_runner_t *, cef_task_t *, int >)post_task)(self, task));
     }
 }
Exemple #2
0
 private void CheckSelf(cef_task_t *self)
 {
     if (_self != self)
     {
         throw ExceptionBuilder.InvalidSelfReference();
     }
 }
Exemple #3
0
 public unsafe int PostDelayedTask(cef_task_t *task, long delay_ms)
 {
     fixed(cef_task_runner_t *self = &this)
     {
         return(((delegate * unmanaged[Stdcall] < cef_task_runner_t *, cef_task_t *, long, int >)post_delayed_task)(self, task, delay_ms));
     }
 }
Exemple #4
0
        /// <summary>
        /// Method that will be executed.
        /// |threadId| is the thread executing the call.
        /// </summary>
        private void execute(cef_task_t *self, cef_thread_id_t threadId)
        {
#if DIAGNOSTICS
            Cef.Logger.Trace(LogTarget.CefTask, self, "Execute: ThreadId=[{0}]", threadId);
#endif

            this.Execute((CefThreadId)threadId);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_task_t.Free(_self);
         _self = null;
     }
 }
Exemple #6
0
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_task_t.Free(_self);
         _self = null;
     }
 }
Exemple #7
0
        // void (*)(_cef_task_t* self)*
        private static unsafe void ExecuteImpl(cef_task_t *self)
        {
            var instance = GetInstance((IntPtr)self) as CefTask;

            if (instance == null)
            {
                return;
            }
            instance.Execute();
        }
Exemple #8
0
        public CefTask()
        {
            cef_task_t *self = this.NativeInstance;

                        #if NET_LESS_5_0
            self->execute = (void *)Marshal.GetFunctionPointerForDelegate(fnExecute);
                        #else
            self->execute = (delegate * unmanaged[Stdcall] < cef_task_t *, void >) & ExecuteImpl;
                        #endif
        }
Exemple #9
0
 private void add_ref(cef_task_t *self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
Exemple #10
0
 private int release(cef_task_t *self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return(result);
     }
 }
Exemple #11
0
        protected CefTask()
        {
            _self = cef_task_t.Alloc();

            _ds0 = new cef_task_t.add_ref_delegate(add_ref);
            _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
            _ds1 = new cef_task_t.release_delegate(release);
            _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
            _ds2 = new cef_task_t.has_one_ref_delegate(has_one_ref);
            _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
            _ds3            = new cef_task_t.execute_delegate(execute);
            _self->_execute = Marshal.GetFunctionPointerForDelegate(_ds3);
        }
 protected CefTask()
 {
     _self = cef_task_t.Alloc();
 
     _ds0 = new cef_task_t.add_ref_delegate(add_ref);
     _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
     _ds1 = new cef_task_t.release_delegate(release);
     _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
     _ds2 = new cef_task_t.get_refct_delegate(get_refct);
     _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2);
     _ds3 = new cef_task_t.execute_delegate(execute);
     _self->_execute = Marshal.GetFunctionPointerForDelegate(_ds3);
 }
        public static int post_delayed_task(cef_task_runner_t *self, cef_task_t *task, long delay_ms)
        {
            post_delayed_task_delegate d;
            var p = self->_post_delayed_task;

            if (p == _p7)
            {
                d = _d7;
            }
            else
            {
                d = (post_delayed_task_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(post_delayed_task_delegate));
                if (_p7 == IntPtr.Zero)
                {
                    _d7 = d; _p7 = p;
                }
            }
            return(d(self, task, delay_ms));
        }
        public static int post_task(cef_task_runner_t *self, cef_task_t *task)
        {
            post_task_delegate d;
            var p = self->_post_task;

            if (p == _p6)
            {
                d = _d6;
            }
            else
            {
                d = (post_task_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(post_task_delegate));
                if (_p6 == IntPtr.Zero)
                {
                    _d6 = d; _p6 = p;
                }
            }
            return(d(self, task));
        }
Exemple #15
0
 public unsafe extern int PostTask(cef_task_t *task);
Exemple #16
0
 private int has_one_ref(cef_task_t *self)
 {
     lock (SyncRoot) { return(_refct == 1 ? 1 : 0); }
 }
 /// <summary>
 /// Post a task for delayed execution on the thread associated with this task
 /// runner. Execution will occur asynchronously. Delayed tasks are not
 /// supported on V8 WebWorker threads and will be executed without the
 /// specified delay.
 /// </summary>
 public int PostDelayedTask(cef_task_t *task, long delay_ms)
 {
     throw new NotImplementedException(); // TODO: CefTaskRunner.PostDelayedTask
 }
Exemple #18
0
        public CefTask()
        {
            cef_task_t *self = this.NativeInstance;

            self->execute = (void *)Marshal.GetFunctionPointerForDelegate(fnExecute);
        }
Exemple #19
0
 private int has_at_least_one_ref(cef_task_t *self)
 {
     lock (SyncRoot) { return(_refct != 0 ? 1 : 0); }
 }
Exemple #20
0
        private void execute(cef_task_t *self)
        {
            CheckSelf(self);

            Execute();
        }
Exemple #21
0
 public CefTask(cef_task_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
Exemple #22
0
 internal static void Free(cef_task_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
 private void execute(cef_task_t *self)
 {
     CheckSelf(self);
     throw new NotImplementedException(); // TODO: CefTask.Execute
 }
Exemple #24
0
 public static extern int post_task(CefThreadId threadId, cef_task_t *task);
 /// <summary>
 /// Post a task for execution on the thread associated with this task runner.
 /// Execution will occur asynchronously.
 /// </summary>
 public int PostTask(cef_task_t *task)
 {
     throw new NotImplementedException(); // TODO: CefTaskRunner.PostTask
 }
Exemple #26
0
 private int get_refct(cef_task_t *self)
 {
     return(_refct);
 }
Exemple #27
0
 public static extern int post_delayed_task(CefThreadId threadId, cef_task_t *task, long delay_ms);
Exemple #28
0
 public unsafe extern int PostDelayedTask(cef_task_t *task, long delay_ms);