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 <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 class SharedBitmapManager; | 64 class SharedBitmapManager; |
65 class TaskGraphRunner; | 65 class TaskGraphRunner; |
66 class TopControlsManager; | 66 class TopControlsManager; |
67 class UIResourceRequest; | 67 class UIResourceRequest; |
68 struct PendingPageScaleAnimation; | 68 struct PendingPageScaleAnimation; |
69 struct RenderingStats; | 69 struct RenderingStats; |
70 struct ScrollAndScaleSet; | 70 struct ScrollAndScaleSet; |
71 | 71 |
72 class CC_EXPORT LayerTreeHost { | 72 class CC_EXPORT LayerTreeHost { |
73 public: | 73 public: |
| 74 // TODO(sad): InitParams should be a movable type so that it can be |
| 75 // std::move()d to the Create* functions. |
| 76 struct InitParams { |
| 77 LayerTreeHostClient* client = nullptr; |
| 78 SharedBitmapManager* shared_bitmap_manager = nullptr; |
| 79 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; |
| 80 TaskGraphRunner* task_graph_runner = nullptr; |
| 81 LayerTreeSettings const* settings = nullptr; |
| 82 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; |
| 83 scoped_ptr<BeginFrameSource> external_begin_frame_source; |
| 84 |
| 85 InitParams(); |
| 86 ~InitParams(); |
| 87 }; |
| 88 |
74 // The SharedBitmapManager will be used on the compositor thread. | 89 // The SharedBitmapManager will be used on the compositor thread. |
75 static scoped_ptr<LayerTreeHost> CreateThreaded( | 90 static scoped_ptr<LayerTreeHost> CreateThreaded( |
76 LayerTreeHostClient* client, | |
77 SharedBitmapManager* shared_bitmap_manager, | |
78 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
79 TaskGraphRunner* task_graph_runner, | |
80 const LayerTreeSettings& settings, | |
81 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
82 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 91 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
83 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 92 InitParams* params); |
84 | 93 |
85 static scoped_ptr<LayerTreeHost> CreateSingleThreaded( | 94 static scoped_ptr<LayerTreeHost> CreateSingleThreaded( |
86 LayerTreeHostClient* client, | |
87 LayerTreeHostSingleThreadClient* single_thread_client, | 95 LayerTreeHostSingleThreadClient* single_thread_client, |
88 SharedBitmapManager* shared_bitmap_manager, | 96 InitParams* params); |
89 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
90 TaskGraphRunner* task_graph_runner, | |
91 const LayerTreeSettings& settings, | |
92 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
93 scoped_ptr<BeginFrameSource> external_begin_frame_source); | |
94 virtual ~LayerTreeHost(); | 97 virtual ~LayerTreeHost(); |
95 | 98 |
96 void SetLayerTreeHostClientReady(); | 99 void SetLayerTreeHostClientReady(); |
97 | 100 |
98 // LayerTreeHost interface to Proxy. | 101 // LayerTreeHost interface to Proxy. |
99 void WillBeginMainFrame(); | 102 void WillBeginMainFrame(); |
100 void DidBeginMainFrame(); | 103 void DidBeginMainFrame(); |
101 void BeginMainFrame(const BeginFrameArgs& args); | 104 void BeginMainFrame(const BeginFrameArgs& args); |
102 void BeginMainFrameNotExpectedSoon(); | 105 void BeginMainFrameNotExpectedSoon(); |
103 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 106 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 void SendBeginFramesToChildren(const BeginFrameArgs& args) const; | 309 void SendBeginFramesToChildren(const BeginFrameArgs& args) const; |
307 | 310 |
308 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | 311 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); |
309 | 312 |
310 PropertyTrees* property_trees() { return &property_trees_; } | 313 PropertyTrees* property_trees() { return &property_trees_; } |
311 bool needs_meta_info_recomputation() { | 314 bool needs_meta_info_recomputation() { |
312 return needs_meta_info_recomputation_; | 315 return needs_meta_info_recomputation_; |
313 } | 316 } |
314 | 317 |
315 protected: | 318 protected: |
316 LayerTreeHost(LayerTreeHostClient* client, | 319 explicit LayerTreeHost(InitParams* params); |
317 SharedBitmapManager* shared_bitmap_manager, | |
318 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
319 TaskGraphRunner* task_graph_runner, | |
320 const LayerTreeSettings& settings); | |
321 void InitializeThreaded( | 320 void InitializeThreaded( |
322 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 321 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
323 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 322 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
324 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 323 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
325 void InitializeSingleThreaded( | 324 void InitializeSingleThreaded( |
326 LayerTreeHostSingleThreadClient* single_thread_client, | 325 LayerTreeHostSingleThreadClient* single_thread_client, |
327 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 326 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
328 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 327 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
329 void InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); | 328 void InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); |
330 void SetOutputSurfaceLostForTesting(bool is_lost) { | 329 void SetOutputSurfaceLostForTesting(bool is_lost) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 458 |
460 uint32_t surface_id_namespace_; | 459 uint32_t surface_id_namespace_; |
461 uint32_t next_surface_sequence_; | 460 uint32_t next_surface_sequence_; |
462 | 461 |
463 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 462 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
464 }; | 463 }; |
465 | 464 |
466 } // namespace cc | 465 } // namespace cc |
467 | 466 |
468 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 467 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |