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

Unified Diff: chrome/browser/metrics/first_web_contents_profiler.h

Issue 1416963002: Abandon startup profiling for first WebContents when it gets hidden or navigated to a different ... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review:rkaplow Created 5 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/metrics/first_web_contents_profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/first_web_contents_profiler.h
diff --git a/chrome/browser/metrics/first_web_contents_profiler.h b/chrome/browser/metrics/first_web_contents_profiler.h
index 23a51a288af72075a16d9e632e7e87c52de062e1..0c024231189deae3f1a36d11761dc614ac10ae6f 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.h
+++ b/chrome/browser/metrics/first_web_contents_profiler.h
@@ -34,24 +34,48 @@ class FirstWebContentsProfiler : public content::WebContentsObserver {
Delegate* delegate);
private:
+ // Reasons for which profiling is deemed complete. Logged in UMA (do not re-
+ // order or re-assign).
+ enum FinishReason {
+ // All metrics were successfully gathered.
+ DONE = 0,
+ // Abandon if blocking UI was shown during startup.
+ ABANDON_BLOCKING_UI = 1,
+ // Abandon if the content is hidden (lowers scheduling priority).
+ ABANDON_CONTENT_HIDDEN = 2,
+ // Abandon if the content is destroyed.
+ ABANDON_CONTENT_DESTROYED = 3,
+ // Abandon if the WebContents navigates away from its initial page.
+ ABANDON_NAVIGATION = 4,
+ ENUM_MAX
+ };
+
FirstWebContentsProfiler(content::WebContents* web_contents,
Delegate* delegate);
// content::WebContentsObserver:
void DidFirstVisuallyNonEmptyPaint() override;
void DocumentOnLoadCompletedInMainFrame() override;
+ void NavigationEntryCommitted(
+ const content::LoadCommittedDetails& load_details) override;
+ void WasHidden() override;
void WebContentsDestroyed() override;
// Whether this instance has finished collecting all of its metrics.
bool IsFinishedCollectingMetrics();
// Informs the delegate that this instance has finished collecting all of its
- // metrics.
- void FinishedCollectingMetrics();
+ // metrics. Logs |finish_reason| to UMA.
+ void FinishedCollectingMetrics(FinishReason finish_reason);
// Initialize histograms for unresponsiveness metrics.
void InitHistograms();
+ // Becomes true on the first invocation of NavigationEntryCommitted() for the
+ // main frame. Any follow-up navigation to a different page will result in
+ // aborting first WebContents profiling.
+ bool initial_entry_committed_;
+
// Whether an attempt was made to collect the "NonEmptyPaint" metric.
bool collected_paint_metric_;
« no previous file with comments | « no previous file | chrome/browser/metrics/first_web_contents_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698