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..b0cac4afa7ca79c20ed1440b755a9ef373ed0465 |
--- /dev/null |
+++ b/chrome/browser/metrics/browser_window_histogram_helper.h |
@@ -0,0 +1,46 @@ |
+// 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. |
Alexei Svitkine (slow)
2017/04/19 16:52:16
Add a sentence here to mention that this is not in
themblsha
2017/04/19 17:27:40
Done.
|
+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> |
+ RecordValueAndMaybeCreateInstanceOnBrowserPainted(ui::Compositor* compositor); |
Alexei Svitkine (slow)
2017/04/19 16:52:16
Nit: The "Record value" part is also under Maybe s
themblsha
2017/04/19 17:27:40
Good point, done.
|
+ |
+ private: |
+ explicit BrowserWindowHistogramHelper(ui::Compositor* compositor); |
+ |
+ // ui::CompositorObserver: |
+ |
Alexei Svitkine (slow)
2017/04/19 16:52:16
Nit: Remove empty line
themblsha
2017/04/19 17:27:41
Done.
|
+ void OnCompositingDidCommit(ui::Compositor* compositor) override {} |
+ void OnCompositingStarted(ui::Compositor* compositor, |
+ base::TimeTicks start_time) 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_ |