| 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_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <unordered_map> | 14 #include <unordered_map> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "cc/animation/layer_tree_mutator.h" | 20 #include "cc/animation/layer_tree_mutator.h" |
| 21 #include "cc/base/cc_export.h" | 21 #include "cc/base/cc_export.h" |
| 22 #include "cc/base/synced_property.h" | 22 #include "cc/base/synced_property.h" |
| 23 #include "cc/debug/micro_benchmark_controller_impl.h" | 23 #include "cc/debug/micro_benchmark_controller_impl.h" |
| 24 #include "cc/input/browser_controls_offset_manager_client.h" |
| 24 #include "cc/input/input_handler.h" | 25 #include "cc/input/input_handler.h" |
| 25 #include "cc/input/scrollbar_animation_controller.h" | 26 #include "cc/input/scrollbar_animation_controller.h" |
| 26 #include "cc/input/top_controls_manager_client.h" | |
| 27 #include "cc/layers/layer_collections.h" | 27 #include "cc/layers/layer_collections.h" |
| 28 #include "cc/layers/render_pass_sink.h" | 28 #include "cc/layers/render_pass_sink.h" |
| 29 #include "cc/output/begin_frame_args.h" | 29 #include "cc/output/begin_frame_args.h" |
| 30 #include "cc/output/compositor_frame_sink_client.h" | 30 #include "cc/output/compositor_frame_sink_client.h" |
| 31 #include "cc/output/context_cache_controller.h" | 31 #include "cc/output/context_cache_controller.h" |
| 32 #include "cc/output/managed_memory_policy.h" | 32 #include "cc/output/managed_memory_policy.h" |
| 33 #include "cc/quads/render_pass.h" | 33 #include "cc/quads/render_pass.h" |
| 34 #include "cc/resources/resource_provider.h" | 34 #include "cc/resources/resource_provider.h" |
| 35 #include "cc/resources/ui_resource_client.h" | 35 #include "cc/resources/ui_resource_client.h" |
| 36 #include "cc/scheduler/begin_frame_tracker.h" | 36 #include "cc/scheduler/begin_frame_tracker.h" |
| 37 #include "cc/scheduler/commit_earlyout_reason.h" | 37 #include "cc/scheduler/commit_earlyout_reason.h" |
| 38 #include "cc/scheduler/draw_result.h" | 38 #include "cc/scheduler/draw_result.h" |
| 39 #include "cc/scheduler/video_frame_controller.h" | 39 #include "cc/scheduler/video_frame_controller.h" |
| 40 #include "cc/tiles/image_decode_controller.h" | 40 #include "cc/tiles/image_decode_controller.h" |
| 41 #include "cc/tiles/tile_manager.h" | 41 #include "cc/tiles/tile_manager.h" |
| 42 #include "cc/trees/layer_tree_settings.h" | 42 #include "cc/trees/layer_tree_settings.h" |
| 43 #include "cc/trees/mutator_host_client.h" | 43 #include "cc/trees/mutator_host_client.h" |
| 44 #include "cc/trees/task_runner_provider.h" | 44 #include "cc/trees/task_runner_provider.h" |
| 45 #include "ui/gfx/geometry/rect.h" | 45 #include "ui/gfx/geometry/rect.h" |
| 46 | 46 |
| 47 namespace gfx { | 47 namespace gfx { |
| 48 class ScrollOffset; | 48 class ScrollOffset; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace cc { | 51 namespace cc { |
| 52 | 52 |
| 53 class AnimationEvents; | 53 class AnimationEvents; |
| 54 class AnimationHost; | 54 class AnimationHost; |
| 55 class BrowserControlsOffsetManager; |
| 55 class CompletionEvent; | 56 class CompletionEvent; |
| 56 class CompositorFrameMetadata; | 57 class CompositorFrameMetadata; |
| 57 class CompositorFrameSink; | 58 class CompositorFrameSink; |
| 58 class DebugRectHistory; | 59 class DebugRectHistory; |
| 59 class EvictionTilePriorityQueue; | 60 class EvictionTilePriorityQueue; |
| 60 class FrameRateCounter; | 61 class FrameRateCounter; |
| 61 class LayerImpl; | 62 class LayerImpl; |
| 62 class LayerTreeImpl; | 63 class LayerTreeImpl; |
| 63 class MemoryHistory; | 64 class MemoryHistory; |
| 64 class PageScaleAnimation; | 65 class PageScaleAnimation; |
| 65 class PendingTreeDurationHistogramTimer; | 66 class PendingTreeDurationHistogramTimer; |
| 66 class PictureLayerImpl; | 67 class PictureLayerImpl; |
| 67 class RasterTilePriorityQueue; | 68 class RasterTilePriorityQueue; |
| 68 class TileTaskManager; | 69 class TileTaskManager; |
| 69 class RasterBufferProvider; | 70 class RasterBufferProvider; |
| 70 class RenderPassDrawQuad; | 71 class RenderPassDrawQuad; |
| 71 class RenderingStatsInstrumentation; | 72 class RenderingStatsInstrumentation; |
| 72 class ResourcePool; | 73 class ResourcePool; |
| 73 class ScrollElasticityHelper; | 74 class ScrollElasticityHelper; |
| 74 class ScrollbarLayerImplBase; | 75 class ScrollbarLayerImplBase; |
| 75 class SwapPromise; | 76 class SwapPromise; |
| 76 class SwapPromiseMonitor; | 77 class SwapPromiseMonitor; |
| 77 class SynchronousTaskGraphRunner; | 78 class SynchronousTaskGraphRunner; |
| 78 class TaskGraphRunner; | 79 class TaskGraphRunner; |
| 79 class TextureMailboxDeleter; | 80 class TextureMailboxDeleter; |
| 80 class TopControlsManager; | |
| 81 class UIResourceBitmap; | 81 class UIResourceBitmap; |
| 82 class UIResourceRequest; | 82 class UIResourceRequest; |
| 83 struct ScrollAndScaleSet; | 83 struct ScrollAndScaleSet; |
| 84 class Viewport; | 84 class Viewport; |
| 85 | 85 |
| 86 using BeginFrameCallbackList = std::vector<base::Closure>; | 86 using BeginFrameCallbackList = std::vector<base::Closure>; |
| 87 | 87 |
| 88 enum class GpuRasterizationStatus { | 88 enum class GpuRasterizationStatus { |
| 89 ON, | 89 ON, |
| 90 ON_FORCED, | 90 ON_FORCED, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 protected: | 130 protected: |
| 131 virtual ~LayerTreeHostImplClient() {} | 131 virtual ~LayerTreeHostImplClient() {} |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 134 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| 135 // state. | 135 // state. |
| 136 class CC_EXPORT LayerTreeHostImpl | 136 class CC_EXPORT LayerTreeHostImpl |
| 137 : public InputHandler, | 137 : public InputHandler, |
| 138 public TileManagerClient, | 138 public TileManagerClient, |
| 139 public CompositorFrameSinkClient, | 139 public CompositorFrameSinkClient, |
| 140 public TopControlsManagerClient, | 140 public BrowserControlsOffsetManagerClient, |
| 141 public ScrollbarAnimationControllerClient, | 141 public ScrollbarAnimationControllerClient, |
| 142 public VideoFrameControllerClient, | 142 public VideoFrameControllerClient, |
| 143 public LayerTreeMutatorClient, | 143 public LayerTreeMutatorClient, |
| 144 public MutatorHostClient, | 144 public MutatorHostClient, |
| 145 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 145 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
| 146 public: | 146 public: |
| 147 static std::unique_ptr<LayerTreeHostImpl> Create( | 147 static std::unique_ptr<LayerTreeHostImpl> Create( |
| 148 const LayerTreeSettings& settings, | 148 const LayerTreeSettings& settings, |
| 149 LayerTreeHostImplClient* client, | 149 LayerTreeHostImplClient* client, |
| 150 TaskRunnerProvider* task_runner_provider, | 150 TaskRunnerProvider* task_runner_provider, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 EventListenerProperties GetEventListenerProperties( | 198 EventListenerProperties GetEventListenerProperties( |
| 199 EventListenerClass event_class) const override; | 199 EventListenerClass event_class) const override; |
| 200 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; | 200 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; |
| 201 std::unique_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 201 std::unique_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
| 202 ui::LatencyInfo* latency) override; | 202 ui::LatencyInfo* latency) override; |
| 203 ScrollElasticityHelper* CreateScrollElasticityHelper() override; | 203 ScrollElasticityHelper* CreateScrollElasticityHelper() override; |
| 204 bool GetScrollOffsetForLayer(int layer_id, | 204 bool GetScrollOffsetForLayer(int layer_id, |
| 205 gfx::ScrollOffset* offset) override; | 205 gfx::ScrollOffset* offset) override; |
| 206 bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) override; | 206 bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) override; |
| 207 | 207 |
| 208 // TopControlsManagerClient implementation. | 208 // BrowserControlsOffsetManagerClient implementation. |
| 209 float TopControlsHeight() const override; | 209 float TopControlsHeight() const override; |
| 210 float BottomControlsHeight() const override; | 210 float BottomControlsHeight() const override; |
| 211 void SetCurrentTopControlsShownRatio(float offset) override; | 211 void SetCurrentTopControlsShownRatio(float offset) override; |
| 212 float CurrentTopControlsShownRatio() const override; | 212 float CurrentTopControlsShownRatio() const override; |
| 213 void DidChangeTopControlsPosition() override; | 213 void DidChangeTopControlsPosition() override; |
| 214 bool HaveRootScrollLayer() const override; | 214 bool HaveRootScrollLayer() const override; |
| 215 | 215 |
| 216 void UpdateViewportContainerSizes(); | 216 void UpdateViewportContainerSizes(); |
| 217 | 217 |
| 218 void set_resourceless_software_draw_for_testing() { | 218 void set_resourceless_software_draw_for_testing() { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 std::unique_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); | 468 std::unique_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); |
| 469 | 469 |
| 470 void set_max_memory_needed_bytes(size_t bytes) { | 470 void set_max_memory_needed_bytes(size_t bytes) { |
| 471 max_memory_needed_bytes_ = bytes; | 471 max_memory_needed_bytes_ = bytes; |
| 472 } | 472 } |
| 473 | 473 |
| 474 FrameRateCounter* fps_counter() { return fps_counter_.get(); } | 474 FrameRateCounter* fps_counter() { return fps_counter_.get(); } |
| 475 MemoryHistory* memory_history() { return memory_history_.get(); } | 475 MemoryHistory* memory_history() { return memory_history_.get(); } |
| 476 DebugRectHistory* debug_rect_history() { return debug_rect_history_.get(); } | 476 DebugRectHistory* debug_rect_history() { return debug_rect_history_.get(); } |
| 477 ResourceProvider* resource_provider() { return resource_provider_.get(); } | 477 ResourceProvider* resource_provider() { return resource_provider_.get(); } |
| 478 TopControlsManager* top_controls_manager() { | 478 BrowserControlsOffsetManager* top_controls_manager() { |
| 479 return top_controls_manager_.get(); | 479 return browser_controls_offset_manager_.get(); |
| 480 } | 480 } |
| 481 const GlobalStateThatImpactsTilePriority& global_tile_state() { | 481 const GlobalStateThatImpactsTilePriority& global_tile_state() { |
| 482 return global_tile_state_; | 482 return global_tile_state_; |
| 483 } | 483 } |
| 484 | 484 |
| 485 TaskRunnerProvider* task_runner_provider() const { | 485 TaskRunnerProvider* task_runner_provider() const { |
| 486 return task_runner_provider_; | 486 return task_runner_provider_; |
| 487 } | 487 } |
| 488 | 488 |
| 489 AnimationHost* animation_host() const { return animation_host_.get(); } | 489 AnimationHost* animation_host() const { return animation_host_.get(); } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 ManagedMemoryPolicy cached_managed_memory_policy_; | 766 ManagedMemoryPolicy cached_managed_memory_policy_; |
| 767 | 767 |
| 768 const bool is_synchronous_single_threaded_; | 768 const bool is_synchronous_single_threaded_; |
| 769 TileManager tile_manager_; | 769 TileManager tile_manager_; |
| 770 | 770 |
| 771 gfx::Vector2dF accumulated_root_overscroll_; | 771 gfx::Vector2dF accumulated_root_overscroll_; |
| 772 | 772 |
| 773 bool pinch_gesture_active_; | 773 bool pinch_gesture_active_; |
| 774 bool pinch_gesture_end_should_clear_scrolling_layer_; | 774 bool pinch_gesture_end_should_clear_scrolling_layer_; |
| 775 | 775 |
| 776 std::unique_ptr<TopControlsManager> top_controls_manager_; | 776 std::unique_ptr<BrowserControlsOffsetManager> |
| 777 browser_controls_offset_manager_; |
| 777 | 778 |
| 778 std::unique_ptr<PageScaleAnimation> page_scale_animation_; | 779 std::unique_ptr<PageScaleAnimation> page_scale_animation_; |
| 779 | 780 |
| 780 std::unique_ptr<FrameRateCounter> fps_counter_; | 781 std::unique_ptr<FrameRateCounter> fps_counter_; |
| 781 std::unique_ptr<MemoryHistory> memory_history_; | 782 std::unique_ptr<MemoryHistory> memory_history_; |
| 782 std::unique_ptr<DebugRectHistory> debug_rect_history_; | 783 std::unique_ptr<DebugRectHistory> debug_rect_history_; |
| 783 | 784 |
| 784 // The maximum memory that would be used by the prioritized resource | 785 // The maximum memory that would be used by the prioritized resource |
| 785 // manager, if there were no limit on memory usage. | 786 // manager, if there were no limit on memory usage. |
| 786 size_t max_memory_needed_bytes_; | 787 size_t max_memory_needed_bytes_; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 841 |
| 841 std::unique_ptr<PendingTreeDurationHistogramTimer> | 842 std::unique_ptr<PendingTreeDurationHistogramTimer> |
| 842 pending_tree_duration_timer_; | 843 pending_tree_duration_timer_; |
| 843 | 844 |
| 844 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 845 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 845 }; | 846 }; |
| 846 | 847 |
| 847 } // namespace cc | 848 } // namespace cc |
| 848 | 849 |
| 849 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 850 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |