| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 955 |
| 956 void URLRequestJob::MaybeNotifyNetworkBytes() { | 956 void URLRequestJob::MaybeNotifyNetworkBytes() { |
| 957 if (!request_ || !network_delegate_) | 957 if (!request_ || !network_delegate_) |
| 958 return; | 958 return; |
| 959 | 959 |
| 960 // Report any new received bytes. | 960 // Report any new received bytes. |
| 961 int64_t total_received_bytes = GetTotalReceivedBytes(); | 961 int64_t total_received_bytes = GetTotalReceivedBytes(); |
| 962 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); | 962 DCHECK_GE(total_received_bytes, last_notified_total_received_bytes_); |
| 963 if (total_received_bytes > last_notified_total_received_bytes_) { | 963 if (total_received_bytes > last_notified_total_received_bytes_) { |
| 964 network_delegate_->NotifyNetworkBytesReceived( | 964 network_delegate_->NotifyNetworkBytesReceived( |
| 965 *request_, total_received_bytes - last_notified_total_received_bytes_); | 965 request_, total_received_bytes - last_notified_total_received_bytes_); |
| 966 } | 966 } |
| 967 last_notified_total_received_bytes_ = total_received_bytes; | 967 last_notified_total_received_bytes_ = total_received_bytes; |
| 968 | 968 |
| 969 // Report any new sent bytes. | 969 // Report any new sent bytes. |
| 970 int64_t total_sent_bytes = GetTotalSentBytes(); | 970 int64_t total_sent_bytes = GetTotalSentBytes(); |
| 971 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); | 971 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); |
| 972 if (total_sent_bytes > last_notified_total_sent_bytes_) { | 972 if (total_sent_bytes > last_notified_total_sent_bytes_) { |
| 973 network_delegate_->NotifyNetworkBytesSent( | 973 network_delegate_->NotifyNetworkBytesSent( |
| 974 *request_, total_sent_bytes - last_notified_total_sent_bytes_); | 974 request_, total_sent_bytes - last_notified_total_sent_bytes_); |
| 975 } | 975 } |
| 976 last_notified_total_sent_bytes_ = total_sent_bytes; | 976 last_notified_total_sent_bytes_ = total_sent_bytes; |
| 977 } | 977 } |
| 978 | 978 |
| 979 } // namespace net | 979 } // namespace net |
| OLD | NEW |