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 |