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

Unified Diff: services/gfx/compositor/frame_dispatcher.h

Issue 1997513002: Mozart: Generalize frame scheduling. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-jank2
Patch Set: add comments Created 4 years, 7 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 | « services/gfx/compositor/compositor_engine.cc ('k') | services/gfx/compositor/frame_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/frame_dispatcher.h
diff --git a/services/gfx/compositor/frame_dispatcher.h b/services/gfx/compositor/frame_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c9bc264b2c3008e22a9ec9a678a75d087bae922
--- /dev/null
+++ b/services/gfx/compositor/frame_dispatcher.h
@@ -0,0 +1,39 @@
+// Copyright 2016 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 SERVICES_GFX_COMPOSITOR_FRAME_DISPATCHER_H_
+#define SERVICES_GFX_COMPOSITOR_FRAME_DISPATCHER_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h"
+
+namespace compositor {
+
+using FrameCallback =
+ base::Callback<void(mojo::gfx::composition::FrameInfoPtr)>;
+
+// Maintains a list of pending frame callbacks to be dispatched.
+class FrameDispatcher {
+ public:
+ FrameDispatcher();
+ ~FrameDispatcher();
+
+ // Adds a callback, returns true if it was the first pending callback.
+ bool AddCallback(const FrameCallback& callback);
+
+ // Dispatches all pending callbacks then clears the list.
+ void DispatchCallbacks(const mojo::gfx::composition::FrameInfo& frame_info);
+
+ private:
+ std::vector<FrameCallback> pending_callbacks_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameDispatcher);
+};
+
+} // namespace compositor
+
+#endif // SERVICES_GFX_COMPOSITOR_FRAME_DISPATCHER_H_
« no previous file with comments | « services/gfx/compositor/compositor_engine.cc ('k') | services/gfx/compositor/frame_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698