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

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

Issue 2773973002: Add Startup.BrowserView.FirstPaint / .CompositingEnded histograms. (Closed)
Patch Set: Don't wait for histograms that are not reported during browser_tests. Created 3 years, 8 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 | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/browser_window_histogram_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/browser_window_histogram_helper.h
diff --git a/chrome/browser/metrics/browser_window_histogram_helper.h b/chrome/browser/metrics/browser_window_histogram_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..ab305264a0edc794835c8c3daa87f5e7ac4a1f1b
--- /dev/null
+++ b/chrome/browser/metrics/browser_window_histogram_helper.h
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_METRICS_BROWSER_WINDOW_HISTOGRAM_HELPER_H_
+#define CHROME_BROWSER_METRICS_BROWSER_WINDOW_HISTOGRAM_HELPER_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/scoped_observer.h"
+#include "base/time/time.h"
+#include "ui/compositor/compositor_observer.h"
+
+// Class that encapsulates logic of recording
+// Startup.BrowserWindow.FirstPaint* histograms.
+//
+// There's a dependency on ui/compositor therefore it can't be moved to
+// components/startup_metrics_utils.
+class BrowserWindowHistogramHelper : public ui::CompositorObserver {
+ public:
+ ~BrowserWindowHistogramHelper() override;
+
+ // Call this when the Browser finishes painting its UI, and the user will see
+ // it after next Compositor frame swap.
+ // |compositor| is the compositor that composites the just-painted Browser
+ // widget, or nullptr in Cocoa (we're using CoreAnimation's compositor there).
+ // Returned object should stay alive until next |OnCompositingStarted|
+ // callback.
+ static std::unique_ptr<BrowserWindowHistogramHelper>
+ MaybeRecordValueAndCreateInstanceOnBrowserPaint(ui::Compositor* compositor);
+
+ private:
+ explicit BrowserWindowHistogramHelper(ui::Compositor* compositor);
+
+ // ui::CompositorObserver:
+ void OnCompositingDidCommit(ui::Compositor* compositor) override {}
+ void OnCompositingStarted(ui::Compositor* compositor,
+ base::TimeTicks start_time) override {}
+ void OnCompositingEnded(ui::Compositor* compositor) override;
+ void OnCompositingLockStateChanged(ui::Compositor* compositor) override {}
+ void OnCompositingShuttingDown(ui::Compositor* compositor) override;
+
+ ScopedObserver<ui::Compositor, ui::CompositorObserver> scoped_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserWindowHistogramHelper);
+};
+
+#endif // CHROME_BROWSER_METRICS_BROWSER_WINDOW_HISTOGRAM_HELPER_H_
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/browser_window_histogram_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698