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

Unified Diff: cc/output/report_time_swap_promise.h

Issue 2835763002: Use swap-promise to improve first* paint times (Closed)
Patch Set: remove printfs 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
Index: cc/output/report_time_swap_promise.h
diff --git a/cc/output/report_time_swap_promise.h b/cc/output/report_time_swap_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..e8a3f6b7cb49e867540e9377cfab7ea708f747e5
--- /dev/null
+++ b/cc/output/report_time_swap_promise.h
@@ -0,0 +1,40 @@
+// 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 CC_OUTPUT_REPORT_TIME_SWAP_PROMISE_H_
+#define CC_OUTPUT_REPORT_TIME_SWAP_PROMISE_H_
+
+#include "base/callback.h"
+#include "cc/output/swap_promise.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace cc {
+
+using ReportTimeCallback = base::Callback<void(bool, double)>;
+
+class CC_EXPORT ReportTimeSwapPromise : public SwapPromise {
+ public:
+ ReportTimeSwapPromise(
+ ReportTimeCallback callback,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ ~ReportTimeSwapPromise() override;
+
+ void DidActivate() override {}
+ void WillSwap(CompositorFrameMetadata* metadata) override {}
+ void DidSwap() override;
+ DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override;
+
+ int64_t TraceId() const override;
+
+ private:
+ ReportTimeCallback callback_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+};
+
+} // namespace cc
+
+#endif // CC_OUTPUT_REPORT_TIME_SWAP_PROMISE_H_

Powered by Google App Engine
This is Rietveld 408576698