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

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

Issue 1873573003: Mozart: Ensure time always runs forward. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-3
Patch Set: fix build error on Android Created 4 years, 8 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/BUILD.gn ('k') | services/gfx/compositor/compositor_engine.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_COMPOSITOR_H_ 5 #ifndef SERVICES_GFX_COMPOSITOR_COMPOSITOR_H_
6 #define SERVICES_GFX_COMPOSITOR_COMPOSITOR_H_ 6 #define SERVICES_GFX_COMPOSITOR_COMPOSITOR_H_
7 7
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" 14 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h"
15 #include "services/gfx/compositor/backend/scheduler.h" 15 #include "services/gfx/compositor/backend/scheduler.h"
16 #include "services/gfx/compositor/graph/universe.h"
16 #include "services/gfx/compositor/renderer_state.h" 17 #include "services/gfx/compositor/renderer_state.h"
17 #include "services/gfx/compositor/scene_state.h" 18 #include "services/gfx/compositor/scene_state.h"
18 19
19 namespace compositor { 20 namespace compositor {
20 21
21 // Core of the compositor. 22 // Core of the compositor.
22 // All SceneState and RendererState objects are owned by the engine. 23 // All SceneState and RendererState objects are owned by the engine.
23 class CompositorEngine { 24 class CompositorEngine {
24 public: 25 public:
25 explicit CompositorEngine(); 26 explicit CompositorEngine();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void OnOutputError(const base::WeakPtr<RendererState>& renderer_state_weak); 101 void OnOutputError(const base::WeakPtr<RendererState>& renderer_state_weak);
101 void OnOutputUpdateRequest( 102 void OnOutputUpdateRequest(
102 const base::WeakPtr<RendererState>& renderer_state_weak, 103 const base::WeakPtr<RendererState>& renderer_state_weak,
103 const mojo::gfx::composition::FrameInfo& frame_info); 104 const mojo::gfx::composition::FrameInfo& frame_info);
104 void OnOutputSnapshotRequest( 105 void OnOutputSnapshotRequest(
105 const base::WeakPtr<RendererState>& renderer_state_weak, 106 const base::WeakPtr<RendererState>& renderer_state_weak,
106 const mojo::gfx::composition::FrameInfo& frame_info); 107 const mojo::gfx::composition::FrameInfo& frame_info);
107 void OnPresentScene(const base::WeakPtr<SceneState>& scene_state_weak, 108 void OnPresentScene(const base::WeakPtr<SceneState>& scene_state_weak,
108 int64_t presentation_time); 109 int64_t presentation_time);
109 110
110 base::WeakPtr<SceneDef> ResolveSceneReference( 111 bool ResolveSceneReference(
111 const mojo::gfx::composition::SceneToken& scene_token); 112 const mojo::gfx::composition::SceneToken& scene_token);
112 void SendResourceUnavailable(SceneState* scene_state, uint32_t resource_id); 113 void SendResourceUnavailable(SceneState* scene_state, uint32_t resource_id);
113 114
114 SceneState* FindScene(uint32_t scene_token); 115 SceneState* FindScene(uint32_t scene_token);
115 116
116 bool IsSceneStateRegisteredDebug(SceneState* scene_state) { 117 bool IsSceneStateRegisteredDebug(SceneState* scene_state) {
117 return scene_state && FindScene(scene_state->scene_token()->value); 118 return scene_state && FindScene(scene_state->scene_token().value);
118 } 119 }
119 bool IsRendererStateRegisteredDebug(RendererState* renderer_state) { 120 bool IsRendererStateRegisteredDebug(RendererState* renderer_state) {
120 return renderer_state && 121 return renderer_state &&
121 std::any_of(renderers_.begin(), renderers_.end(), 122 std::any_of(renderers_.begin(), renderers_.end(),
122 [renderer_state](RendererState* other) { 123 [renderer_state](RendererState* other) {
123 return renderer_state == other; 124 return renderer_state == other;
124 }); 125 });
125 } 126 }
126 127
127 uint32_t next_scene_token_value_ = 1u; 128 uint32_t next_scene_token_value_ = 1u;
128 uint32_t next_renderer_id_ = 1u; 129 uint32_t next_renderer_id_ = 1u;
129 std::unordered_map<uint32_t, SceneState*> scenes_by_token_; 130 std::unordered_map<uint32_t, SceneState*> scenes_by_token_;
130 std::vector<RendererState*> renderers_; 131 std::vector<RendererState*> renderers_;
131 132
133 Universe universe_;
134
132 base::WeakPtrFactory<CompositorEngine> weak_factory_; 135 base::WeakPtrFactory<CompositorEngine> weak_factory_;
133 136
134 DISALLOW_COPY_AND_ASSIGN(CompositorEngine); 137 DISALLOW_COPY_AND_ASSIGN(CompositorEngine);
135 }; 138 };
136 139
137 } // namespace compositor 140 } // namespace compositor
138 141
139 #endif // SERVICES_GFX_COMPOSITOR_COMPOSITOR_H_ 142 #endif // SERVICES_GFX_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « services/gfx/compositor/BUILD.gn ('k') | services/gfx/compositor/compositor_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698