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