OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_TREES_LAYER_TREE_HOST_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... | |
27 #include "cc/input/event_listener_properties.h" | 27 #include "cc/input/event_listener_properties.h" |
28 #include "cc/input/input_handler.h" | 28 #include "cc/input/input_handler.h" |
29 #include "cc/input/layer_selection_bound.h" | 29 #include "cc/input/layer_selection_bound.h" |
30 #include "cc/input/scrollbar.h" | 30 #include "cc/input/scrollbar.h" |
31 #include "cc/input/top_controls_state.h" | 31 #include "cc/input/top_controls_state.h" |
32 #include "cc/layers/layer_collections.h" | 32 #include "cc/layers/layer_collections.h" |
33 #include "cc/layers/layer_list_iterator.h" | 33 #include "cc/layers/layer_list_iterator.h" |
34 #include "cc/output/output_surface.h" | 34 #include "cc/output/output_surface.h" |
35 #include "cc/output/swap_promise.h" | 35 #include "cc/output/swap_promise.h" |
36 #include "cc/resources/resource_format.h" | 36 #include "cc/resources/resource_format.h" |
37 #include "cc/surfaces/surface_sequence.h" | |
38 #include "cc/trees/compositor_mode.h" | 37 #include "cc/trees/compositor_mode.h" |
39 #include "cc/trees/layer_tree.h" | 38 #include "cc/trees/layer_tree.h" |
40 #include "cc/trees/layer_tree_host_client.h" | 39 #include "cc/trees/layer_tree_host_client.h" |
41 #include "cc/trees/layer_tree_host_interface.h" | 40 #include "cc/trees/layer_tree_host_interface.h" |
42 #include "cc/trees/layer_tree_settings.h" | 41 #include "cc/trees/layer_tree_settings.h" |
43 #include "cc/trees/proxy.h" | 42 #include "cc/trees/proxy.h" |
43 #include "cc/trees/surface_sequence_generator.h" | |
44 #include "cc/trees/swap_promise_monitor.h" | 44 #include "cc/trees/swap_promise_monitor.h" |
45 #include "third_party/skia/include/core/SkColor.h" | 45 #include "third_party/skia/include/core/SkColor.h" |
46 #include "ui/gfx/geometry/rect.h" | 46 #include "ui/gfx/geometry/rect.h" |
47 | 47 |
48 namespace gpu { | 48 namespace gpu { |
49 class GpuMemoryBufferManager; | 49 class GpuMemoryBufferManager; |
50 } | 50 } |
51 | 51 |
52 namespace cc { | 52 namespace cc { |
53 | 53 |
(...skipping 14 matching lines...) Expand all Loading... | |
68 class RemoteProtoChannel; | 68 class RemoteProtoChannel; |
69 class RenderingStatsInstrumentation; | 69 class RenderingStatsInstrumentation; |
70 class ResourceProvider; | 70 class ResourceProvider; |
71 class ResourceUpdateQueue; | 71 class ResourceUpdateQueue; |
72 class SharedBitmapManager; | 72 class SharedBitmapManager; |
73 class TaskGraphRunner; | 73 class TaskGraphRunner; |
74 class TopControlsManager; | 74 class TopControlsManager; |
75 struct PendingPageScaleAnimation; | 75 struct PendingPageScaleAnimation; |
76 struct RenderingStats; | 76 struct RenderingStats; |
77 struct ScrollAndScaleSet; | 77 struct ScrollAndScaleSet; |
78 class SwapPromiseManager; | |
78 | 79 |
79 namespace proto { | 80 namespace proto { |
80 class LayerTreeHost; | 81 class LayerTreeHost; |
81 } | 82 } |
82 | 83 |
83 // This class is being refactored to an interface, see LayerTreeHostInterface, | 84 // This class is being refactored to an interface, see LayerTreeHostInterface, |
84 // which is the API for the cc embedder. When adding new code to this class, | 85 // which is the API for the cc embedder. When adding new code to this class, |
85 // consider the following: | 86 // consider the following: |
86 // 1) If its state/data that gets pushed to the LayerTreeImpl during commit, add | 87 // 1) If its state/data that gets pushed to the LayerTreeImpl during commit, add |
87 // it to the LayerTree. | 88 // it to the LayerTree. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 int GetId() const override; | 143 int GetId() const override; |
143 int SourceFrameNumber() const override; | 144 int SourceFrameNumber() const override; |
144 LayerTree* GetLayerTree() override; | 145 LayerTree* GetLayerTree() override; |
145 const LayerTree* GetLayerTree() const override; | 146 const LayerTree* GetLayerTree() const override; |
146 UIResourceManager* GetUIResourceManager() const override; | 147 UIResourceManager* GetUIResourceManager() const override; |
147 TaskRunnerProvider* GetTaskRunnerProvider() const override; | 148 TaskRunnerProvider* GetTaskRunnerProvider() const override; |
148 const LayerTreeSettings& GetSettings() const override; | 149 const LayerTreeSettings& GetSettings() const override; |
149 void SetSurfaceClientId(uint32_t client_id) override; | 150 void SetSurfaceClientId(uint32_t client_id) override; |
150 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override; | 151 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override; |
151 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override; | 152 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override; |
153 SwapPromiseManager* GetSwapPromiseManager() const override; | |
152 void SetHasGpuRasterizationTrigger(bool has_trigger) override; | 154 void SetHasGpuRasterizationTrigger(bool has_trigger) override; |
153 void SetVisible(bool visible) override; | 155 void SetVisible(bool visible) override; |
154 bool IsVisible() const override; | 156 bool IsVisible() const override; |
155 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface) override; | 157 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface) override; |
156 std::unique_ptr<OutputSurface> ReleaseOutputSurface() override; | 158 std::unique_ptr<OutputSurface> ReleaseOutputSurface() override; |
157 void SetNeedsAnimate() override; | 159 void SetNeedsAnimate() override; |
158 void SetNeedsUpdateLayers() override; | 160 void SetNeedsUpdateLayers() override; |
159 void SetNeedsCommit() override; | 161 void SetNeedsCommit() override; |
160 bool BeginMainFrameRequested() const override; | 162 bool BeginMainFrameRequested() const override; |
161 bool CommitRequested() const override; | 163 bool CommitRequested() const override; |
(...skipping 10 matching lines...) Expand all Loading... | |
172 const base::WeakPtr<InputHandler>& GetInputHandler() const override; | 174 const base::WeakPtr<InputHandler>& GetInputHandler() const override; |
173 void DidStopFlinging() override; | 175 void DidStopFlinging() override; |
174 void SetDebugState(const LayerTreeDebugState& debug_state) override; | 176 void SetDebugState(const LayerTreeDebugState& debug_state) override; |
175 const LayerTreeDebugState& GetDebugState() const override; | 177 const LayerTreeDebugState& GetDebugState() const override; |
176 int ScheduleMicroBenchmark( | 178 int ScheduleMicroBenchmark( |
177 const std::string& benchmark_name, | 179 const std::string& benchmark_name, |
178 std::unique_ptr<base::Value> value, | 180 std::unique_ptr<base::Value> value, |
179 const MicroBenchmark::DoneCallback& callback) override; | 181 const MicroBenchmark::DoneCallback& callback) override; |
180 bool SendMessageToMicroBenchmark(int id, | 182 bool SendMessageToMicroBenchmark(int id, |
181 std::unique_ptr<base::Value> value) override; | 183 std::unique_ptr<base::Value> value) override; |
182 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) override; | 184 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override; |
183 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) override; | |
184 | 185 |
185 // LayerTreeHost interface to Proxy. | 186 // LayerTreeHost interface to Proxy. |
186 void WillBeginMainFrame(); | 187 void WillBeginMainFrame(); |
187 void DidBeginMainFrame(); | 188 void DidBeginMainFrame(); |
188 void BeginMainFrame(const BeginFrameArgs& args); | 189 void BeginMainFrame(const BeginFrameArgs& args); |
189 void BeginMainFrameNotExpectedSoon(); | 190 void BeginMainFrameNotExpectedSoon(); |
190 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 191 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
191 void RequestMainFrameUpdate(); | 192 void RequestMainFrameUpdate(); |
192 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 193 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
193 void WillCommit(); | 194 void WillCommit(); |
(...skipping 26 matching lines...) Expand all Loading... | |
220 void SetNextCommitWaitsForActivation(); | 221 void SetNextCommitWaitsForActivation(); |
221 | 222 |
222 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); | 223 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); |
223 | 224 |
224 bool has_gpu_rasterization_trigger() const { | 225 bool has_gpu_rasterization_trigger() const { |
225 return has_gpu_rasterization_trigger_; | 226 return has_gpu_rasterization_trigger_; |
226 } | 227 } |
227 | 228 |
228 Proxy* proxy() const { return proxy_.get(); } | 229 Proxy* proxy() const { return proxy_.get(); } |
229 | 230 |
230 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason); | |
231 std::vector<std::unique_ptr<SwapPromise>> TakeSwapPromises(); | |
232 | |
233 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); } | |
234 | |
235 SurfaceSequence CreateSurfaceSequence(); | |
236 | |
237 // Serializes the parts of this LayerTreeHost that is needed for a commit to a | 231 // Serializes the parts of this LayerTreeHost that is needed for a commit to a |
238 // protobuf message. Not all members are serialized as they are not helpful | 232 // protobuf message. Not all members are serialized as they are not helpful |
239 // for remote usage. | 233 // for remote usage. |
240 // The |swap_promise_list_| is transferred to the serializer in | 234 // The |swap_promise_list_| is transferred to the serializer in |
241 // |swap_promises|. | 235 // |swap_promises|. |
242 void ToProtobufForCommit( | 236 void ToProtobufForCommit( |
243 proto::LayerTreeHost* proto, | 237 proto::LayerTreeHost* proto, |
244 std::vector<std::unique_ptr<SwapPromise>>* swap_promises); | 238 std::vector<std::unique_ptr<SwapPromise>>* swap_promises); |
245 | 239 |
246 // Deserializes the protobuf into this LayerTreeHost before a commit. The | 240 // Deserializes the protobuf into this LayerTreeHost before a commit. The |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 std::unique_ptr<Proxy> proxy, | 328 std::unique_ptr<Proxy> proxy, |
335 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 329 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
336 | 330 |
337 bool DoUpdateLayers(Layer* root_layer); | 331 bool DoUpdateLayers(Layer* root_layer); |
338 void UpdateHudLayer(); | 332 void UpdateHudLayer(); |
339 | 333 |
340 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 334 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
341 | 335 |
342 void CalculateLCDTextMetricsCallback(Layer* layer); | 336 void CalculateLCDTextMetricsCallback(Layer* layer); |
343 | 337 |
344 void NotifySwapPromiseMonitorsOfSetNeedsCommit(); | |
345 | |
346 void SetPropertyTreesNeedRebuild(); | 338 void SetPropertyTreesNeedRebuild(); |
347 | 339 |
348 const CompositorMode compositor_mode_; | 340 const CompositorMode compositor_mode_; |
349 | 341 |
350 std::unique_ptr<UIResourceManager> ui_resource_manager_; | 342 std::unique_ptr<UIResourceManager> ui_resource_manager_; |
351 | 343 |
352 LayerTreeHostClient* client_; | 344 LayerTreeHostClient* client_; |
353 std::unique_ptr<Proxy> proxy_; | 345 std::unique_ptr<Proxy> proxy_; |
354 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; | 346 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; |
355 | 347 |
356 int source_frame_number_; | 348 int source_frame_number_; |
357 std::unique_ptr<RenderingStatsInstrumentation> | 349 std::unique_ptr<RenderingStatsInstrumentation> |
358 rendering_stats_instrumentation_; | 350 rendering_stats_instrumentation_; |
359 | 351 |
352 std::unique_ptr<SwapPromiseManager> swap_promise_manager_; | |
vmpstr
2016/09/13 18:39:44
If this is tied to the lifetime of the enclosing c
Khushal
2016/09/14 19:29:12
Done.
| |
353 | |
360 // |current_output_surface_| can't be updated until we've successfully | 354 // |current_output_surface_| can't be updated until we've successfully |
361 // initialized a new output surface. |new_output_surface_| contains the | 355 // initialized a new output surface. |new_output_surface_| contains the |
362 // new output surface that is currently being initialized. If initialization | 356 // new output surface that is currently being initialized. If initialization |
363 // is successful then |new_output_surface_| replaces | 357 // is successful then |new_output_surface_| replaces |
364 // |current_output_surface_|. | 358 // |current_output_surface_|. |
365 std::unique_ptr<OutputSurface> new_output_surface_; | 359 std::unique_ptr<OutputSurface> new_output_surface_; |
366 std::unique_ptr<OutputSurface> current_output_surface_; | 360 std::unique_ptr<OutputSurface> current_output_surface_; |
367 | 361 |
368 const LayerTreeSettings settings_; | 362 const LayerTreeSettings settings_; |
369 LayerTreeDebugState debug_state_; | 363 LayerTreeDebugState debug_state_; |
(...skipping 12 matching lines...) Expand all Loading... | |
382 bool next_commit_forces_redraw_; | 376 bool next_commit_forces_redraw_; |
383 | 377 |
384 SharedBitmapManager* shared_bitmap_manager_; | 378 SharedBitmapManager* shared_bitmap_manager_; |
385 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 379 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
386 TaskGraphRunner* task_graph_runner_; | 380 TaskGraphRunner* task_graph_runner_; |
387 | 381 |
388 ImageSerializationProcessor* image_serialization_processor_; | 382 ImageSerializationProcessor* image_serialization_processor_; |
389 std::unique_ptr<EnginePictureCache> engine_picture_cache_; | 383 std::unique_ptr<EnginePictureCache> engine_picture_cache_; |
390 std::unique_ptr<ClientPictureCache> client_picture_cache_; | 384 std::unique_ptr<ClientPictureCache> client_picture_cache_; |
391 | 385 |
392 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; | 386 SurfaceSequenceGenerator surface_sequence_generator_; |
393 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | |
394 | |
395 uint32_t surface_client_id_; | |
396 uint32_t next_surface_sequence_; | |
397 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; | 387 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
398 | 388 |
399 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 389 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
400 }; | 390 }; |
401 | 391 |
402 } // namespace cc | 392 } // namespace cc |
403 | 393 |
404 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 394 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |