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

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

Issue 1377223002: Add page load abort metrics to PageLoadMetrics system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plm_backgrounded_master
Patch Set: Add unit tests Created 5 years, 3 months 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: components/page_load_metrics/browser/metrics_web_contents_observer.cc
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index fdde938812b67c813317dfc9afa98533d253dd93..5708fdd0f7c278fed4b913004bb91a10d861d41e 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -60,11 +60,18 @@ base::Time WallTimeFromTimeTicks(base::TimeTicks time) {
base::TimeDelta::FromMinutes(10), 100)
PageLoadTracker::PageLoadTracker(bool in_foreground)
- : has_commit_(false), started_in_foreground_(in_foreground) {}
+ : has_commit_(false), started_in_foreground_(in_foreground) {
+ RecordEvent(STARTED_PROVISIONAL_LOAD);
+}
PageLoadTracker::~PageLoadTracker() {
- if (has_commit_)
+ if (has_commit_) {
RecordTimingHistograms();
+ if (timing_.first_layout.is_zero())
+ RecordEvent(ABORTED_LOAD_BEFORE_FIRST_LAYOUT);
+ else
+ RecordEvent(SUCCESSFUL_FIRST_LAYOUT);
+ }
}
void PageLoadTracker::WebContentsHidden() {
@@ -135,6 +142,10 @@ void PageLoadTracker::RecordTimingHistograms() {
}
}
+void PageLoadTracker::RecordEvent(PageLoadEvent event) {
+ UMA_HISTOGRAM_ENUMERATION("PageLoad.EventCounts", event, EVENT_COUNT);
Bryan McQuade 2015/10/01 14:57:38 is EVENT_COUNT supposed to be the value of the las
Charlie Harrison 2015/10/01 15:26:20 The comments on LOCAL_HISTOGRAM_ENUMERATION clarif
+}
+
MetricsWebContentsObserver::MetricsWebContentsObserver(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents), in_foreground_(false) {}
@@ -175,12 +186,14 @@ void MetricsWebContentsObserver::DidFinishNavigation(
provisional_loads_.take_and_erase(navigation_handle));
DCHECK(finished_nav);
- // TODO(csharrison) handle the two error cases:
- // 1. Error pages that replace the previous page.
- // 2. Error pages that leave the user on the previous page.
- // For now these cases will be ignored.
- if (!navigation_handle->HasCommitted())
+ // Handle a pre-commit error here. Navigations that result in an error page
+ // will be ignored.
+ // TODO(csharrison) filter out error codes that shouldn't result in us logging
+ // an aborted provisional load.
+ if (!navigation_handle->HasCommitted()) {
+ finished_nav->RecordEvent(ABORTED_PROVISIONAL_LOAD);
Bryan McQuade 2015/10/01 14:57:38 could we call this PROVISIONAL_LOAD_FAILED, which
return;
+ }
// Don't treat a same-page nav as a new page load.
if (navigation_handle->IsSamePage())

Powered by Google App Engine
This is Rietveld 408576698