OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/load_timing_observer.h" | 5 #include "chrome/browser/net/load_timing_observer.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "chrome/browser/net/chrome_net_log.h" | 8 #include "chrome/browser/net/chrome_net_log.h" |
9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
10 #include "content/common/resource_response.h" | 10 #include "content/common/resource_response.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Prevents us from passively growing the memory unbounded in case | 143 // Prevents us from passively growing the memory unbounded in case |
144 // something went wrong. Should not happen. | 144 // something went wrong. Should not happen. |
145 if (url_request_to_record_.size() > kMaxNumEntries) { | 145 if (url_request_to_record_.size() > kMaxNumEntries) { |
146 LOG(WARNING) << "The load timing observer url request count has grown " | 146 LOG(WARNING) << "The load timing observer url request count has grown " |
147 "larger than expected, resetting"; | 147 "larger than expected, resetting"; |
148 url_request_to_record_.clear(); | 148 url_request_to_record_.clear(); |
149 } | 149 } |
150 | 150 |
151 URLRequestRecord& record = url_request_to_record_[source.id]; | 151 URLRequestRecord& record = url_request_to_record_[source.id]; |
152 record.base_ticks = time; | 152 record.base_ticks = time; |
| 153 record.timing.base_ticks = time.ToInternalValue(); |
153 record.timing.base_time = TimeTicksToTime(time); | 154 record.timing.base_time = TimeTicksToTime(time); |
154 } | 155 } |
155 return; | 156 return; |
156 } else if (type == net::NetLog::TYPE_REQUEST_ALIVE) { | 157 } else if (type == net::NetLog::TYPE_REQUEST_ALIVE) { |
157 // Cleanup records based on the TYPE_REQUEST_ALIVE entry. | 158 // Cleanup records based on the TYPE_REQUEST_ALIVE entry. |
158 if (is_end) | 159 if (is_end) |
159 url_request_to_record_.erase(source.id); | 160 url_request_to_record_.erase(source.id); |
160 return; | 161 return; |
161 } | 162 } |
162 | 163 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 break; | 200 break; |
200 } | 201 } |
201 case net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST: | 202 case net::NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST: |
202 if (is_begin) | 203 if (is_begin) |
203 timing.send_start = TimeTicksToOffset(time, record); | 204 timing.send_start = TimeTicksToOffset(time, record); |
204 else if (is_end) | 205 else if (is_end) |
205 timing.send_end = TimeTicksToOffset(time, record); | 206 timing.send_end = TimeTicksToOffset(time, record); |
206 break; | 207 break; |
207 case net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS: | 208 case net::NetLog::TYPE_HTTP_TRANSACTION_READ_HEADERS: |
208 if (is_begin) | 209 if (is_begin) |
209 timing.receive_headers_start = TimeTicksToOffset(time, record); | 210 timing.receive_headers_start = TimeTicksToOffset(time, record); |
210 else if (is_end) | 211 else if (is_end) |
211 timing.receive_headers_end = TimeTicksToOffset(time, record); | 212 timing.receive_headers_end = TimeTicksToOffset(time, record); |
212 break; | 213 break; |
213 default: | 214 default: |
214 break; | 215 break; |
215 } | 216 } |
216 } | 217 } |
217 | 218 |
218 void LoadTimingObserver::OnAddHTTPStreamJobEntry( | 219 void LoadTimingObserver::OnAddHTTPStreamJobEntry( |
219 net::NetLog::EventType type, | 220 net::NetLog::EventType type, |
220 const base::TimeTicks& time, | 221 const base::TimeTicks& time, |
221 const net::NetLog::Source& source, | 222 const net::NetLog::Source& source, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (it == socket_to_record_.end()) | 366 if (it == socket_to_record_.end()) |
366 return; | 367 return; |
367 | 368 |
368 if (type == net::NetLog::TYPE_SSL_CONNECT) { | 369 if (type == net::NetLog::TYPE_SSL_CONNECT) { |
369 if (is_begin) | 370 if (is_begin) |
370 it->second.ssl_start = time; | 371 it->second.ssl_start = time; |
371 else if (is_end) | 372 else if (is_end) |
372 it->second.ssl_end = time; | 373 it->second.ssl_end = time; |
373 } | 374 } |
374 } | 375 } |
OLD | NEW |