Chromium Code Reviews| Index: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
| diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
| index 571ef104db8367353264a36aaef54403df502d26..0610fbe594f3e5bc23f255a55a2d4d26b6b2cc04 100644 |
| --- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
| +++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
| @@ -178,17 +178,16 @@ void MetricsWebContentsObserver::WillStartNavigationRequest( |
| void MetricsWebContentsObserver::OnRequestComplete( |
| content::ResourceType resource_type, |
| bool was_cached, |
| - int net_error) { |
| - // For simplicity, only count subresources. Navigations are hard to attribute |
| - // here because we won't have a committed load by the time data streams in |
| - // from the IO thread. |
| - if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && |
| - net_error != net::OK) { |
| + int64_t raw_body_bytes, |
| + base::TimeTicks creation_time) { |
| + // If the navigation hasn't committed yet then we'll miss the resource (this |
|
Bryan McQuade
2016/12/16 14:28:45
let's maybe add a comment here noting some of the
jkarlin
2016/12/19 19:26:01
Done.
|
| + // happens on the new tab page). Also, if the resource request was started |
| + // before this navigation then it should be ignored. |
| + if (!committed_load_ || creation_time < committed_load_->navigation_start()) { |
| return; |
| } |
| - if (!committed_load_) |
| - return; |
| - committed_load_->OnLoadedSubresource(was_cached); |
| + |
| + committed_load_->OnLoadedResource(was_cached, raw_body_bytes); |
| } |
| const PageLoadExtraInfo |