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;
 }
Esempio n. 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);
        }
 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;
 }
 private int release(cef_v8handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return result;
     }
 }
 private int add_ref(cef_v8handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
         return result;
     }
 }
Esempio n. 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;
        }
 internal static void Free(cef_v8handler_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
 public static extern cef_v8value_t* create_function(cef_string_t* name, cef_v8handler_t* handler);
 private int get_refct(cef_v8handler_t* self)
 {
     return _refct;
 }
Esempio n. 10
0
 internal static CefV8Handler FromNative(cef_v8handler_t* ptr)
 {
     var value = FromNativeOrNull(ptr);
     if (value == null) throw ExceptionBuilder.ObjectNotFound();
     return value;
 }
Esempio n. 11
0
 private void CheckSelf(cef_v8handler_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
Esempio n. 12
0
 public static extern int register_extension(cef_string_t* extension_name, cef_string_t* javascript_code, cef_v8handler_t* handler);