Example #1
0
 internal static cef_v8handler_t* Alloc()
 {
     var ptr = (cef_v8handler_t*)Marshal.AllocHGlobal(_sizeof);
     *ptr = new cef_v8handler_t();
     ptr->_base._size = (UIntPtr)_sizeof;
     return ptr;
 }
Example #2
0
        internal static cef_v8handler_t *Alloc()
        {
            var ptr = (cef_v8handler_t *)Marshal.AllocHGlobal(_sizeof);

            *ptr = new cef_v8handler_t();
            ptr->_base._size = (UIntPtr)_sizeof;
            return(ptr);
        }
Example #3
0
 internal static CefV8Handler FromNativeOrNull(cef_v8handler_t* ptr)
 {
     CefV8Handler value = null;
     bool found;
     lock (_roots)
     {
         found = _roots.TryGetValue((IntPtr)ptr, out value);
     }
     return found ? value : null;
 }
Example #4
0
 private void add_ref(cef_v8handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
Example #5
0
 private int release(cef_v8handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
             return 1;
         }
         return 0;
     }
 }
Example #6
0
        private int execute(cef_v8handler_t* self, cef_string_t* name, cef_v8value_t* @object, UIntPtr argumentsCount, cef_v8value_t** arguments, cef_v8value_t** retval, cef_string_t* exception)
        {
            CheckSelf(self);

            var m_name = cef_string_t.ToString(name);
            var m_obj = CefV8Value.FromNative(@object);
            var argc = (int)argumentsCount;
            CefV8Value[] m_arguments;
            if (argc == 0) { m_arguments = emtpyArgs; }
            else
            {
                m_arguments = new CefV8Value[argc];
                for (var i = 0; i < argc; i++)
                {
                    m_arguments[i] = CefV8Value.FromNative(arguments[i]);
                }
            }

            CefV8Value m_returnValue;
            string m_exception;

            var handled = Execute(m_name, m_obj, m_arguments, out m_returnValue, out m_exception);

            if (handled)
            {
                if (m_exception != null)
                {
                    cef_string_t.Copy(m_exception, exception);
                }
                else if (m_returnValue != null)
                {
                    *retval = m_returnValue.ToNative();
                }
            }

            return handled ? 1 : 0;
        }
Example #7
0
 internal static void Free(cef_v8handler_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
Example #8
0
 public static extern int register_extension(cef_string_t* extension_name, cef_string_t* javascript_code, cef_v8handler_t* handler);
Example #9
0
 public static extern cef_v8value_t* create_function(cef_string_t* name, cef_v8handler_t* handler);
Example #10
0
 private int has_one_ref(cef_v8handler_t* self)
 {
     lock (SyncRoot) { return _refct == 1 ? 1 : 0; }
 }
Example #11
0
 internal static CefV8Handler FromNative(cef_v8handler_t* ptr)
 {
     var value = FromNativeOrNull(ptr);
     if (value == null) throw ExceptionBuilder.ObjectNotFound();
     return value;
 }
Example #12
0
 private void CheckSelf(cef_v8handler_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
Example #13
0
 private int get_refct(cef_v8handler_t* self)
 {
     return _refct;
 }