internal static cef_urlrequest_client_t* Alloc()
 {
     var ptr = (cef_urlrequest_client_t*)Marshal.AllocHGlobal(_sizeof);
     *ptr = new cef_urlrequest_client_t();
     ptr->_base._size = (UIntPtr)_sizeof;
     return ptr;
 }
        internal static cef_urlrequest_client_t *Alloc()
        {
            var ptr = (cef_urlrequest_client_t *)Marshal.AllocHGlobal(_sizeof);

            *ptr = new cef_urlrequest_client_t();
            ptr->_base._size = (UIntPtr)_sizeof;
            return(ptr);
        }
        private void on_download_progress(cef_urlrequest_client_t* self, cef_urlrequest_t* request, ulong current, ulong total)
        {
            CheckSelf(self);

            var m_request = CefUrlRequest.FromNative(request);

            OnDownloadProgress(m_request, current, total);
        }
        private void on_request_complete(cef_urlrequest_client_t* self, cef_urlrequest_t* request)
        {
            CheckSelf(self);

            var m_request = CefUrlRequest.FromNative(request);

            OnRequestComplete(m_request);
        }
 internal static CefUrlRequestClient FromNativeOrNull(cef_urlrequest_client_t* ptr)
 {
     CefUrlRequestClient value = null;
     bool found;
     lock (_roots)
     {
         found = _roots.TryGetValue((IntPtr)ptr, out value);
     }
     return found ? value : null;
 }
        private void on_download_data(cef_urlrequest_client_t* self, cef_urlrequest_t* request, void* data, UIntPtr data_length)
        {
            CheckSelf(self);

            var m_request = CefUrlRequest.FromNative(request);

            using (var stream = new UnmanagedMemoryStream((byte*)data, (long)data_length))
            {
                OnDownloadData(m_request, stream);
            }
        }
 private int add_ref(cef_urlrequest_client_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
         return result;
     }
 }
 internal static void Free(cef_urlrequest_client_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
 public static extern cef_urlrequest_t* create(cef_request_t* request, cef_urlrequest_client_t* client);
        private int get_auth_credentials(cef_urlrequest_client_t* self, int isProxy, cef_string_t* host, int port, cef_string_t* realm, cef_string_t* scheme, cef_auth_callback_t* callback)
        {
            CheckSelf(self);

            var m_isProxy = isProxy != 0;
            var m_host = cef_string_t.ToString(host);
            var m_realm = cef_string_t.ToString(realm);
            var m_scheme = cef_string_t.ToString(scheme);
            var m_callback = CefAuthCallback.FromNative(callback);

            var m_result = GetAuthCredentials(m_isProxy, m_host, port, m_realm, m_scheme, m_callback);

            return m_result ? 1 : 0;
        }
 private int release(cef_urlrequest_client_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return result;
     }
 }
 internal static CefUrlRequestClient FromNative(cef_urlrequest_client_t* ptr)
 {
     var value = FromNativeOrNull(ptr);
     if (value == null) throw ExceptionBuilder.ObjectNotFound();
     return value;
 }
 private void CheckSelf(cef_urlrequest_client_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
 private int get_refct(cef_urlrequest_client_t* self)
 {
     return _refct;
 }