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