| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 bool IsSynchronousSingleThreaded() const; | 587 bool IsSynchronousSingleThreaded() const; |
| 581 | 588 |
| 582 Viewport* viewport() { return viewport_.get(); } | 589 Viewport* viewport() { return viewport_.get(); } |
| 583 | 590 |
| 584 // Scroll by preferring to move the outer viewport first, only moving the | 591 // Scroll by preferring to move the outer viewport first, only moving the |
| 585 // inner if the outer is at its scroll extents. | 592 // inner if the outer is at its scroll extents. |
| 586 void ScrollViewportBy(gfx::Vector2dF scroll_delta); | 593 void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
| 587 // Scroll by preferring to move the inner viewport first, only moving the | 594 // Scroll by preferring to move the inner viewport first, only moving the |
| 588 // outer if the inner is at its scroll extents. | 595 // outer if the inner is at its scroll extents. |
| 589 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); | 596 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); |
| 597 |
| 590 void AnimatePageScale(base::TimeTicks monotonic_time); | 598 void AnimatePageScale(base::TimeTicks monotonic_time); |
| 591 void AnimateScrollbars(base::TimeTicks monotonic_time); | 599 void AnimateScrollbars(base::TimeTicks monotonic_time); |
| 592 void AnimateTopControls(base::TimeTicks monotonic_time); | 600 void AnimateTopControls(base::TimeTicks monotonic_time); |
| 593 | 601 |
| 594 void TrackDamageForAllSurfaces( | 602 void TrackDamageForAllSurfaces( |
| 595 LayerImpl* root_draw_layer, | 603 LayerImpl* root_draw_layer, |
| 596 const LayerImplList& render_surface_layer_list); | 604 const LayerImplList& render_surface_layer_list); |
| 597 | 605 |
| 598 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); | 606 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 599 | 607 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 | 741 |
| 734 gfx::Rect viewport_damage_rect_; | 742 gfx::Rect viewport_damage_rect_; |
| 735 | 743 |
| 736 BeginFrameArgs current_begin_frame_args_; | 744 BeginFrameArgs current_begin_frame_args_; |
| 737 | 745 |
| 738 // Expected time between two begin impl frame calls. | 746 // Expected time between two begin impl frame calls. |
| 739 base::TimeDelta begin_impl_frame_interval_; | 747 base::TimeDelta begin_impl_frame_interval_; |
| 740 | 748 |
| 741 scoped_ptr<AnimationRegistrar> animation_registrar_; | 749 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 742 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; | 750 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; |
| 751 std::set<VideoFrameController*> video_frame_controllers_; |
| 743 | 752 |
| 744 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 753 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 745 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 754 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
| 746 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 755 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
| 747 | 756 |
| 748 // Optional callback to notify of new tree activations. | 757 // Optional callback to notify of new tree activations. |
| 749 base::Closure tree_activation_callback_; | 758 base::Closure tree_activation_callback_; |
| 750 | 759 |
| 751 SharedBitmapManager* shared_bitmap_manager_; | 760 SharedBitmapManager* shared_bitmap_manager_; |
| 752 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 761 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 753 TaskGraphRunner* task_graph_runner_; | 762 TaskGraphRunner* task_graph_runner_; |
| 754 int id_; | 763 int id_; |
| 755 | 764 |
| 756 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 765 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
| 757 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 766 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
| 758 | 767 |
| 759 bool requires_high_res_to_draw_; | 768 bool requires_high_res_to_draw_; |
| 760 bool is_likely_to_require_a_draw_; | 769 bool is_likely_to_require_a_draw_; |
| 761 | 770 |
| 762 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 771 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
| 763 | 772 |
| 764 scoped_ptr<Viewport> viewport_; | 773 scoped_ptr<Viewport> viewport_; |
| 765 | 774 |
| 766 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 775 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 767 }; | 776 }; |
| 768 | 777 |
| 769 } // namespace cc | 778 } // namespace cc |
| 770 | 779 |
| 771 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 780 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |