blob: 0d04e3fcc49e51e1f6943c74a19eaf4fa4165455 [file] [log] [blame]
// 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