private int read(cef_resource_handler_t *self, void *data_out, int bytes_to_read, int *bytes_read, cef_resource_read_callback_t *callback) { CheckSelf(self); var m_callback = CefResourceReadCallback.FromNative(callback); var m_result = Read((IntPtr)data_out, bytes_to_read, out var m_bytesRead, m_callback); *bytes_read = m_bytesRead; return(m_result ? 1 : 0); }
/// <summary> /// Read response data. If data is available immediately copy up to /// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of /// bytes copied, and return true. To read the data at a later time keep a /// pointer to |data_out|, set |bytes_read| to 0, return true and execute /// |callback| when the data is available (|data_out| will remain valid until /// the callback is executed). To indicate response completion set |bytes_read| /// to 0 and return false. To indicate failure set |bytes_read| to < 0 (e.g. -2 /// for ERR_FAILED) and return false. This method will be called in sequence /// but not from a dedicated thread. For backwards compatibility set /// |bytes_read| to -1 and return false and the ReadResponse method will be /// called. /// </summary> protected abstract bool Read(IntPtr dataOut, int bytesToRead, out int bytesRead, CefResourceReadCallback callback);