コード例 #1
0
        internal static cef_resource_handler_t *Alloc()
        {
            var ptr = (cef_resource_handler_t *)Marshal.AllocHGlobal(_sizeof);

            *ptr = new cef_resource_handler_t();
            ptr->_base._size = (UIntPtr)_sizeof;
            return(ptr);
        }
コード例 #2
0
        private int process_request(cef_resource_handler_t* self, cef_request_t* request, cef_callback_t* callback)
        {
            CheckSelf(self);

            var m_request = CefRequest.FromNative(request);
            var m_callback = CefCallback.FromNative(callback);

            var result = ProcessRequest(m_request, m_callback);
            return result ? 1 : 0;
        }
コード例 #3
0
 private int release(cef_resource_handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return result;
     }
 }
コード例 #4
0
 private int add_ref(cef_resource_handler_t* self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
         return result;
     }
 }
コード例 #5
0
        private int read_response(cef_resource_handler_t* self, void* data_out, int bytes_to_read, int* bytes_read, cef_callback_t* callback)
        {
            CheckSelf(self);

            var m_callback = CefCallback.FromNative(callback);

            using (var m_stream = new UnmanagedMemoryStream((byte*)data_out, bytes_to_read, bytes_to_read, FileAccess.Write))
            {
                int m_bytesRead;
                var result = ReadResponse(m_stream, bytes_to_read, out m_bytesRead, m_callback);
                *bytes_read = m_bytesRead;
                return result ? 1 : 0;
            }
        }
コード例 #6
0
        private void get_response_headers(cef_resource_handler_t* self, cef_response_t* response, long* response_length, cef_string_t* redirectUrl)
        {
            CheckSelf(self);

            var m_response = CefResponse.FromNative(response);
            long m_responseLength;
            string m_redirectUrl;

            GetResponseHeaders(m_response, out m_responseLength, out m_redirectUrl);

            *response_length = m_responseLength;

            if (!string.IsNullOrEmpty(m_redirectUrl))
            {
                cef_string_t.Copy(m_redirectUrl, redirectUrl);
            }
        }
コード例 #7
0
        private int can_get_cookie(cef_resource_handler_t* self, cef_cookie_t* cookie)
        {
            CheckSelf(self);

            var m_cookie = CefCookie.FromNative(cookie);

            return CanGetCookie(m_cookie) ? 1 : 0;
        }
コード例 #8
0
        private void cancel(cef_resource_handler_t* self)
        {
            CheckSelf(self);

            Cancel();
        }
コード例 #9
0
 private int get_refct(cef_resource_handler_t* self)
 {
     return _refct;
 }
コード例 #10
0
 private void CheckSelf(cef_resource_handler_t* self)
 {
     if (_self != self) throw ExceptionBuilder.InvalidSelfReference();
 }
コード例 #11
0
 internal static void Free(cef_resource_handler_t* ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
コード例 #12
0
 internal static cef_resource_handler_t* Alloc()
 {
     var ptr = (cef_resource_handler_t*)Marshal.AllocHGlobal(_sizeof);
     *ptr = new cef_resource_handler_t();
     ptr->_base._size = (UIntPtr)_sizeof;
     return ptr;
 }