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 |
11 #include <limits> | 11 #include <limits> |
12 #include <memory> | 12 #include <memory> |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <unordered_map> | 15 #include <unordered_map> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/cancelable_callback.h" | 18 #include "base/cancelable_callback.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
23 #include "cc/animation/target_property.h" | 23 #include "cc/animation/target_property.h" |
24 #include "cc/base/cc_export.h" | 24 #include "cc/base/cc_export.h" |
| 25 #include "cc/blimp/client_picture_cache.h" |
| 26 #include "cc/blimp/engine_picture_cache.h" |
25 #include "cc/debug/micro_benchmark.h" | 27 #include "cc/debug/micro_benchmark.h" |
26 #include "cc/debug/micro_benchmark_controller.h" | 28 #include "cc/debug/micro_benchmark_controller.h" |
27 #include "cc/input/event_listener_properties.h" | 29 #include "cc/input/event_listener_properties.h" |
28 #include "cc/input/input_handler.h" | 30 #include "cc/input/input_handler.h" |
29 #include "cc/input/layer_selection_bound.h" | 31 #include "cc/input/layer_selection_bound.h" |
30 #include "cc/input/scrollbar.h" | 32 #include "cc/input/scrollbar.h" |
31 #include "cc/input/top_controls_state.h" | 33 #include "cc/input/top_controls_state.h" |
32 #include "cc/layers/layer_collections.h" | 34 #include "cc/layers/layer_collections.h" |
33 #include "cc/layers/layer_list_iterator.h" | 35 #include "cc/layers/layer_list_iterator.h" |
34 #include "cc/output/output_surface.h" | 36 #include "cc/output/output_surface.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 bool IsSingleThreaded() const; | 421 bool IsSingleThreaded() const; |
420 bool IsThreaded() const; | 422 bool IsThreaded() const; |
421 bool IsRemoteServer() const; | 423 bool IsRemoteServer() const; |
422 bool IsRemoteClient() const; | 424 bool IsRemoteClient() const; |
423 void BuildPropertyTreesForTesting(); | 425 void BuildPropertyTreesForTesting(); |
424 | 426 |
425 ImageSerializationProcessor* image_serialization_processor() const { | 427 ImageSerializationProcessor* image_serialization_processor() const { |
426 return image_serialization_processor_; | 428 return image_serialization_processor_; |
427 } | 429 } |
428 | 430 |
| 431 EnginePictureCache* engine_picture_cache() const { |
| 432 return engine_picture_cache_ ? engine_picture_cache_.get() : nullptr; |
| 433 } |
| 434 |
| 435 ClientPictureCache* client_picture_cache() const { |
| 436 return client_picture_cache_ ? client_picture_cache_.get() : nullptr; |
| 437 } |
| 438 |
429 protected: | 439 protected: |
430 LayerTreeHost(InitParams* params, CompositorMode mode); | 440 LayerTreeHost(InitParams* params, CompositorMode mode); |
431 void InitializeThreaded( | 441 void InitializeThreaded( |
432 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 442 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
433 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 443 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
434 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 444 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
435 void InitializeSingleThreaded( | 445 void InitializeSingleThreaded( |
436 LayerTreeHostSingleThreadClient* single_thread_client, | 446 LayerTreeHostSingleThreadClient* single_thread_client, |
437 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 447 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
438 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 448 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
439 void InitializeRemoteServer( | 449 void InitializeRemoteServer( |
440 RemoteProtoChannel* remote_proto_channel, | 450 RemoteProtoChannel* remote_proto_channel, |
441 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 451 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
442 void InitializeRemoteClient( | 452 void InitializeRemoteClient( |
443 RemoteProtoChannel* remote_proto_channel, | 453 RemoteProtoChannel* remote_proto_channel, |
444 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 454 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
445 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 455 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
446 void InitializeForTesting( | 456 void InitializeForTesting( |
447 std::unique_ptr<TaskRunnerProvider> task_runner_provider, | 457 std::unique_ptr<TaskRunnerProvider> task_runner_provider, |
448 std::unique_ptr<Proxy> proxy_for_testing, | 458 std::unique_ptr<Proxy> proxy_for_testing, |
449 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 459 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
| 460 void InitializePictureCacheForTesting(); |
450 void SetOutputSurfaceLostForTesting(bool is_lost) { | 461 void SetOutputSurfaceLostForTesting(bool is_lost) { |
451 output_surface_lost_ = is_lost; | 462 output_surface_lost_ = is_lost; |
452 } | 463 } |
453 void SetTaskRunnerProviderForTesting( | 464 void SetTaskRunnerProviderForTesting( |
454 std::unique_ptr<TaskRunnerProvider> task_runner_provider); | 465 std::unique_ptr<TaskRunnerProvider> task_runner_provider); |
455 | 466 |
456 // shared_bitmap_manager(), gpu_memory_buffer_manager(), and | 467 // shared_bitmap_manager(), gpu_memory_buffer_manager(), and |
457 // task_graph_runner() return valid values only until the LayerTreeHostImpl is | 468 // task_graph_runner() return valid values only until the LayerTreeHostImpl is |
458 // created in CreateLayerTreeHostImpl(). | 469 // created in CreateLayerTreeHostImpl(). |
459 SharedBitmapManager* shared_bitmap_manager() const { | 470 SharedBitmapManager* shared_bitmap_manager() const { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 scoped_refptr<Layer> inner_viewport_scroll_layer_; | 584 scoped_refptr<Layer> inner_viewport_scroll_layer_; |
574 scoped_refptr<Layer> outer_viewport_scroll_layer_; | 585 scoped_refptr<Layer> outer_viewport_scroll_layer_; |
575 | 586 |
576 LayerSelection selection_; | 587 LayerSelection selection_; |
577 | 588 |
578 SharedBitmapManager* shared_bitmap_manager_; | 589 SharedBitmapManager* shared_bitmap_manager_; |
579 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 590 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
580 TaskGraphRunner* task_graph_runner_; | 591 TaskGraphRunner* task_graph_runner_; |
581 | 592 |
582 ImageSerializationProcessor* image_serialization_processor_; | 593 ImageSerializationProcessor* image_serialization_processor_; |
| 594 std::unique_ptr<EnginePictureCache> engine_picture_cache_; |
| 595 std::unique_ptr<ClientPictureCache> client_picture_cache_; |
583 | 596 |
584 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; | 597 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; |
585 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 598 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
586 | 599 |
587 PropertyTrees property_trees_; | 600 PropertyTrees property_trees_; |
588 | 601 |
589 using LayerIdMap = std::unordered_map<int, Layer*>; | 602 using LayerIdMap = std::unordered_map<int, Layer*>; |
590 LayerIdMap layer_id_map_; | 603 LayerIdMap layer_id_map_; |
591 // Set of layers that need to push properties. | 604 // Set of layers that need to push properties. |
592 std::unordered_set<Layer*> layers_that_should_push_properties_; | 605 std::unordered_set<Layer*> layers_that_should_push_properties_; |
593 | 606 |
594 uint32_t surface_id_namespace_; | 607 uint32_t surface_id_namespace_; |
595 uint32_t next_surface_sequence_; | 608 uint32_t next_surface_sequence_; |
596 | 609 |
597 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 610 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
598 }; | 611 }; |
599 | 612 |
600 } // namespace cc | 613 } // namespace cc |
601 | 614 |
602 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 615 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |