diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-24 01:54:05 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-24 01:54:05 +0000 |
commit | 1f8859ad6ec7ea807c0330ddf5559e13be5fb26c (patch) | |
tree | 68887107d0d40f1b22c7a7a07ccd9d7e4caf157a /net/url_request/url_request.h | |
parent | 13dc122db24457653d57ff07791043d518eb05e7 (diff) | |
download | chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.zip chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.tar.gz chromium_src-1f8859ad6ec7ea807c0330ddf5559e13be5fb26c.tar.bz2 |
Change URLRequest to use a ref-counted buffer for actual IO.The ref-counting will prevent the deletion / reuse of memorywhile the buffer is actually being used by pending IO.This seems a very intrusive change, but at least we will be ableto make sure that it works without having to chase every singledestruction of an URLRequest to make sure that any pending IOwas cancelled, and also allows us to avoid blocking onthe object destruction.BUG=5325
Review URL: http://codereview.chromium.org/18390
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request.h')
-rw-r--r-- | net/url_request/url_request.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index 5dfc711..f697362 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -21,6 +21,9 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_status.h" +namespace net { +class IOBuffer; +} class URLRequestJob; // This stores the values of the Set-Cookie headers received during the request. @@ -367,16 +370,14 @@ class URLRequest { // successful status. // If data is available, Read will return true, and the data and length will // be returned immediately. If data is not available, Read returns false, - // and an asynchronous Read is initiated. The caller guarantees the - // buffer provided will be available until the Read is finished. The - // Read is finished when the caller receives the OnReadComplete - // callback. OnReadComplete will be always be called, even if there - // was a failure. + // and an asynchronous Read is initiated. The Read is finished when + // the caller receives the OnReadComplete callback. OnReadComplete will be + // always be called, even if there was a failure. // - // The buf parameter is a buffer to receive the data. Once the read is - // initiated, the caller guarantees availability of this buffer until - // the OnReadComplete is received. The buffer must be at least - // max_bytes in length. + // The buf parameter is a buffer to receive the data. If the operation + // completes asynchronously, the implementation will reference the buffer + // until OnReadComplete is called. The buffer must be at least max_bytes in + // length. // // The max_bytes parameter is the maximum number of bytes to read. // @@ -386,7 +387,7 @@ class URLRequest { // // If a read error occurs, Read returns false and the request->status // will be set to an error. - bool Read(char* buf, int max_bytes, int *bytes_read); + bool Read(net::IOBuffer* buf, int max_bytes, int *bytes_read); // One of the following two methods should be called in response to an // OnAuthRequired() callback (and only then). |