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

Side by Side Diff: services/gfx/compositor/scene_state.cc

Issue 1749063002: Mozart: Improve internal scene graph representation. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-0
Patch Set: avoid unnecessary hashtable lookups Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « services/gfx/compositor/scene_state.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/gfx/compositor/scene_state.h" 5 #include "services/gfx/compositor/scene_state.h"
6 6
7 namespace compositor { 7 namespace compositor {
8 8
9 SceneState::SceneState(mojo::gfx::composition::SceneTokenPtr scene_token, 9 SceneState::SceneState(mojo::gfx::composition::SceneTokenPtr scene_token,
10 const std::string& label) 10 const std::string& label)
11 : scene_def_(scene_token.Pass(), label), weak_factory_(this) {} 11 : scene_token_(scene_token.Pass()),
12 scene_def_(SceneLabel(scene_token_->value, label)),
13 weak_factory_(this) {}
12 14
13 SceneState::~SceneState() { 15 SceneState::~SceneState() {
14 // The scene implementation and all of its bindings must be destroyed 16 // The scene implementation and all of its bindings must be destroyed
15 // before any pending callbacks are dropped on the floor. 17 // before any pending callbacks are dropped on the floor.
16 scene_impl_.reset(); 18 scene_impl_.reset();
17 pending_frame_callbacks_.clear(); 19 pending_frame_callbacks_.clear();
18 } 20 }
19 21
20 void SceneState::AddSceneFrameCallback(const SceneFrameCallback& callback) { 22 void SceneState::AddSceneFrameCallback(const SceneFrameCallback& callback) {
21 pending_frame_callbacks_.push_back(callback); 23 pending_frame_callbacks_.push_back(callback);
22 } 24 }
23 25
24 void SceneState::DispatchSceneFrameCallbacks( 26 void SceneState::DispatchSceneFrameCallbacks(
25 const mojo::gfx::composition::FrameInfo& frame_info) { 27 const mojo::gfx::composition::FrameInfo& frame_info) {
26 for (auto& callback : pending_frame_callbacks_) { 28 for (auto& callback : pending_frame_callbacks_) {
27 callback.Run(frame_info.Clone()); 29 callback.Run(frame_info.Clone());
28 } 30 }
29 pending_frame_callbacks_.clear(); 31 pending_frame_callbacks_.clear();
30 } 32 }
31 33
32 std::ostream& operator<<(std::ostream& os, SceneState* scene_state) { 34 std::ostream& operator<<(std::ostream& os, SceneState* scene_state) {
33 if (!scene_state) 35 if (!scene_state)
34 return os << "null"; 36 return os << "null";
35 return os << scene_state->FormattedLabel(); 37 return os << scene_state->scene_def()->FormattedLabel();
36 } 38 }
37 39
38 } // namespace compositor 40 } // namespace compositor
OLDNEW
« 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