Chromium Code Reviews| Index: net/url_request/url_request_job.cc |
| diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc |
| index 07ea63f2c517eff3b29a1470f27d965554804f29..4e1a1db437c057107a0bf3b24d4b1d86cdd6572a 100644 |
| --- a/net/url_request/url_request_job.cc |
| +++ b/net/url_request/url_request_job.cc |
| @@ -557,6 +557,8 @@ void URLRequestJob::NotifyStartError(const URLRequestStatus &status) { |
| // error case. |
| GetResponseInfo(&request_->response_info_); |
| + MaybeNotifyNetworkBytes(); |
| + |
| request_->NotifyResponseStarted(status); |
| // |this| may have been deleted here. |
| } |
| @@ -585,8 +587,6 @@ void URLRequestJob::NotifyDone(const URLRequestStatus &status) { |
| request_->set_status(status); |
| } |
| - MaybeNotifyNetworkBytes(); |
| - |
| // Complete this notification later. This prevents us from re-entering the |
| // delegate if we're done because of a synchronous call. |
| base::ThreadTaskRunnerHandle::Get()->PostTask( |
| @@ -666,6 +666,8 @@ void URLRequestJob::SourceStreamReadComplete(bool synchronous, int result) { |
| } |
| pending_read_buffer_ = nullptr; |
| + MaybeNotifyNetworkBytes(); |
|
mmenke
2016/11/03 19:07:01
Not needed, we already call this in ReadRawDataCom
Not at Google. Contact bengr
2016/11/04 00:08:12
Done.
|
| + |
| if (result < 0) { |
| NotifyDone(URLRequestStatus::FromError(result)); |
| return; |
| @@ -709,6 +711,8 @@ int URLRequestJob::ReadRawDataHelper(IOBuffer* buf, |
| } |
| void URLRequestJob::FollowRedirect(const RedirectInfo& redirect_info) { |
| + MaybeNotifyNetworkBytes(); |
|
mmenke
2016/11/03 19:07:01
This is a weird place to call this - presumably we
Not at Google. Contact bengr
2016/11/04 00:08:12
Done.
|
| + |
| int rv = request_->Redirect(redirect_info); |
| if (rv != OK) |
| NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| @@ -823,6 +827,8 @@ RedirectInfo URLRequestJob::ComputeRedirectInfo(const GURL& location, |
| } |
| void URLRequestJob::MaybeNotifyNetworkBytes() { |
| + DCHECK(request_->is_pending()); |
| + |
| if (!network_delegate_) |
| return; |