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

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

Issue 2651823002: Add .SingleTab and .MultiTabs suffix to Startup.FirstWebContents.MainNavigationStart histogram. (Closed)
Patch Set: rebase on r448292 Created 3 years, 10 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/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 9340a051090620dc121450f21db6c0714d697ccd..ad9c15e6d8f4fcd3bf16c93d929cbfe1f10bcd65 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.h
+++ b/chrome/browser/metrics/first_web_contents_profiler.h
@@ -5,78 +5,11 @@
#ifndef CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
#define CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_
-#include <memory>
+namespace metrics {
-#include "base/macros.h"
-#include "content/public/browser/web_contents_observer.h"
+// Measures startup performance of the first active web contents.
+void BeginFirstWebContentsProfiling();
-namespace content {
-class WebContents;
-} // namespace content
-
-// Measures start up performance of the first active web contents.
-// This class is declared on all platforms, but only defined on non-Android
-// platforms. Android code should not call any non-trivial methods on this
-// class.
-class FirstWebContentsProfiler : public content::WebContentsObserver {
- public:
- // Creates a profiler for the active web contents. If there are multiple
- // browsers, the first one is chosen. The resulting FirstWebContentsProfiler
- // owns itself.
- static void Start();
-
- 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_NEW_NAVIGATION = 4,
- // Abandon if the WebContents fails to load (e.g. network error, etc.).
- ABANDON_NAVIGATION_ERROR = 5,
- ENUM_MAX
- };
- explicit FirstWebContentsProfiler(content::WebContents* web_contents);
- ~FirstWebContentsProfiler() override = default;
-
- // content::WebContentsObserver:
- void DidFirstVisuallyNonEmptyPaint() override;
- void DocumentOnLoadCompletedInMainFrame() override;
- void DidStartNavigation(
- content::NavigationHandle* navigation_handle) override;
- void DidFinishNavigation(
- content::NavigationHandle* navigation_handle) override;
- void WasHidden() override;
- void WebContentsDestroyed() override;
-
- // Whether this instance has finished collecting first-paint and main-frame-
- // load metrics (navigation metrics are recorded on a best effort but don't
- // prevent the FirstWebContentsProfiler from calling it).
- bool IsFinishedCollectingMetrics();
-
- // Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler.
- void FinishedCollectingMetrics(FinishReason finish_reason);
-
- // Whether an attempt was made to collect the "NonEmptyPaint" metric.
- bool collected_paint_metric_;
-
- // Whether an attempt was made to collect the "MainFrameLoad" metric.
- bool collected_load_metric_;
-
- // Whether an attempt was made to collect the "MainNavigationStart" metric.
- bool collected_main_navigation_start_metric_;
-
- // Whether an attempt was made to collect the "MainNavigationFinished" metric.
- bool collected_main_navigation_finished_metric_;
-
- DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler);
-};
+} // namespace metrics
#endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_H_

Powered by Google App Engine
This is Rietveld 408576698