Example #1
0
 internal static cef_user_data_t* Alloc()
 {
     var ptr = (cef_user_data_t*)Marshal.AllocHGlobal(_sizeof);
     *ptr = new cef_user_data_t();
     ptr->_base._size = (UIntPtr)_sizeof;
     return ptr;
 }
Example #2
0
 internal static cef_user_data_t* Alloc()
 {
     var ptr = (cef_user_data_t*)Marshal.AllocHGlobal(_sizeof);
     *ptr = new cef_user_data_t();
     ptr->_base._size = (UIntPtr)_sizeof;
     return ptr;
 }
Example #3
0
 internal static CefUserData FromNativeOrNull(cef_user_data_t* ptr)
 {
     CefUserData 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_user_data_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
Example #5
0
 private int release(cef_user_data_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
             return 1;
         }
         return 0;
     }
 }
Example #6
0
 internal static CefUserData FromNative(cef_user_data_t* ptr)
 {
     var value = FromNativeOrNull(ptr);
     if (value == null) throw ExceptionBuilder.ObjectNotFound();
     return value;
 }
Example #7
0
 private int get_refct(cef_user_data_t* self)
 {
     return _refct;
 }
Example #8
0
 private void CheckSelf(cef_user_data_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
Example #9
0
 private int has_one_ref(cef_user_data_t* self)
 {
     lock (SyncRoot) { return _refct == 1 ? 1 : 0; }
 }
Example #10
0
 internal static void Free(cef_user_data_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }