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 a58984656eec1b8effd05e16e67ee570f0d744ab..309817c3441e530fa56a8d1f78b561c7eda358d6 100644 |
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc |
@@ -252,6 +252,22 @@ PageLoadTracker* MetricsWebContentsObserver::GetTrackerOrNullForRequest( |
return nullptr; |
} |
+void MetricsWebContentsObserver::OnRequestStarted( |
+ const content::GlobalRequestID& request_id, |
+ content::ResourceType resource_type, |
+ base::TimeTicks creation_time) { |
+ // Note for the main HTML page, the tracker may not exist yet, so |
Bryan McQuade
2017/04/24 13:56:55
interesting - the fact that the tracker doesn't ex
Pete Williamson
2017/04/24 19:53:14
Done.
|
+ // OnStartedResource will not be called for the main page. While the main |
+ // page is not being tracked today, if we do decide to track it, we will need |
+ // to first make sure that GlobalRequestID is set in an earlier callback. |
+ PageLoadTracker* tracker = |
+ GetTrackerOrNullForRequest(request_id, resource_type, creation_time); |
+ if (tracker) { |
+ ExtraRequestStartInfo extra_request_start_info(resource_type); |
+ tracker->OnStartedResource(extra_request_start_info); |
+ } |
+} |
+ |
void MetricsWebContentsObserver::OnRequestComplete( |
const content::GlobalRequestID& request_id, |
content::ResourceType resource_type, |
@@ -263,10 +279,10 @@ void MetricsWebContentsObserver::OnRequestComplete( |
PageLoadTracker* tracker = |
GetTrackerOrNullForRequest(request_id, resource_type, creation_time); |
if (tracker) { |
- ExtraRequestInfo extra_request_info( |
+ ExtraRequestCompleteInfo extra_request_complete_info( |
was_cached, raw_body_bytes, used_data_reduction_proxy, |
- was_cached ? 0 : original_content_length); |
- tracker->OnLoadedResource(extra_request_info); |
+ was_cached ? 0 : original_content_length, resource_type); |
+ tracker->OnLoadedResource(extra_request_complete_info); |
} |
} |