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 29 matching lines...) Expand all Loading... |
40 #include "cc/trees/layer_tree_host_client.h" | 40 #include "cc/trees/layer_tree_host_client.h" |
41 #include "cc/trees/layer_tree_settings.h" | 41 #include "cc/trees/layer_tree_settings.h" |
42 #include "cc/trees/proxy.h" | 42 #include "cc/trees/proxy.h" |
43 #include "cc/trees/swap_promise_manager.h" | 43 #include "cc/trees/swap_promise_manager.h" |
44 #include "cc/trees/target_property.h" | 44 #include "cc/trees/target_property.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 cc { | 48 namespace cc { |
49 class MutatorEvents; | 49 class MutatorEvents; |
50 class ClientPictureCache; | |
51 class EnginePictureCache; | |
52 class ImageSerializationProcessor; | |
53 class Layer; | 50 class Layer; |
54 class LayerTreeHostClient; | 51 class LayerTreeHostClient; |
55 class LayerTreeHostImpl; | 52 class LayerTreeHostImpl; |
56 class LayerTreeHostImplClient; | 53 class LayerTreeHostImplClient; |
57 class LayerTreeHostSingleThreadClient; | 54 class LayerTreeHostSingleThreadClient; |
58 class LayerTreeMutator; | 55 class LayerTreeMutator; |
59 class MutatorHost; | 56 class MutatorHost; |
60 class PropertyTrees; | 57 class PropertyTrees; |
61 class RenderingStatsInstrumentation; | 58 class RenderingStatsInstrumentation; |
62 class TaskGraphRunner; | 59 class TaskGraphRunner; |
63 struct ReflectedMainFrameState; | 60 struct ReflectedMainFrameState; |
64 struct RenderingStats; | 61 struct RenderingStats; |
65 struct ScrollAndScaleSet; | 62 struct ScrollAndScaleSet; |
66 | 63 |
67 class CC_EXPORT LayerTreeHostInProcess : public LayerTreeHost { | 64 class CC_EXPORT LayerTreeHostInProcess : public LayerTreeHost { |
68 public: | 65 public: |
69 // TODO(sad): InitParams should be a movable type so that it can be | 66 // TODO(sad): InitParams should be a movable type so that it can be |
70 // std::move()d to the Create* functions. | 67 // std::move()d to the Create* functions. |
71 struct CC_EXPORT InitParams { | 68 struct CC_EXPORT InitParams { |
72 LayerTreeHostClient* client = nullptr; | 69 LayerTreeHostClient* client = nullptr; |
73 TaskGraphRunner* task_graph_runner = nullptr; | 70 TaskGraphRunner* task_graph_runner = nullptr; |
74 LayerTreeSettings const* settings = nullptr; | 71 LayerTreeSettings const* settings = nullptr; |
75 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; | 72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; |
76 ImageSerializationProcessor* image_serialization_processor = nullptr; | |
77 MutatorHost* mutator_host = nullptr; | 73 MutatorHost* mutator_host = nullptr; |
78 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner; | 74 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner; |
79 | 75 |
80 InitParams(); | 76 InitParams(); |
81 ~InitParams(); | 77 ~InitParams(); |
82 }; | 78 }; |
83 | 79 |
84 static std::unique_ptr<LayerTreeHostInProcess> CreateThreaded( | 80 static std::unique_ptr<LayerTreeHostInProcess> CreateThreaded( |
85 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 81 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
86 InitParams* params); | 82 InitParams* params); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 182 |
187 bool has_gpu_rasterization_trigger() const { | 183 bool has_gpu_rasterization_trigger() const { |
188 return has_gpu_rasterization_trigger_; | 184 return has_gpu_rasterization_trigger_; |
189 } | 185 } |
190 | 186 |
191 Proxy* proxy() const { return proxy_.get(); } | 187 Proxy* proxy() const { return proxy_.get(); } |
192 | 188 |
193 bool IsSingleThreaded() const; | 189 bool IsSingleThreaded() const; |
194 bool IsThreaded() const; | 190 bool IsThreaded() const; |
195 | 191 |
196 ImageSerializationProcessor* image_serialization_processor() const { | |
197 return image_serialization_processor_; | |
198 } | |
199 | |
200 EnginePictureCache* engine_picture_cache() const { | |
201 return engine_picture_cache_ ? engine_picture_cache_.get() : nullptr; | |
202 } | |
203 | |
204 ClientPictureCache* client_picture_cache() const { | |
205 return client_picture_cache_ ? client_picture_cache_.get() : nullptr; | |
206 } | |
207 | |
208 protected: | 192 protected: |
209 // Allow tests to inject the LayerTree. | 193 // Allow tests to inject the LayerTree. |
210 LayerTreeHostInProcess(InitParams* params, | 194 LayerTreeHostInProcess(InitParams* params, |
211 CompositorMode mode, | 195 CompositorMode mode, |
212 std::unique_ptr<LayerTree> layer_tree); | 196 std::unique_ptr<LayerTree> layer_tree); |
213 LayerTreeHostInProcess(InitParams* params, CompositorMode mode); | 197 LayerTreeHostInProcess(InitParams* params, CompositorMode mode); |
214 | 198 |
215 void InitializeThreaded( | 199 void InitializeThreaded( |
216 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 200 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
217 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 201 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
218 void InitializeSingleThreaded( | 202 void InitializeSingleThreaded( |
219 LayerTreeHostSingleThreadClient* single_thread_client, | 203 LayerTreeHostSingleThreadClient* single_thread_client, |
220 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 204 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
221 void InitializeForTesting( | 205 void InitializeForTesting( |
222 std::unique_ptr<TaskRunnerProvider> task_runner_provider, | 206 std::unique_ptr<TaskRunnerProvider> task_runner_provider, |
223 std::unique_ptr<Proxy> proxy_for_testing); | 207 std::unique_ptr<Proxy> proxy_for_testing); |
224 void InitializePictureCacheForTesting(); | |
225 void SetTaskRunnerProviderForTesting( | 208 void SetTaskRunnerProviderForTesting( |
226 std::unique_ptr<TaskRunnerProvider> task_runner_provider); | 209 std::unique_ptr<TaskRunnerProvider> task_runner_provider); |
227 void SetUIResourceManagerForTesting( | 210 void SetUIResourceManagerForTesting( |
228 std::unique_ptr<UIResourceManager> ui_resource_manager); | 211 std::unique_ptr<UIResourceManager> ui_resource_manager); |
229 | 212 |
230 // task_graph_runner() returns a valid value only until the LayerTreeHostImpl | 213 // task_graph_runner() returns a valid value only until the LayerTreeHostImpl |
231 // is created in CreateLayerTreeHostImpl(). | 214 // is created in CreateLayerTreeHostImpl(). |
232 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } | 215 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } |
233 | 216 |
234 void OnCommitForSwapPromises(); | 217 void OnCommitForSwapPromises(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 281 |
299 int id_; | 282 int id_; |
300 bool next_commit_forces_redraw_ = false; | 283 bool next_commit_forces_redraw_ = false; |
301 bool next_commit_forces_recalculate_raster_scales_ = false; | 284 bool next_commit_forces_recalculate_raster_scales_ = false; |
302 // Track when we're inside a main frame to see if compositor is being | 285 // Track when we're inside a main frame to see if compositor is being |
303 // destroyed midway which causes a crash. crbug.com/654672 | 286 // destroyed midway which causes a crash. crbug.com/654672 |
304 bool inside_main_frame_ = false; | 287 bool inside_main_frame_ = false; |
305 | 288 |
306 TaskGraphRunner* task_graph_runner_; | 289 TaskGraphRunner* task_graph_runner_; |
307 | 290 |
308 ImageSerializationProcessor* image_serialization_processor_; | |
309 std::unique_ptr<EnginePictureCache> engine_picture_cache_; | |
310 std::unique_ptr<ClientPictureCache> client_picture_cache_; | |
311 | |
312 SurfaceSequenceGenerator surface_sequence_generator_; | 291 SurfaceSequenceGenerator surface_sequence_generator_; |
313 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; | 292 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
314 | 293 |
315 // The state that was expected to be reflected from the main thread during | 294 // The state that was expected to be reflected from the main thread during |
316 // BeginMainFrame, but could not be done. The client provides these deltas | 295 // BeginMainFrame, but could not be done. The client provides these deltas |
317 // to use during the commit instead of applying them at that point because | 296 // to use during the commit instead of applying them at that point because |
318 // its necessary for these deltas to be applied *after* PropertyTrees are | 297 // its necessary for these deltas to be applied *after* PropertyTrees are |
319 // built/updated on the main thread. | 298 // built/updated on the main thread. |
320 // TODO(khushalsagar): Investigate removing this after SPV2, since then we | 299 // TODO(khushalsagar): Investigate removing this after SPV2, since then we |
321 // should get these PropertyTrees directly from blink? | 300 // should get these PropertyTrees directly from blink? |
322 std::unique_ptr<ReflectedMainFrameState> reflected_main_frame_state_; | 301 std::unique_ptr<ReflectedMainFrameState> reflected_main_frame_state_; |
323 | 302 |
324 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner_; | 303 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner_; |
325 | 304 |
326 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostInProcess); | 305 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostInProcess); |
327 }; | 306 }; |
328 | 307 |
329 } // namespace cc | 308 } // namespace cc |
330 | 309 |
331 #endif // CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ | 310 #endif // CC_TREES_LAYER_TREE_HOST_IN_PROCESS_H_ |
OLD | NEW |