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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 DCHECK(!request_->status().is_io_pending()); | 827 DCHECK(!request_->status().is_io_pending()); |
828 DCHECK(raw_read_buffer_.get() == NULL); | 828 DCHECK(raw_read_buffer_.get() == NULL); |
829 | 829 |
830 // Keep a pointer to the read buffer, so we have access to it in the | 830 // Keep a pointer to the read buffer, so we have access to it in the |
831 // OnRawReadComplete() callback in the event that the read completes | 831 // OnRawReadComplete() callback in the event that the read completes |
832 // asynchronously. | 832 // asynchronously. |
833 raw_read_buffer_ = buf; | 833 raw_read_buffer_ = buf; |
834 bool rv = ReadRawData(buf, buf_size, bytes_read); | 834 bool rv = ReadRawData(buf, buf_size, bytes_read); |
835 | 835 |
836 if (!request_->status().is_io_pending()) { | 836 if (!request_->status().is_io_pending()) { |
| 837 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
| 838 tracked_objects::ScopedTracker tracking_profile1( |
| 839 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 840 "423948 URLRequestJob::ReadRawDataHelper1")); |
| 841 |
837 // If the read completes synchronously, either success or failure, | 842 // If the read completes synchronously, either success or failure, |
838 // invoke the OnRawReadComplete callback so we can account for the | 843 // invoke the OnRawReadComplete callback so we can account for the |
839 // completed read. | 844 // completed read. |
840 OnRawReadComplete(*bytes_read); | 845 OnRawReadComplete(*bytes_read); |
841 } | 846 } |
842 return rv; | 847 return rv; |
843 } | 848 } |
844 | 849 |
845 void URLRequestJob::FollowRedirect(const RedirectInfo& redirect_info) { | 850 void URLRequestJob::FollowRedirect(const RedirectInfo& redirect_info) { |
846 int rv = request_->Redirect(redirect_info); | 851 int rv = request_->Redirect(redirect_info); |
(...skipping 21 matching lines...) Expand all Loading... |
868 filter_input_byte_count_ += bytes_read; | 873 filter_input_byte_count_ += bytes_read; |
869 prefilter_bytes_read_ += bytes_read; | 874 prefilter_bytes_read_ += bytes_read; |
870 if (!filter_.get()) | 875 if (!filter_.get()) |
871 postfilter_bytes_read_ += bytes_read; | 876 postfilter_bytes_read_ += bytes_read; |
872 DVLOG(2) << __FUNCTION__ << "() " | 877 DVLOG(2) << __FUNCTION__ << "() " |
873 << "\"" << (request_ ? request_->url().spec() : "???") << "\"" | 878 << "\"" << (request_ ? request_->url().spec() : "???") << "\"" |
874 << " pre bytes read = " << bytes_read | 879 << " pre bytes read = " << bytes_read |
875 << " pre total = " << prefilter_bytes_read_ | 880 << " pre total = " << prefilter_bytes_read_ |
876 << " post total = " << postfilter_bytes_read_; | 881 << " post total = " << postfilter_bytes_read_; |
877 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. | 882 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. |
878 if (network_delegate_) | 883 if (network_delegate_) { |
| 884 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
| 885 tracked_objects::ScopedTracker tracking_profile( |
| 886 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 887 "423948 URLRequestJob::RecordBytesRead NotifyRawBytesRead")); |
| 888 |
879 network_delegate_->NotifyRawBytesRead(*request_, bytes_read); | 889 network_delegate_->NotifyRawBytesRead(*request_, bytes_read); |
| 890 } |
880 } | 891 } |
881 | 892 |
882 bool URLRequestJob::FilterHasData() { | 893 bool URLRequestJob::FilterHasData() { |
883 return filter_.get() && filter_->stream_data_len(); | 894 return filter_.get() && filter_->stream_data_len(); |
884 } | 895 } |
885 | 896 |
886 void URLRequestJob::UpdatePacketReadTimes() { | 897 void URLRequestJob::UpdatePacketReadTimes() { |
887 } | 898 } |
888 | 899 |
889 RedirectInfo URLRequestJob::ComputeRedirectInfo(const GURL& location, | 900 RedirectInfo URLRequestJob::ComputeRedirectInfo(const GURL& location, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). | 935 // Alter the referrer if redirecting cross-origin (especially HTTP->HTTPS). |
925 redirect_info.new_referrer = | 936 redirect_info.new_referrer = |
926 ComputeReferrerForRedirect(request_->referrer_policy(), | 937 ComputeReferrerForRedirect(request_->referrer_policy(), |
927 request_->referrer(), | 938 request_->referrer(), |
928 redirect_info.new_url).spec(); | 939 redirect_info.new_url).spec(); |
929 | 940 |
930 return redirect_info; | 941 return redirect_info; |
931 } | 942 } |
932 | 943 |
933 } // namespace net | 944 } // namespace net |
OLD | NEW |