| 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 "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/public/common/resource_response.h" | 9 #include "content/public/common/resource_response.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ChromeNetLog* chrome_net_log = static_cast<ChromeNetLog*>( | 108 ChromeNetLog* chrome_net_log = static_cast<ChromeNetLog*>( |
| 109 request->net_log().net_log()); | 109 request->net_log().net_log()); |
| 110 if (chrome_net_log == NULL) | 110 if (chrome_net_log == NULL) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 uint32 source_id = request->net_log().source().id; | 113 uint32 source_id = request->net_log().source().id; |
| 114 LoadTimingObserver* observer = chrome_net_log->load_timing_observer(); | 114 LoadTimingObserver* observer = chrome_net_log->load_timing_observer(); |
| 115 LoadTimingObserver::URLRequestRecord* record = | 115 LoadTimingObserver::URLRequestRecord* record = |
| 116 observer->GetURLRequestRecord(source_id); | 116 observer->GetURLRequestRecord(source_id); |
| 117 if (record) { | 117 if (record) { |
| 118 response->connection_id = record->socket_log_id; | 118 response->head.connection_id = record->socket_log_id; |
| 119 response->connection_reused = record->socket_reused; | 119 response->head.connection_reused = record->socket_reused; |
| 120 response->load_timing = record->timing; | 120 response->head.load_timing = record->timing; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 void LoadTimingObserver::OnAddURLRequestEntry(const net::NetLog::Entry& entry) { | 124 void LoadTimingObserver::OnAddURLRequestEntry(const net::NetLog::Entry& entry) { |
| 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 126 | 126 |
| 127 bool is_begin = entry.phase() == net::NetLog::PHASE_BEGIN; | 127 bool is_begin = entry.phase() == net::NetLog::PHASE_BEGIN; |
| 128 bool is_end = entry.phase() == net::NetLog::PHASE_END; | 128 bool is_end = entry.phase() == net::NetLog::PHASE_END; |
| 129 | 129 |
| 130 if (entry.type() == net::NetLog::TYPE_URL_REQUEST_START_JOB) { | 130 if (entry.type() == net::NetLog::TYPE_URL_REQUEST_START_JOB) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 if (is_begin) | 386 if (is_begin) |
| 387 it->second.ssl_start = GetCurrentTime(); | 387 it->second.ssl_start = GetCurrentTime(); |
| 388 else if (is_end) | 388 else if (is_end) |
| 389 it->second.ssl_end = GetCurrentTime(); | 389 it->second.ssl_end = GetCurrentTime(); |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 | 392 |
| 393 base::TimeTicks LoadTimingObserver::GetCurrentTime() const { | 393 base::TimeTicks LoadTimingObserver::GetCurrentTime() const { |
| 394 return base::TimeTicks::Now(); | 394 return base::TimeTicks::Now(); |
| 395 } | 395 } |
| OLD | NEW |