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.h" | 5 #include "net/url_request/url_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 delegate_->OnReadCompleted(this, bytes_read); | 1027 delegate_->OnReadCompleted(this, bytes_read); |
1028 | 1028 |
1029 // Nothing below this line as OnReadCompleted may delete |this|. | 1029 // Nothing below this line as OnReadCompleted may delete |this|. |
1030 } | 1030 } |
1031 | 1031 |
1032 void URLRequest::OnHeadersComplete() { | 1032 void URLRequest::OnHeadersComplete() { |
1033 // Cache load timing information now, as information will be lost once the | 1033 // Cache load timing information now, as information will be lost once the |
1034 // socket is closed and the ClientSocketHandle is Reset, which will happen | 1034 // socket is closed and the ClientSocketHandle is Reset, which will happen |
1035 // once the body is complete. The start times should already be populated. | 1035 // once the body is complete. The start times should already be populated. |
1036 if (job_) { | 1036 if (job_) { |
1037 // Keep a copy of the two times the URLRequest sets. | |
1038 base::TimeTicks request_start = load_timing_info_.request_start; | |
1039 base::Time request_start_time = load_timing_info_.request_start_time; | |
mmenke
2013/05/10 18:32:26
I'm not a big fan of this, but other solutions see
| |
1040 | |
1041 // Clear load times. Shouldn't be neded, but gives the GetLoadTimingInfo a | |
1042 // consistent place to start from. | |
1043 load_timing_info_ = LoadTimingInfo(); | |
1037 job_->GetLoadTimingInfo(&load_timing_info_); | 1044 job_->GetLoadTimingInfo(&load_timing_info_); |
1045 | |
1046 load_timing_info_.request_start = request_start; | |
1047 load_timing_info_.request_start_time = request_start_time; | |
1048 | |
1038 ConvertRealLoadTimesToBlockingTimes(&load_timing_info_); | 1049 ConvertRealLoadTimesToBlockingTimes(&load_timing_info_); |
1039 } | 1050 } |
1040 } | 1051 } |
1041 | 1052 |
1042 void URLRequest::NotifyRequestCompleted() { | 1053 void URLRequest::NotifyRequestCompleted() { |
1043 // TODO(battre): Get rid of this check, according to willchan it should | 1054 // TODO(battre): Get rid of this check, according to willchan it should |
1044 // not be needed. | 1055 // not be needed. |
1045 if (has_notified_completion_) | 1056 if (has_notified_completion_) |
1046 return; | 1057 return; |
1047 | 1058 |
(...skipping 27 matching lines...) Expand all Loading... | |
1075 new base::debug::StackTrace(NULL, 0); | 1086 new base::debug::StackTrace(NULL, 0); |
1076 *stack_trace_copy = stack_trace; | 1087 *stack_trace_copy = stack_trace; |
1077 stack_trace_.reset(stack_trace_copy); | 1088 stack_trace_.reset(stack_trace_copy); |
1078 } | 1089 } |
1079 | 1090 |
1080 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1091 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1081 return stack_trace_.get(); | 1092 return stack_trace_.get(); |
1082 } | 1093 } |
1083 | 1094 |
1084 } // namespace net | 1095 } // namespace net |
OLD | NEW |