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

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

Issue 1357403003: Separate page load metrics for backgrounded pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Used DidFinishLoad instead of DidStopLoading 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.h
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.h b/components/page_load_metrics/browser/metrics_web_contents_observer.h
index f0da8e05a4fd3c219d78fc0ddcc67dfd38e80640..a6fd674f588866b9606f9ce6aae2f1b30b7ee23c 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h
@@ -37,6 +37,18 @@ class MetricsWebContentsObserver
void DidCommitNavigation(
content::NavigationHandle* navigation_handle) override;
void RenderProcessGone(base::TerminationStatus status) override;
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void DidFinishLoad(content::RenderFrameHost* render_frame_host,
+ const GURL& validated_url) override;
+ void DidFailLoad(content::RenderFrameHost* render_frame_host,
+ const GURL& validated_url,
+ int error_code,
+ const base::string16& error_description,
+ bool was_ignored_by_handler) override;
+
+ void WasShown() override;
+ void WasHidden() override;
private:
explicit MetricsWebContentsObserver(content::WebContents* web_contents);
@@ -52,6 +64,18 @@ class MetricsWebContentsObserver
// commits we will initialize this as empty.
scoped_ptr<PageLoadTiming> current_timing_;
+ // True if the web contents stayed in the foreground for the entire page load.
+ // We record separate metrics for any web contents that have been
+ // backgrounded, because metrics like layout/paint are delayed artificially
+ // when they occur in the bacground.
+ bool current_navigation_stayed_in_foreground_;
+
+ // True if the previous navigation stayed in the foreground.
+ bool previous_navigation_stayed_in_foreground_;
+
+ // True if the web contents is currently in the foreground.
+ bool in_foreground_;
+
DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver);
};

Powered by Google App Engine
This is Rietveld 408576698