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

            *ptr = new cef_write_handler_t();
            ptr->_base._size = (UIntPtr)_sizeof;
            return(ptr);
        }
        private UIntPtr write(cef_write_handler_t* self, void* ptr, UIntPtr size, UIntPtr n)
        {
            CheckSelf(self);

            var length = (long)size * (long)n;
            using (var stream = new UnmanagedMemoryStream((byte*)ptr, length, length, FileAccess.Write))
            {
                return (UIntPtr)Write(stream, length);
            }
        }
 private int release(cef_write_handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return result;
     }
 }
 private int add_ref(cef_write_handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
         return result;
     }
 }
 internal static void Free(cef_write_handler_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
        private int flush(cef_write_handler_t* self)
        {
            CheckSelf(self);

            return Flush() ? 0 : -1;
        }
        private long tell(cef_write_handler_t* self)
        {
            CheckSelf(self);

            return Tell();
        }
        private int seek(cef_write_handler_t* self, long offset, int whence)
        {
            CheckSelf(self);

            return Seek(offset, (SeekOrigin)whence) ? 0 : -1;
        }
 private int get_refct(cef_write_handler_t* self)
 {
     return _refct;
 }
 private void CheckSelf(cef_write_handler_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
 public static extern cef_stream_writer_t* create_for_handler(cef_write_handler_t* handler);