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

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

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/frame_dispatcher.h ('k') | services/gfx/compositor/renderer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/frame_dispatcher.cc
diff --git a/services/gfx/compositor/frame_dispatcher.cc b/services/gfx/compositor/frame_dispatcher.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0d04e3fcc49e51e1f6943c74a19eaf4fa4165455
--- /dev/null
+++ b/services/gfx/compositor/frame_dispatcher.cc
@@ -0,0 +1,26 @@
+// 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.
+
+#include "services/gfx/compositor/frame_dispatcher.h"
+
+namespace compositor {
+
+FrameDispatcher::FrameDispatcher() {}
+
+FrameDispatcher::~FrameDispatcher() {}
+
+bool FrameDispatcher::AddCallback(const FrameCallback& callback) {
+ pending_callbacks_.emplace_back(callback);
+ return pending_callbacks_.size() == 1u;
+}
+
+void FrameDispatcher::DispatchCallbacks(
+ const mojo::gfx::composition::FrameInfo& frame_info) {
+ for (auto& callback : pending_callbacks_) {
+ callback.Run(frame_info.Clone());
+ }
+ pending_callbacks_.clear();
+}
+
+} // namespace compositor
« no previous file with comments | « services/gfx/compositor/frame_dispatcher.h ('k') | services/gfx/compositor/renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698