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

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

Issue 2139143002: Standardize which page loads are tracked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests 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: 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 0d017295d4dcecbcef1e061f5f0ab2b7541535bb..474a4530895f9c39ee22ec7ed8f1fa793f3593d5 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h
@@ -145,8 +145,10 @@ class PageLoadTracker {
bool UpdateTiming(const PageLoadTiming& timing,
const PageLoadMetadata& metadata);
- void set_renderer_tracked(bool renderer_tracked);
- bool renderer_tracked() const { return renderer_tracked_; }
+ // Signals that we should stop tracking metrics for the associated page load.
+ // We may stop tracking a page load if it doesn't meet the criteria for
+ // tracking metrics in DidFinishNavigation.
+ void StopTracking();
int aborted_chain_size() const { return aborted_chain_size_; }
int aborted_chain_size_same_url() const {
@@ -209,8 +211,10 @@ class PageLoadTracker {
// committed load.
void LogAbortChainHistograms(content::NavigationHandle* final_navigation);
- // Whether the renderer should be sending timing IPCs to this page load.
- bool renderer_tracked_;
+ // Whether we stopped tracking this navigation after it was initiated. We may
+ // stop tracking a navigation if it doesn't meet the criteria for tracking
+ // metrics in DidFinishNavigation.
+ bool did_stop_tracking_;
// The navigation start in TimeTicks, not the wall time reported by Blink.
const base::TimeTicks navigation_start_;
@@ -298,6 +302,14 @@ class MetricsWebContentsObserver
private:
friend class content::WebContentsUserData<MetricsWebContentsObserver>;
+ void HandleFailedNavigationForTrackedLoad(
+ content::NavigationHandle* navigation_handle,
+ std::unique_ptr<PageLoadTracker> tracker);
+
+ void HandleCommittedNavigationForTrackedLoad(
+ content::NavigationHandle* navigation_handle,
+ std::unique_ptr<PageLoadTracker> tracker);
+
// Notify all loads, provisional and committed, that we performed an action
// that might abort them.
void NotifyAbortAllLoads(UserAbortType abort_type);
@@ -320,6 +332,9 @@ class MetricsWebContentsObserver
const PageLoadTiming& timing,
const PageLoadMetadata& metadata);
+ bool ShouldTrackNavigation(
+ content::NavigationHandle* navigation_handle) const;
+
// True if the web contents is currently in the foreground.
bool in_foreground_;

Powered by Google App Engine
This is Rietveld 408576698