OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/gfx/compositor/frame_dispatcher.h" |
| 6 |
| 7 namespace compositor { |
| 8 |
| 9 FrameDispatcher::FrameDispatcher() {} |
| 10 |
| 11 FrameDispatcher::~FrameDispatcher() {} |
| 12 |
| 13 bool FrameDispatcher::AddCallback(const FrameCallback& callback) { |
| 14 pending_callbacks_.emplace_back(callback); |
| 15 return pending_callbacks_.size() == 1u; |
| 16 } |
| 17 |
| 18 void FrameDispatcher::DispatchCallbacks( |
| 19 const mojo::gfx::composition::FrameInfo& frame_info) { |
| 20 for (auto& callback : pending_callbacks_) { |
| 21 callback.Run(frame_info.Clone()); |
| 22 } |
| 23 pending_callbacks_.clear(); |
| 24 } |
| 25 |
| 26 } // namespace compositor |
OLD | NEW |