| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_job.h" | 5 #include "net/url_request/url_request_job.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 void URLRequestJob::NotifyStartError(const URLRequestStatus &status) { | 551 void URLRequestJob::NotifyStartError(const URLRequestStatus &status) { |
| 552 DCHECK(!has_handled_response_); | 552 DCHECK(!has_handled_response_); |
| 553 DCHECK(request_->status().is_io_pending()); | 553 DCHECK(request_->status().is_io_pending()); |
| 554 | 554 |
| 555 has_handled_response_ = true; | 555 has_handled_response_ = true; |
| 556 // There may be relevant information in the response info even in the | 556 // There may be relevant information in the response info even in the |
| 557 // error case. | 557 // error case. |
| 558 GetResponseInfo(&request_->response_info_); | 558 GetResponseInfo(&request_->response_info_); |
| 559 | 559 |
| 560 MaybeNotifyNetworkBytes(); |
| 561 |
| 560 request_->NotifyResponseStarted(status); | 562 request_->NotifyResponseStarted(status); |
| 561 // |this| may have been deleted here. | 563 // |this| may have been deleted here. |
| 562 } | 564 } |
| 563 | 565 |
| 564 void URLRequestJob::NotifyDone(const URLRequestStatus &status) { | 566 void URLRequestJob::NotifyDone(const URLRequestStatus &status) { |
| 565 DCHECK(!done_) << "Job sending done notification twice"; | 567 DCHECK(!done_) << "Job sending done notification twice"; |
| 566 if (done_) | 568 if (done_) |
| 567 return; | 569 return; |
| 568 done_ = true; | 570 done_ = true; |
| 569 | 571 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 int64_t total_sent_bytes = GetTotalSentBytes(); | 841 int64_t total_sent_bytes = GetTotalSentBytes(); |
| 840 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); | 842 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); |
| 841 if (total_sent_bytes > last_notified_total_sent_bytes_) { | 843 if (total_sent_bytes > last_notified_total_sent_bytes_) { |
| 842 network_delegate_->NotifyNetworkBytesSent( | 844 network_delegate_->NotifyNetworkBytesSent( |
| 843 request_, total_sent_bytes - last_notified_total_sent_bytes_); | 845 request_, total_sent_bytes - last_notified_total_sent_bytes_); |
| 844 } | 846 } |
| 845 last_notified_total_sent_bytes_ = total_sent_bytes; | 847 last_notified_total_sent_bytes_ = total_sent_bytes; |
| 846 } | 848 } |
| 847 | 849 |
| 848 } // namespace net | 850 } // namespace net |
| OLD | NEW |