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

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

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/render/render_layer.cc ('k') | services/gfx/compositor/scene_state.cc » ('j') | 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 #ifndef SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_ 5 #ifndef SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_
6 #define SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_ 6 #define SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 16 matching lines...) Expand all
27 class SceneState { 27 class SceneState {
28 public: 28 public:
29 SceneState(mojo::gfx::composition::SceneTokenPtr scene_token, 29 SceneState(mojo::gfx::composition::SceneTokenPtr scene_token,
30 const std::string& label); 30 const std::string& label);
31 ~SceneState(); 31 ~SceneState();
32 32
33 base::WeakPtr<SceneState> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } 33 base::WeakPtr<SceneState> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
34 34
35 // Gets the token used to refer to this scene globally. 35 // Gets the token used to refer to this scene globally.
36 // Caller does not obtain ownership of the token. 36 // Caller does not obtain ownership of the token.
37 mojo::gfx::composition::SceneToken* scene_token() { 37 const mojo::gfx::composition::SceneToken* scene_token() {
38 return scene_def_.scene_token(); 38 return scene_token_.get();
39 } 39 }
40 40
41 // Gets or sets the scene listener interface. 41 // Gets or sets the scene listener interface.
42 mojo::gfx::composition::SceneListener* scene_listener() { 42 mojo::gfx::composition::SceneListener* scene_listener() {
43 return scene_listener_.get(); 43 return scene_listener_.get();
44 } 44 }
45 void set_scene_listener(mojo::gfx::composition::SceneListenerPtr listener) { 45 void set_scene_listener(mojo::gfx::composition::SceneListenerPtr listener) {
46 scene_listener_ = listener.Pass(); 46 scene_listener_ = listener.Pass();
47 } 47 }
48 48
49 // Sets the associated scene implementation and takes ownership of it. 49 // Sets the associated scene implementation and takes ownership of it.
50 void set_scene_impl(mojo::gfx::composition::Scene* impl) { 50 void set_scene_impl(mojo::gfx::composition::Scene* impl) {
51 scene_impl_.reset(impl); 51 scene_impl_.reset(impl);
52 } 52 }
53 53
54 // Gets the underlying scene definition, never null. 54 // Gets the underlying scene definition, never null.
55 SceneDef* scene_def() { return &scene_def_; } 55 SceneDef* scene_def() { return &scene_def_; }
56 56
57 void AddSceneFrameCallback(const SceneFrameCallback& callback); 57 void AddSceneFrameCallback(const SceneFrameCallback& callback);
58 void DispatchSceneFrameCallbacks( 58 void DispatchSceneFrameCallbacks(
59 const mojo::gfx::composition::FrameInfo& frame_info); 59 const mojo::gfx::composition::FrameInfo& frame_info);
60 60
61 const std::string& label() { return scene_def_.label(); }
62 std::string FormattedLabel() { return scene_def_.FormattedLabel(); }
63
64 private: 61 private:
62 mojo::gfx::composition::SceneTokenPtr scene_token_;
65 std::unique_ptr<mojo::gfx::composition::Scene> scene_impl_; 63 std::unique_ptr<mojo::gfx::composition::Scene> scene_impl_;
66 mojo::gfx::composition::SceneListenerPtr scene_listener_; 64 mojo::gfx::composition::SceneListenerPtr scene_listener_;
67 std::vector<SceneFrameCallback> pending_frame_callbacks_; 65 std::vector<SceneFrameCallback> pending_frame_callbacks_;
68 66
69 SceneDef scene_def_; 67 SceneDef scene_def_;
70 68
71 base::WeakPtrFactory<SceneState> weak_factory_; 69 base::WeakPtrFactory<SceneState> weak_factory_;
72 70
73 DISALLOW_COPY_AND_ASSIGN(SceneState); 71 DISALLOW_COPY_AND_ASSIGN(SceneState);
74 }; 72 };
75 73
76 std::ostream& operator<<(std::ostream& os, SceneState* scene_state); 74 std::ostream& operator<<(std::ostream& os, SceneState* scene_state);
77 75
78 } // namespace compositor 76 } // namespace compositor
79 77
80 #endif // SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_ 78 #endif // SERVICES_GFX_COMPOSITOR_SCENE_STATE_H_
OLDNEW
« no previous file with comments | « services/gfx/compositor/render/render_layer.cc ('k') | services/gfx/compositor/scene_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698