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

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

Issue 1552963002: Initial checkin of the new Mozart compositor. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-11
Patch Set: fix android build Created 4 years, 11 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/scene_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/gfx/compositor/scene_state.cc
diff --git a/services/gfx/compositor/scene_state.cc b/services/gfx/compositor/scene_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c3b457569e96de86bda81ebfb6614a0aeb06e31d
--- /dev/null
+++ b/services/gfx/compositor/scene_state.cc
@@ -0,0 +1,38 @@
+// Copyright 2015 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/scene_state.h"
+
+namespace compositor {
+
+SceneState::SceneState(mojo::gfx::composition::SceneTokenPtr scene_token,
+ const std::string& label)
+ : scene_def_(scene_token.Pass(), label), weak_factory_(this) {}
+
+SceneState::~SceneState() {
+ // The scene implementation and all of its bindings must be destroyed
+ // before any pending callbacks are dropped on the floor.
+ scene_impl_.reset();
+ pending_frame_callbacks_.clear();
+}
+
+void SceneState::AddSceneFrameCallback(const SceneFrameCallback& callback) {
+ pending_frame_callbacks_.push_back(callback);
+}
+
+void SceneState::DispatchSceneFrameCallbacks(
+ const mojo::gfx::composition::FrameInfo& frame_info) {
+ for (auto& callback : pending_frame_callbacks_) {
+ callback.Run(frame_info.Clone());
+ }
+ pending_frame_callbacks_.clear();
+}
+
+std::ostream& operator<<(std::ostream& os, SceneState* scene_state) {
+ if (!scene_state)
+ return os << "null";
+ return os << scene_state->FormattedLabel();
+}
+
+} // namespace compositor
« no previous file with comments | « services/gfx/compositor/scene_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698