diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-31 12:13:14 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-31 12:13:14 +0000 |
commit | 446b1856d31c70cac44552dd1536a8e3a90ea850 (patch) | |
tree | d236d42d0503adaa95270befd830606c0d29b4a2 /net/url_request/url_request_job.h | |
parent | 510acee3c06adff88557f4699dd47e4ab9937b25 (diff) | |
download | chromium_src-446b1856d31c70cac44552dd1536a8e3a90ea850.zip chromium_src-446b1856d31c70cac44552dd1536a8e3a90ea850.tar.gz chromium_src-446b1856d31c70cac44552dd1536a8e3a90ea850.tar.bz2 |
Add the actual data being read to the OnBytesRead callback, take two.
This change was originally committed as
http://src.chromium.org/viewvc/chrome?view=rev&revision=53178
then rolled back as
http://src.chromium.org/viewvc/chrome?view=rev&revision=53416
due to a breakage in FLAKY_UnknownSize download test.
FLAKY_UnknownSize depended on code with a bug that was exposed by this change. That bug has since been fixed and committed as
http://src.chromium.org/viewvc/chrome?view=rev&revision=53876
So this change is ready for another round of review. It has not changed at all since being committed.
Contributed by: bmcquade@google.com
BUG=48192
TEST=Added new unit tests, ran net_unittests.
Review URL: http://codereview.chromium.org/3010037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_job.h')
-rw-r--r-- | net/url_request/url_request_job.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 05f55bc..ca69940 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -313,13 +313,23 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>, // an error occurred (or we are waiting for IO to complete). bool ReadRawDataForFilter(int *bytes_read); + // Invokes ReadRawData and records bytes read if the read completes + // synchronously. + bool ReadRawDataHelper(net::IOBuffer* buf, int buf_size, int* bytes_read); + // Called in response to a redirect that was not canceled to follow the // redirect. The current job will be replaced with a new job loading the // given redirect destination. void FollowRedirect(const GURL& location, int http_status_code); - // Updates the profiling info and notifies observers that bytes_read bytes - // have been read. + // Called after every raw read. If |bytes_read| is > 0, this indicates + // a successful read of |bytes_read| unfiltered bytes. If |bytes_read| + // is 0, this indicates that there is no additional data to read. If + // |bytes_read| is < 0, an error occurred and no bytes were read. + void OnRawReadComplete(int bytes_read); + + // Updates the profiling info and notifies observers that an additional + // |bytes_read| unfiltered bytes have been read for this job. void RecordBytesRead(int bytes_read); // Called to query whether there is data available in the filter to be read @@ -350,8 +360,12 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>, // processing the filtered data, we return the data in the caller's buffer. // While the async IO is in progress, we save the user buffer here, and // when the IO completes, we fill this in. - scoped_refptr<net::IOBuffer> read_buffer_; - int read_buffer_len_; + scoped_refptr<net::IOBuffer> filtered_read_buffer_; + int filtered_read_buffer_len_; + + // We keep a pointer to the read buffer while asynchronous reads are + // in progress, so we are able to pass those bytes to job observers. + scoped_refptr<net::IOBuffer> raw_read_buffer_; // Used by HandleResponseIfNecessary to track whether we've sent the // OnResponseStarted callback and potentially redirect callbacks as well. @@ -378,7 +392,7 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>, // as gathered here is post-SSL, and post-cache-fetch, and does not reflect // true packet arrival times in such cases. - // Total number of bytes read from network (or cache) and and typically handed + // Total number of bytes read from network (or cache) and typically handed // to filter to process. Used to histogram compression ratios, and error // recovery scenarios in filters. int64 filter_input_byte_count_; |