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_IN_PROCESS_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "cc/trees/compositor_mode.h" | 38 #include "cc/trees/compositor_mode.h" |
39 #include "cc/trees/layer_tree.h" | 39 #include "cc/trees/layer_tree.h" |
40 #include "cc/trees/layer_tree_host.h" | 40 #include "cc/trees/layer_tree_host.h" |
41 #include "cc/trees/layer_tree_host_client.h" | 41 #include "cc/trees/layer_tree_host_client.h" |
42 #include "cc/trees/layer_tree_settings.h" | 42 #include "cc/trees/layer_tree_settings.h" |
43 #include "cc/trees/proxy.h" | 43 #include "cc/trees/proxy.h" |
44 #include "cc/trees/swap_promise_manager.h" | 44 #include "cc/trees/swap_promise_manager.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 { | |
49 class GpuMemoryBufferManager; | |
50 } // namespace gpu | |
51 | |
52 namespace cc { | 48 namespace cc { |
53 class AnimationHost; | 49 class AnimationHost; |
54 class AnimationEvents; | 50 class AnimationEvents; |
55 class BeginFrameSource; | 51 class BeginFrameSource; |
56 class ClientPictureCache; | 52 class ClientPictureCache; |
57 class EnginePictureCache; | 53 class EnginePictureCache; |
58 class HeadsUpDisplayLayer; | 54 class HeadsUpDisplayLayer; |
59 class ImageSerializationProcessor; | 55 class ImageSerializationProcessor; |
60 class Layer; | 56 class Layer; |
61 class LayerTreeHostClient; | 57 class LayerTreeHostClient; |
62 class LayerTreeHostImpl; | 58 class LayerTreeHostImpl; |
63 class LayerTreeHostImplClient; | 59 class LayerTreeHostImplClient; |
64 class LayerTreeHostSingleThreadClient; | 60 class LayerTreeHostSingleThreadClient; |
65 class LayerTreeMutator; | 61 class LayerTreeMutator; |
66 class PropertyTrees; | 62 class PropertyTrees; |
67 class Region; | 63 class Region; |
68 class RemoteProtoChannel; | 64 class RemoteProtoChannel; |
69 class RenderingStatsInstrumentation; | 65 class RenderingStatsInstrumentation; |
70 class ResourceProvider; | 66 class ResourceProvider; |
71 class ResourceUpdateQueue; | 67 class ResourceUpdateQueue; |
72 class SharedBitmapManager; | |
73 class TaskGraphRunner; | 68 class TaskGraphRunner; |
74 class TopControlsManager; | 69 class TopControlsManager; |
75 struct PendingPageScaleAnimation; | 70 struct PendingPageScaleAnimation; |
76 struct RenderingStats; | 71 struct RenderingStats; |
77 struct ScrollAndScaleSet; | 72 struct ScrollAndScaleSet; |
78 | 73 |
79 namespace proto { | 74 namespace proto { |
80 class LayerTreeHost; | 75 class LayerTreeHost; |
81 } | 76 } |
82 | 77 |
83 class CC_EXPORT LayerTreeHostInProcess : public LayerTreeHost { | 78 class CC_EXPORT LayerTreeHostInProcess : public LayerTreeHost { |
84 public: | 79 public: |
85 // TODO(sad): InitParams should be a movable type so that it can be | 80 // TODO(sad): InitParams should be a movable type so that it can be |
86 // std::move()d to the Create* functions. | 81 // std::move()d to the Create* functions. |
87 struct CC_EXPORT InitParams { | 82 struct CC_EXPORT InitParams { |
88 LayerTreeHostClient* client = nullptr; | 83 LayerTreeHostClient* client = nullptr; |
89 SharedBitmapManager* shared_bitmap_manager = nullptr; | |
90 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; | |
91 TaskGraphRunner* task_graph_runner = nullptr; | 84 TaskGraphRunner* task_graph_runner = nullptr; |
92 LayerTreeSettings const* settings = nullptr; | 85 LayerTreeSettings const* settings = nullptr; |
93 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; | 86 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; |
94 ImageSerializationProcessor* image_serialization_processor = nullptr; | 87 ImageSerializationProcessor* image_serialization_processor = nullptr; |
95 std::unique_ptr<AnimationHost> animation_host; | 88 std::unique_ptr<AnimationHost> animation_host; |
96 | 89 |
97 InitParams(); | 90 InitParams(); |
98 ~InitParams(); | 91 ~InitParams(); |
99 }; | 92 }; |
100 | 93 |
101 // The SharedBitmapManager will be used on the compositor thread. | |
102 static std::unique_ptr<LayerTreeHostInProcess> CreateThreaded( | 94 static std::unique_ptr<LayerTreeHostInProcess> CreateThreaded( |
103 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 95 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
104 InitParams* params); | 96 InitParams* params); |
105 | 97 |
106 static std::unique_ptr<LayerTreeHostInProcess> CreateSingleThreaded( | 98 static std::unique_ptr<LayerTreeHostInProcess> CreateSingleThreaded( |
107 LayerTreeHostSingleThreadClient* single_thread_client, | 99 LayerTreeHostSingleThreadClient* single_thread_client, |
108 InitParams* params); | 100 InitParams* params); |
109 | 101 |
110 static std::unique_ptr<LayerTreeHostInProcess> CreateRemoteServer( | 102 static std::unique_ptr<LayerTreeHostInProcess> CreateRemoteServer( |
111 RemoteProtoChannel* remote_proto_channel, | 103 RemoteProtoChannel* remote_proto_channel, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 261 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
270 void InitializeForTesting( | 262 void InitializeForTesting( |
271 std::unique_ptr<TaskRunnerProvider> task_runner_provider, | 263 std::unique_ptr<TaskRunnerProvider> task_runner_provider, |
272 std::unique_ptr<Proxy> proxy_for_testing); | 264 std::unique_ptr<Proxy> proxy_for_testing); |
273 void InitializePictureCacheForTesting(); | 265 void InitializePictureCacheForTesting(); |
274 void SetTaskRunnerProviderForTesting( | 266 void SetTaskRunnerProviderForTesting( |
275 std::unique_ptr<TaskRunnerProvider> task_runner_provider); | 267 std::unique_ptr<TaskRunnerProvider> task_runner_provider); |
276 void SetUIResourceManagerForTesting( | 268 void SetUIResourceManagerForTesting( |
277 std::unique_ptr<UIResourceManager> ui_resource_manager); | 269 std::unique_ptr<UIResourceManager> ui_resource_manager); |
278 | 270 |
279 // shared_bitmap_manager(), gpu_memory_buffer_manager(), and | 271 // task_graph_runner() returns a valid value only until the LayerTreeHostImpl |
280 // task_graph_runner() return valid values only until the LayerTreeHostImpl is | 272 // is created in CreateLayerTreeHostImpl(). |
281 // created in CreateLayerTreeHostImpl(). | |
282 SharedBitmapManager* shared_bitmap_manager() const { | |
283 return shared_bitmap_manager_; | |
284 } | |
285 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { | |
286 return gpu_memory_buffer_manager_; | |
287 } | |
288 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } | 273 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } |
289 | 274 |
290 void OnCommitForSwapPromises(); | 275 void OnCommitForSwapPromises(); |
291 | 276 |
292 void RecordGpuRasterizationHistogram(); | 277 void RecordGpuRasterizationHistogram(); |
293 | 278 |
294 MicroBenchmarkController micro_benchmark_controller_; | 279 MicroBenchmarkController micro_benchmark_controller_; |
295 | 280 |
296 std::unique_ptr<LayerTree> layer_tree_; | 281 std::unique_ptr<LayerTree> layer_tree_; |
297 | 282 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 bool gpu_rasterization_histogram_recorded_; | 334 bool gpu_rasterization_histogram_recorded_; |
350 | 335 |
351 // If set, then page scale animation has completed, but the client hasn't been | 336 // If set, then page scale animation has completed, but the client hasn't been |
352 // notified about it yet. | 337 // notified about it yet. |
353 bool did_complete_scale_animation_; | 338 bool did_complete_scale_animation_; |
354 | 339 |
355 int id_; | 340 int id_; |
356 bool next_commit_forces_redraw_ = false; | 341 bool next_commit_forces_redraw_ = false; |
357 bool next_commit_forces_recalculate_raster_scales_ = false; | 342 bool next_commit_forces_recalculate_raster_scales_ = false; |
358 | 343 |
359 SharedBitmapManager* shared_bitmap_manager_; | |
360 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | |
361 TaskGraphRunner* task_graph_runner_; | 344 TaskGraphRunner* task_graph_runner_; |
362 | 345 |
363 ImageSerializationProcessor* image_serialization_processor_; | 346 ImageSerializationProcessor* image_serialization_processor_; |
364 std::unique_ptr<EnginePictureCache> engine_picture_cache_; | 347 std::unique_ptr<EnginePictureCache> engine_picture_cache_; |
365 std::unique_ptr<ClientPictureCache> client_picture_cache_; | 348 std::unique_ptr<ClientPictureCache> client_picture_cache_; |
366 | 349 |
367 SurfaceSequenceGenerator surface_sequence_generator_; | 350 SurfaceSequenceGenerator surface_sequence_generator_; |
368 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; | 351 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
369 | 352 |
370 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostInProcess); | 353 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostInProcess); |
371 }; | 354 }; |
372 | 355 |
373 } // namespace cc | 356 } // namespace cc |
374 | 357 |
375 #endif // CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ | 358 #endif // CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
OLD | NEW |