Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2377)

Unified Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc

Issue 2560043004: [PageLoadMetrics] Record bytes usage per page (Closed)
Patch Set: Include main frame resource Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698