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/rasterizer.h" | 33 #include "cc/resources/rasterizer.h" |
34 #include "cc/resources/resource_provider.h" | 34 #include "cc/resources/resource_provider.h" |
35 #include "cc/resources/tile_manager.h" | 35 #include "cc/resources/tile_manager.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/trees/layer_tree_mutators_client.h" |
38 #include "skia/ext/refptr.h" | 39 #include "skia/ext/refptr.h" |
39 #include "third_party/skia/include/core/SkColor.h" | 40 #include "third_party/skia/include/core/SkColor.h" |
40 #include "ui/gfx/geometry/rect.h" | 41 #include "ui/gfx/geometry/rect.h" |
41 | 42 |
42 namespace gfx { | 43 namespace gfx { |
43 class ScrollOffset; | 44 class ScrollOffset; |
44 } | 45 } |
45 | 46 |
46 namespace cc { | 47 namespace cc { |
47 | 48 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 122 |
122 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 123 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
123 // state. | 124 // state. |
124 class CC_EXPORT LayerTreeHostImpl | 125 class CC_EXPORT LayerTreeHostImpl |
125 : public InputHandler, | 126 : public InputHandler, |
126 public RendererClient, | 127 public RendererClient, |
127 public TileManagerClient, | 128 public TileManagerClient, |
128 public OutputSurfaceClient, | 129 public OutputSurfaceClient, |
129 public TopControlsManagerClient, | 130 public TopControlsManagerClient, |
130 public ScrollbarAnimationControllerClient, | 131 public ScrollbarAnimationControllerClient, |
131 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 132 public base::SupportsWeakPtr<LayerTreeHostImpl>, |
| 133 public LayerTreeMutatorsClient { |
132 public: | 134 public: |
133 static scoped_ptr<LayerTreeHostImpl> Create( | 135 static scoped_ptr<LayerTreeHostImpl> Create( |
134 const LayerTreeSettings& settings, | 136 const LayerTreeSettings& settings, |
135 LayerTreeHostImplClient* client, | 137 LayerTreeHostImplClient* client, |
136 Proxy* proxy, | 138 Proxy* proxy, |
137 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 139 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
138 SharedBitmapManager* shared_bitmap_manager, | 140 SharedBitmapManager* shared_bitmap_manager, |
139 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 141 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
140 int id); | 142 int id); |
141 ~LayerTreeHostImpl() override; | 143 ~LayerTreeHostImpl() override; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); | 208 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); |
207 virtual void BeginCommit(); | 209 virtual void BeginCommit(); |
208 virtual void CommitComplete(); | 210 virtual void CommitComplete(); |
209 virtual void Animate(base::TimeTicks monotonic_time); | 211 virtual void Animate(base::TimeTicks monotonic_time); |
210 virtual void UpdateAnimationState(bool start_ready_animations); | 212 virtual void UpdateAnimationState(bool start_ready_animations); |
211 void ActivateAnimations(); | 213 void ActivateAnimations(); |
212 void MainThreadHasStoppedFlinging(); | 214 void MainThreadHasStoppedFlinging(); |
213 void DidAnimateScrollOffset(); | 215 void DidAnimateScrollOffset(); |
214 void SetViewportDamage(const gfx::Rect& damage_rect); | 216 void SetViewportDamage(const gfx::Rect& damage_rect); |
215 | 217 |
| 218 void SetAnimationTimeline(scoped_refptr<AnimationTimeline> timeline); |
| 219 |
| 220 void SetTreeLayerFilterMutated(int layer_id, |
| 221 LayerTreeImpl* tree, |
| 222 const FilterOperations& filters); |
| 223 void SetTreeLayerOpacityMutated(int layer_id, |
| 224 LayerTreeImpl* tree, |
| 225 float opacity); |
| 226 void SetTreeLayerTransformMutated(int layer_id, |
| 227 LayerTreeImpl* tree, |
| 228 const gfx::Transform& transform); |
| 229 |
| 230 // LayerTreeMutatorsClient implementation. |
| 231 AnimationRegistrar* GetAnimationRegistrar() const override; |
| 232 bool IsLayerInActiveTree(int layer_id) const override; |
| 233 bool IsLayerInPendingTree(int layer_id) const override; |
| 234 void SetMutatorsNeedCommit() override; |
| 235 void SetLayerFilterMutated(int layer_id, |
| 236 bool affects_active_tree, |
| 237 const FilterOperations& filters) override; |
| 238 void SetLayerOpacityMutated(int layer_id, |
| 239 bool affects_active_tree, |
| 240 float opacity) override; |
| 241 void SetLayerTransformMutated(int layer_id, |
| 242 bool affects_active_tree, |
| 243 const gfx::Transform& transform) override; |
| 244 |
216 virtual void PrepareTiles(); | 245 virtual void PrepareTiles(); |
217 | 246 |
218 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we | 247 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we |
219 // should try to avoid displaying the frame. If PrepareToDraw is called, | 248 // should try to avoid displaying the frame. If PrepareToDraw is called, |
220 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is | 249 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is |
221 // called between the two. | 250 // called between the two. |
222 virtual DrawResult PrepareToDraw(FrameData* frame); | 251 virtual DrawResult PrepareToDraw(FrameData* frame); |
223 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); | 252 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); |
224 // Must be called if and only if PrepareToDraw was called. | 253 // Must be called if and only if PrepareToDraw was called. |
225 void DidDrawAllLayers(const FrameData& frame); | 254 void DidDrawAllLayers(const FrameData& frame); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 437 } |
409 const GlobalStateThatImpactsTilePriority& global_tile_state() { | 438 const GlobalStateThatImpactsTilePriority& global_tile_state() { |
410 return global_tile_state_; | 439 return global_tile_state_; |
411 } | 440 } |
412 | 441 |
413 Proxy* proxy() const { return proxy_; } | 442 Proxy* proxy() const { return proxy_; } |
414 | 443 |
415 AnimationRegistrar* animation_registrar() const { | 444 AnimationRegistrar* animation_registrar() const { |
416 return animation_registrar_.get(); | 445 return animation_registrar_.get(); |
417 } | 446 } |
| 447 AnimationTimeline* animation_timeline() const { |
| 448 return animation_timeline_.get(); |
| 449 } |
418 | 450 |
419 void SetDebugState(const LayerTreeDebugState& new_debug_state); | 451 void SetDebugState(const LayerTreeDebugState& new_debug_state); |
420 const LayerTreeDebugState& debug_state() const { return debug_state_; } | 452 const LayerTreeDebugState& debug_state() const { return debug_state_; } |
421 | 453 |
422 class CC_EXPORT CullRenderPassesWithNoQuads { | 454 class CC_EXPORT CullRenderPassesWithNoQuads { |
423 public: | 455 public: |
424 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad, | 456 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad, |
425 const FrameData& frame) const; | 457 const FrameData& frame) const; |
426 | 458 |
427 // Iterates in draw order, so that when a surface is removed, and its | 459 // Iterates in draw order, so that when a surface is removed, and its |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 bool resourceless_software_draw_; | 743 bool resourceless_software_draw_; |
712 | 744 |
713 gfx::Rect viewport_damage_rect_; | 745 gfx::Rect viewport_damage_rect_; |
714 | 746 |
715 BeginFrameArgs current_begin_frame_args_; | 747 BeginFrameArgs current_begin_frame_args_; |
716 | 748 |
717 // Expected time between two begin impl frame calls. | 749 // Expected time between two begin impl frame calls. |
718 base::TimeDelta begin_impl_frame_interval_; | 750 base::TimeDelta begin_impl_frame_interval_; |
719 | 751 |
720 scoped_ptr<AnimationRegistrar> animation_registrar_; | 752 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 753 scoped_refptr<AnimationTimeline> animation_timeline_; |
721 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; | 754 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; |
722 | 755 |
723 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 756 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
724 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 757 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
725 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 758 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
726 | 759 |
727 // Optional callback to notify of new tree activations. | 760 // Optional callback to notify of new tree activations. |
728 base::Closure tree_activation_callback_; | 761 base::Closure tree_activation_callback_; |
729 | 762 |
730 SharedBitmapManager* shared_bitmap_manager_; | 763 SharedBitmapManager* shared_bitmap_manager_; |
731 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 764 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
732 int id_; | 765 int id_; |
733 | 766 |
734 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 767 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
735 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 768 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
736 | 769 |
737 bool requires_high_res_to_draw_; | 770 bool requires_high_res_to_draw_; |
738 bool is_likely_to_require_a_draw_; | 771 bool is_likely_to_require_a_draw_; |
739 | 772 |
740 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 773 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
741 | 774 |
742 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 775 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
743 }; | 776 }; |
744 | 777 |
745 } // namespace cc | 778 } // namespace cc |
746 | 779 |
747 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 780 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |