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

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: rename method 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 16dece9bdfbadf3896b21917afe88a134fd20417..f1e5db3ee1d7ae6b0abe01af410b865e9b30ef07 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.h
@@ -139,6 +139,8 @@ class PageLoadTracker {
void OnInputEvent(const blink::WebInputEvent& event);
+ void FlushMetricsOnAppEnterBackground();
+
void NotifyClientRedirectTo(const PageLoadTracker& destination);
// Returns true if the timing was successfully updated.
@@ -216,6 +218,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_;
@@ -281,6 +287,12 @@ class MetricsWebContentsObserver
std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface);
~MetricsWebContentsObserver() override;
+ // Returns all currently active MetricsWebContentsObservers. Callers should
+ // not hold on to the returned observers beyond the scope of the current
+ // function, as the MetricsWebContentsObservers may be destroyed as their
+ // associated WebContents are destroyed.
+ static std::vector<MetricsWebContentsObserver*> GetAllObservers();
+
// content::WebContentsObserver implementation:
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
@@ -298,6 +310,8 @@ class MetricsWebContentsObserver
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;
+ void FlushMetricsOnAppEnterBackground();
Charlie Harrison 2016/07/28 14:45:28 Do we need to include "flush metrics" in the name?
Bryan McQuade 2016/07/28 16:26:11 Yeah - I debated this. Technically, this method is
Charlie Harrison 2016/07/28 16:38:04 SGTM.
+
// This getter function is required for testing.
const PageLoadExtraInfo GetPageLoadExtraInfoForCommittedLoad();

Powered by Google App Engine
This is Rietveld 408576698