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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
29 #include "cc/output/managed_memory_policy.h" | 29 #include "cc/output/managed_memory_policy.h" |
30 #include "cc/output/output_surface_client.h" | 30 #include "cc/output/output_surface_client.h" |
31 #include "cc/output/renderer.h" | 31 #include "cc/output/renderer.h" |
32 #include "cc/quads/render_pass.h" | 32 #include "cc/quads/render_pass.h" |
33 #include "cc/resources/resource_provider.h" | 33 #include "cc/resources/resource_provider.h" |
34 #include "cc/resources/tile_manager.h" | 34 #include "cc/resources/tile_manager.h" |
35 #include "cc/resources/ui_resource_client.h" | 35 #include "cc/resources/ui_resource_client.h" |
36 #include "cc/scheduler/commit_earlyout_reason.h" | 36 #include "cc/scheduler/commit_earlyout_reason.h" |
37 #include "cc/scheduler/draw_result.h" | 37 #include "cc/scheduler/draw_result.h" |
| 38 #include "cc/scheduler/video_frame_controller.h" |
38 #include "cc/trees/layer_tree_settings.h" | 39 #include "cc/trees/layer_tree_settings.h" |
39 #include "cc/trees/proxy.h" | 40 #include "cc/trees/proxy.h" |
40 #include "skia/ext/refptr.h" | 41 #include "skia/ext/refptr.h" |
41 #include "third_party/skia/include/core/SkColor.h" | 42 #include "third_party/skia/include/core/SkColor.h" |
42 #include "ui/gfx/geometry/rect.h" | 43 #include "ui/gfx/geometry/rect.h" |
43 | 44 |
44 namespace gfx { | 45 namespace gfx { |
45 class ScrollOffset; | 46 class ScrollOffset; |
46 } | 47 } |
47 | 48 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 virtual void NotifyReadyToActivate() = 0; | 98 virtual void NotifyReadyToActivate() = 0; |
98 virtual void NotifyReadyToDraw() = 0; | 99 virtual void NotifyReadyToDraw() = 0; |
99 // Please call these 3 functions through | 100 // Please call these 3 functions through |
100 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 101 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
101 // SetNeedsAnimate(). | 102 // SetNeedsAnimate(). |
102 virtual void SetNeedsRedrawOnImplThread() = 0; | 103 virtual void SetNeedsRedrawOnImplThread() = 0; |
103 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 104 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
104 virtual void SetNeedsAnimateOnImplThread() = 0; | 105 virtual void SetNeedsAnimateOnImplThread() = 0; |
105 virtual void SetNeedsCommitOnImplThread() = 0; | 106 virtual void SetNeedsCommitOnImplThread() = 0; |
106 virtual void SetNeedsPrepareTilesOnImplThread() = 0; | 107 virtual void SetNeedsPrepareTilesOnImplThread() = 0; |
| 108 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; |
107 virtual void PostAnimationEventsToMainThreadOnImplThread( | 109 virtual void PostAnimationEventsToMainThreadOnImplThread( |
108 scoped_ptr<AnimationEventsVector> events) = 0; | 110 scoped_ptr<AnimationEventsVector> events) = 0; |
109 // Returns true if resources were deleted by this call. | 111 // Returns true if resources were deleted by this call. |
110 virtual bool ReduceContentsTextureMemoryOnImplThread( | 112 virtual bool ReduceContentsTextureMemoryOnImplThread( |
111 size_t limit_bytes, | 113 size_t limit_bytes, |
112 int priority_cutoff) = 0; | 114 int priority_cutoff) = 0; |
113 virtual bool IsInsideDraw() = 0; | 115 virtual bool IsInsideDraw() = 0; |
114 virtual void RenewTreePriority() = 0; | 116 virtual void RenewTreePriority() = 0; |
115 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 117 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
116 base::TimeDelta delay) = 0; | 118 base::TimeDelta delay) = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
129 | 131 |
130 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 132 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
131 // state. | 133 // state. |
132 class CC_EXPORT LayerTreeHostImpl | 134 class CC_EXPORT LayerTreeHostImpl |
133 : public InputHandler, | 135 : public InputHandler, |
134 public RendererClient, | 136 public RendererClient, |
135 public TileManagerClient, | 137 public TileManagerClient, |
136 public OutputSurfaceClient, | 138 public OutputSurfaceClient, |
137 public TopControlsManagerClient, | 139 public TopControlsManagerClient, |
138 public ScrollbarAnimationControllerClient, | 140 public ScrollbarAnimationControllerClient, |
| 141 public VideoFrameControllerClient, |
139 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 142 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
140 public: | 143 public: |
141 static scoped_ptr<LayerTreeHostImpl> Create( | 144 static scoped_ptr<LayerTreeHostImpl> Create( |
142 const LayerTreeSettings& settings, | 145 const LayerTreeSettings& settings, |
143 LayerTreeHostImplClient* client, | 146 LayerTreeHostImplClient* client, |
144 Proxy* proxy, | 147 Proxy* proxy, |
145 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 148 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
146 SharedBitmapManager* shared_bitmap_manager, | 149 SharedBitmapManager* shared_bitmap_manager, |
147 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 150 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
148 TaskGraphRunner* task_graph_runner, | 151 TaskGraphRunner* task_graph_runner, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 274 |
272 // ScrollbarAnimationControllerClient implementation. | 275 // ScrollbarAnimationControllerClient implementation. |
273 void StartAnimatingScrollbarAnimationController( | 276 void StartAnimatingScrollbarAnimationController( |
274 ScrollbarAnimationController* controller) override; | 277 ScrollbarAnimationController* controller) override; |
275 void StopAnimatingScrollbarAnimationController( | 278 void StopAnimatingScrollbarAnimationController( |
276 ScrollbarAnimationController* controller) override; | 279 ScrollbarAnimationController* controller) override; |
277 void PostDelayedScrollbarAnimationTask(const base::Closure& task, | 280 void PostDelayedScrollbarAnimationTask(const base::Closure& task, |
278 base::TimeDelta delay) override; | 281 base::TimeDelta delay) override; |
279 void SetNeedsRedrawForScrollbarAnimation() override; | 282 void SetNeedsRedrawForScrollbarAnimation() override; |
280 | 283 |
| 284 // VideoBeginFrameSource implementation. |
| 285 void AddVideoFrameController(VideoFrameController* controller) override; |
| 286 void RemoveVideoFrameController(VideoFrameController* controller) override; |
| 287 |
281 // OutputSurfaceClient implementation. | 288 // OutputSurfaceClient implementation. |
282 void CommitVSyncParameters(base::TimeTicks timebase, | 289 void CommitVSyncParameters(base::TimeTicks timebase, |
283 base::TimeDelta interval) override; | 290 base::TimeDelta interval) override; |
284 void SetNeedsRedrawRect(const gfx::Rect& rect) override; | 291 void SetNeedsRedrawRect(const gfx::Rect& rect) override; |
285 void SetExternalDrawConstraints( | 292 void SetExternalDrawConstraints( |
286 const gfx::Transform& transform, | 293 const gfx::Transform& transform, |
287 const gfx::Rect& viewport, | 294 const gfx::Rect& viewport, |
288 const gfx::Rect& clip, | 295 const gfx::Rect& clip, |
289 const gfx::Rect& viewport_rect_for_tile_priority, | 296 const gfx::Rect& viewport_rect_for_tile_priority, |
290 const gfx::Transform& transform_for_tile_priority, | 297 const gfx::Transform& transform_for_tile_priority, |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 bool IsSynchronousSingleThreaded() const; | 573 bool IsSynchronousSingleThreaded() const; |
567 | 574 |
568 Viewport* viewport() { return viewport_.get(); } | 575 Viewport* viewport() { return viewport_.get(); } |
569 | 576 |
570 // Scroll by preferring to move the outer viewport first, only moving the | 577 // Scroll by preferring to move the outer viewport first, only moving the |
571 // inner if the outer is at its scroll extents. | 578 // inner if the outer is at its scroll extents. |
572 void ScrollViewportBy(gfx::Vector2dF scroll_delta); | 579 void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
573 // Scroll by preferring to move the inner viewport first, only moving the | 580 // Scroll by preferring to move the inner viewport first, only moving the |
574 // outer if the inner is at its scroll extents. | 581 // outer if the inner is at its scroll extents. |
575 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); | 582 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); |
| 583 |
576 void AnimatePageScale(base::TimeTicks monotonic_time); | 584 void AnimatePageScale(base::TimeTicks monotonic_time); |
577 void AnimateScrollbars(base::TimeTicks monotonic_time); | 585 void AnimateScrollbars(base::TimeTicks monotonic_time); |
578 void AnimateTopControls(base::TimeTicks monotonic_time); | 586 void AnimateTopControls(base::TimeTicks monotonic_time); |
579 | 587 |
580 void TrackDamageForAllSurfaces( | 588 void TrackDamageForAllSurfaces( |
581 LayerImpl* root_draw_layer, | 589 LayerImpl* root_draw_layer, |
582 const LayerImplList& render_surface_layer_list); | 590 const LayerImplList& render_surface_layer_list); |
583 | 591 |
584 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); | 592 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); |
585 | 593 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 | 727 |
720 gfx::Rect viewport_damage_rect_; | 728 gfx::Rect viewport_damage_rect_; |
721 | 729 |
722 BeginFrameArgs current_begin_frame_args_; | 730 BeginFrameArgs current_begin_frame_args_; |
723 | 731 |
724 // Expected time between two begin impl frame calls. | 732 // Expected time between two begin impl frame calls. |
725 base::TimeDelta begin_impl_frame_interval_; | 733 base::TimeDelta begin_impl_frame_interval_; |
726 | 734 |
727 scoped_ptr<AnimationRegistrar> animation_registrar_; | 735 scoped_ptr<AnimationRegistrar> animation_registrar_; |
728 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; | 736 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; |
| 737 std::set<VideoFrameController*> video_frame_controllers_; |
729 | 738 |
730 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 739 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
731 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 740 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
732 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 741 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
733 | 742 |
734 // Optional callback to notify of new tree activations. | 743 // Optional callback to notify of new tree activations. |
735 base::Closure tree_activation_callback_; | 744 base::Closure tree_activation_callback_; |
736 | 745 |
737 SharedBitmapManager* shared_bitmap_manager_; | 746 SharedBitmapManager* shared_bitmap_manager_; |
738 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 747 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
739 TaskGraphRunner* task_graph_runner_; | 748 TaskGraphRunner* task_graph_runner_; |
740 int id_; | 749 int id_; |
741 | 750 |
742 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 751 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
743 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 752 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
744 | 753 |
745 bool requires_high_res_to_draw_; | 754 bool requires_high_res_to_draw_; |
746 bool is_likely_to_require_a_draw_; | 755 bool is_likely_to_require_a_draw_; |
747 | 756 |
748 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 757 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
749 | 758 |
750 scoped_ptr<Viewport> viewport_; | 759 scoped_ptr<Viewport> viewport_; |
751 | 760 |
752 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 761 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
753 }; | 762 }; |
754 | 763 |
755 } // namespace cc | 764 } // namespace cc |
756 | 765 |
757 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 766 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |