diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 17:06:03 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 17:06:03 +0000 |
commit | 409dde34a592f3ad63ec4c5e0153ca3bdba370b1 (patch) | |
tree | 4449c1c20255893d5d9b9d434ebcced0c070d2aa /net/url_request | |
parent | 0593587d66686c39c0863c73b8afd7de368392bd (diff) | |
download | chromium_src-409dde34a592f3ad63ec4c5e0153ca3bdba370b1.zip chromium_src-409dde34a592f3ad63ec4c5e0153ca3bdba370b1.tar.gz chromium_src-409dde34a592f3ad63ec4c5e0153ca3bdba370b1.tar.bz2 |
Fix a bug when byte logging is enabled, URLRequestJobs don't log bytes
when there is no filter and reads occur asynchronously, which is almost
always.
BUG=353594
Review URL: https://codereview.chromium.org/203503002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_job.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index c4b34c2..aac992d 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -713,15 +713,6 @@ bool URLRequestJob::ReadRawDataHelper(IOBuffer* buf, int buf_size, bool rv = ReadRawData(buf, buf_size, bytes_read); if (!request_->status().is_io_pending()) { - // If |filter_| is NULL, and logging all bytes is enabled, log the raw - // bytes read. - if (!filter_.get() && request() && request()->net_log().IsLoggingBytes() && - *bytes_read > 0) { - request()->net_log().AddByteTransferEvent( - NetLog::TYPE_URL_REQUEST_JOB_BYTES_READ, - *bytes_read, raw_read_buffer_->data()); - } - // If the read completes synchronously, either success or failure, // invoke the OnRawReadComplete callback so we can account for the // completed read. @@ -738,6 +729,14 @@ void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) { void URLRequestJob::OnRawReadComplete(int bytes_read) { DCHECK(raw_read_buffer_.get()); + // If |filter_| is non-NULL, bytes will be logged after it is applied instead. + if (!filter_.get() && request() && request()->net_log().IsLoggingBytes() && + bytes_read > 0) { + request()->net_log().AddByteTransferEvent( + NetLog::TYPE_URL_REQUEST_JOB_BYTES_READ, + bytes_read, raw_read_buffer_->data()); + } + if (bytes_read > 0) { RecordBytesRead(bytes_read); } |