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/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 | 812 |
813 void URLRequestJob::RecordBytesRead(int bytes_read) { | 813 void URLRequestJob::RecordBytesRead(int bytes_read) { |
814 DCHECK_GT(bytes_read, 0); | 814 DCHECK_GT(bytes_read, 0); |
815 prefilter_bytes_read_ += bytes_read; | 815 prefilter_bytes_read_ += bytes_read; |
816 | 816 |
817 // Notify NetworkQualityEstimator. | 817 // Notify NetworkQualityEstimator. |
818 // TODO(tbansal): Move this to url_request_http_job.cc. This may catch | 818 // TODO(tbansal): Move this to url_request_http_job.cc. This may catch |
819 // Service Worker jobs twice. | 819 // Service Worker jobs twice. |
820 if (request_ && request_->context()->network_quality_estimator()) { | 820 if (request_ && request_->context()->network_quality_estimator()) { |
821 request_->context()->network_quality_estimator()->NotifyDataReceived( | 821 request_->context()->network_quality_estimator()->NotifyDataReceived( |
822 *request_, prefilter_bytes_read_); | 822 *request_, prefilter_bytes_read_, bytes_read); |
823 } | 823 } |
824 | 824 |
825 if (!filter_.get()) | 825 if (!filter_.get()) |
826 postfilter_bytes_read_ += bytes_read; | 826 postfilter_bytes_read_ += bytes_read; |
827 DVLOG(2) << __FUNCTION__ << "() " | 827 DVLOG(2) << __FUNCTION__ << "() " |
828 << "\"" << (request_ ? request_->url().spec() : "???") << "\"" | 828 << "\"" << (request_ ? request_->url().spec() : "???") << "\"" |
829 << " pre bytes read = " << bytes_read | 829 << " pre bytes read = " << bytes_read |
830 << " pre total = " << prefilter_bytes_read_ | 830 << " pre total = " << prefilter_bytes_read_ |
831 << " post total = " << postfilter_bytes_read_; | 831 << " post total = " << postfilter_bytes_read_; |
832 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. | 832 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). | 879 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). |
880 redirect_info.new_referrer = | 880 redirect_info.new_referrer = |
881 ComputeReferrerForRedirect(request_->referrer_policy(), | 881 ComputeReferrerForRedirect(request_->referrer_policy(), |
882 request_->referrer(), | 882 request_->referrer(), |
883 redirect_info.new_url).spec(); | 883 redirect_info.new_url).spec(); |
884 | 884 |
885 return redirect_info; | 885 return redirect_info; |
886 } | 886 } |
887 | 887 |
888 } // namespace net | 888 } // namespace net |
OLD | NEW |