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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 class ResourceProvider; | 65 class ResourceProvider; |
66 class ResourceUpdateQueue; | 66 class ResourceUpdateQueue; |
67 class SharedBitmapManager; | 67 class SharedBitmapManager; |
68 class TaskGraphRunner; | 68 class TaskGraphRunner; |
69 class TopControlsManager; | 69 class TopControlsManager; |
70 class UIResourceRequest; | 70 class UIResourceRequest; |
71 struct PendingPageScaleAnimation; | 71 struct PendingPageScaleAnimation; |
72 struct RenderingStats; | 72 struct RenderingStats; |
73 struct ScrollAndScaleSet; | 73 struct ScrollAndScaleSet; |
74 | 74 |
| 75 namespace proto { |
| 76 class LayerTreeHost; |
| 77 } |
| 78 |
75 class CC_EXPORT LayerTreeHost : public MutatorHostClient { | 79 class CC_EXPORT LayerTreeHost : public MutatorHostClient { |
76 public: | 80 public: |
77 // TODO(sad): InitParams should be a movable type so that it can be | 81 // TODO(sad): InitParams should be a movable type so that it can be |
78 // std::move()d to the Create* functions. | 82 // std::move()d to the Create* functions. |
79 struct CC_EXPORT InitParams { | 83 struct CC_EXPORT InitParams { |
80 LayerTreeHostClient* client = nullptr; | 84 LayerTreeHostClient* client = nullptr; |
81 SharedBitmapManager* shared_bitmap_manager = nullptr; | 85 SharedBitmapManager* shared_bitmap_manager = nullptr; |
82 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; | 86 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = nullptr; |
83 TaskGraphRunner* task_graph_runner = nullptr; | 87 TaskGraphRunner* task_graph_runner = nullptr; |
84 LayerTreeSettings const* settings = nullptr; | 88 LayerTreeSettings const* settings = nullptr; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 bool HasOnlyTranslationTransforms(const Layer* layer) const; | 363 bool HasOnlyTranslationTransforms(const Layer* layer) const; |
360 bool MaximumTargetScale(const Layer* layer, float* max_scale) const; | 364 bool MaximumTargetScale(const Layer* layer, float* max_scale) const; |
361 bool AnimationStartScale(const Layer* layer, float* start_scale) const; | 365 bool AnimationStartScale(const Layer* layer, float* start_scale) const; |
362 bool HasAnyAnimationTargetingProperty( | 366 bool HasAnyAnimationTargetingProperty( |
363 const Layer* layer, | 367 const Layer* layer, |
364 Animation::TargetProperty property) const; | 368 Animation::TargetProperty property) const; |
365 bool AnimationsPreserveAxisAlignment(const Layer* layer) const; | 369 bool AnimationsPreserveAxisAlignment(const Layer* layer) const; |
366 bool HasAnyAnimation(const Layer* layer) const; | 370 bool HasAnyAnimation(const Layer* layer) const; |
367 bool HasActiveAnimation(const Layer* layer) const; | 371 bool HasActiveAnimation(const Layer* layer) const; |
368 | 372 |
| 373 // Serializes the parts of this LayerTreeHost that is needed for a commit to a |
| 374 // protobuf message. Not all members are serialized as they are not helpful |
| 375 // for remote usage. |
| 376 void ToProtobufForCommit(proto::LayerTreeHost* proto) const; |
| 377 |
| 378 // Deserializes the protobuf into this LayerTreeHost before a commit. The |
| 379 // expected input is a serialized remote LayerTreeHost. After deserializing |
| 380 // the protobuf, the normal commit-flow should continue. |
| 381 void FromProtobufForCommit(const proto::LayerTreeHost& proto); |
| 382 |
369 protected: | 383 protected: |
370 LayerTreeHost(InitParams* params, CompositorMode mode); | 384 LayerTreeHost(InitParams* params, CompositorMode mode); |
371 void InitializeThreaded( | 385 void InitializeThreaded( |
372 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 386 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
373 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 387 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
374 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 388 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
375 void InitializeSingleThreaded( | 389 void InitializeSingleThreaded( |
376 LayerTreeHostSingleThreadClient* single_thread_client, | 390 LayerTreeHostSingleThreadClient* single_thread_client, |
377 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 391 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
378 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 392 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
(...skipping 18 matching lines...) Expand all Loading... |
397 } | 411 } |
398 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } | 412 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } |
399 | 413 |
400 MicroBenchmarkController micro_benchmark_controller_; | 414 MicroBenchmarkController micro_benchmark_controller_; |
401 | 415 |
402 void OnCommitForSwapPromises(); | 416 void OnCommitForSwapPromises(); |
403 | 417 |
404 void RecordGpuRasterizationHistogram(); | 418 void RecordGpuRasterizationHistogram(); |
405 | 419 |
406 private: | 420 private: |
| 421 friend class LayerTreeHostSerializationTest; |
| 422 |
407 void InitializeProxy( | 423 void InitializeProxy( |
408 scoped_ptr<Proxy> proxy, | 424 scoped_ptr<Proxy> proxy, |
409 scoped_ptr<BeginFrameSource> external_begin_frame_source); | 425 scoped_ptr<BeginFrameSource> external_begin_frame_source); |
410 | 426 |
411 bool DoUpdateLayers(Layer* root_layer); | 427 bool DoUpdateLayers(Layer* root_layer); |
412 void UpdateHudLayer(); | 428 void UpdateHudLayer(); |
413 | 429 |
414 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 430 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
415 | 431 |
416 bool IsSingleThreaded() const; | 432 bool IsSingleThreaded() const; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 536 |
521 uint32_t surface_id_namespace_; | 537 uint32_t surface_id_namespace_; |
522 uint32_t next_surface_sequence_; | 538 uint32_t next_surface_sequence_; |
523 | 539 |
524 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 540 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
525 }; | 541 }; |
526 | 542 |
527 } // namespace cc | 543 } // namespace cc |
528 | 544 |
529 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 545 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |