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

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

Issue 2189543002: Notify page load metrics when the app enters the background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clankbackgroundcallback
Patch Set: fix histogram description Created 4 years, 5 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: chrome/browser/page_load_metrics/metrics_web_contents_observer.h
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
index 5b072f75d776cf392e66c0bb3bfeded269f4f222..b53fb5771efd11e44b06b1ac1e82862383d620d7 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
@@ -41,6 +41,7 @@ extern const char kAbortChainSizeForwardBack[];
extern const char kAbortChainSizeNewNavigation[];
extern const char kAbortChainSizeNoCommit[];
extern const char kAbortChainSizeSameURL[];
+extern const char kPageLoadCompletedAfterAppBackground[];
} // namespace internal
@@ -143,6 +144,12 @@ class PageLoadTracker {
void OnInputEvent(const blink::WebInputEvent& event);
+ // Flush any buffered metrics, as part of the metrics subsystem persisting
+ // metrics as the application goes into the background. The application may be
+ // killed at any time after this method is invoked without further
+ // notification.
+ void FlushMetricsOnAppEnterBackground();
+
void NotifyClientRedirectTo(const PageLoadTracker& destination);
// Returns true if the timing was successfully updated.
@@ -220,6 +227,10 @@ class PageLoadTracker {
// metrics in DidFinishNavigation.
bool did_stop_tracking_;
+ // Whether the application went into the background when this PageLoadTracker
+ // was active. This is a temporary boolean for UMA tracking.
+ bool app_entered_background_;
+
// The navigation start in TimeTicks, not the wall time reported by Blink.
const base::TimeTicks navigation_start_;
@@ -302,6 +313,12 @@ class MetricsWebContentsObserver
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;
+ // Flush any buffered metrics, as part of the metrics subsystem persisting
+ // metrics as the application goes into the background. The application may be
+ // killed at any time after this method is invoked without further
+ // notification.
+ void FlushMetricsOnAppEnterBackground();
+
// This getter function is required for testing.
const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad();

Powered by Google App Engine
This is Rietveld 408576698