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 18 matching lines...) Expand all Loading... |
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/resources/ui_resource_client.h" | 36 #include "cc/resources/ui_resource_client.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/trees/layer_tree_mutators_client.h" |
39 #include "cc/trees/layer_tree_settings.h" | 40 #include "cc/trees/layer_tree_settings.h" |
40 #include "cc/trees/proxy.h" | 41 #include "cc/trees/proxy.h" |
41 #include "skia/ext/refptr.h" | 42 #include "skia/ext/refptr.h" |
42 #include "third_party/skia/include/core/SkColor.h" | 43 #include "third_party/skia/include/core/SkColor.h" |
43 #include "ui/gfx/geometry/rect.h" | 44 #include "ui/gfx/geometry/rect.h" |
44 | 45 |
45 namespace gfx { | 46 namespace gfx { |
46 class ScrollOffset; | 47 class ScrollOffset; |
47 } | 48 } |
48 | 49 |
49 namespace cc { | 50 namespace cc { |
50 | 51 |
| 52 class AnimationHost; |
51 class CompletionEvent; | 53 class CompletionEvent; |
52 class CompositorFrameMetadata; | 54 class CompositorFrameMetadata; |
53 class DebugRectHistory; | 55 class DebugRectHistory; |
54 class EvictionTilePriorityQueue; | 56 class EvictionTilePriorityQueue; |
55 class FrameRateCounter; | 57 class FrameRateCounter; |
56 class LayerImpl; | 58 class LayerImpl; |
57 class LayerTreeImpl; | 59 class LayerTreeImpl; |
58 class MemoryHistory; | 60 class MemoryHistory; |
59 class PageScaleAnimation; | 61 class PageScaleAnimation; |
60 class PaintTimeCounter; | 62 class PaintTimeCounter; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 132 |
131 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 133 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
132 // state. | 134 // state. |
133 class CC_EXPORT LayerTreeHostImpl | 135 class CC_EXPORT LayerTreeHostImpl |
134 : public InputHandler, | 136 : public InputHandler, |
135 public RendererClient, | 137 public RendererClient, |
136 public TileManagerClient, | 138 public TileManagerClient, |
137 public OutputSurfaceClient, | 139 public OutputSurfaceClient, |
138 public TopControlsManagerClient, | 140 public TopControlsManagerClient, |
139 public ScrollbarAnimationControllerClient, | 141 public ScrollbarAnimationControllerClient, |
140 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 142 public base::SupportsWeakPtr<LayerTreeHostImpl>, |
| 143 public LayerTreeMutatorsClient { |
141 public: | 144 public: |
142 static scoped_ptr<LayerTreeHostImpl> Create( | 145 static scoped_ptr<LayerTreeHostImpl> Create( |
143 const LayerTreeSettings& settings, | 146 const LayerTreeSettings& settings, |
144 LayerTreeHostImplClient* client, | 147 LayerTreeHostImplClient* client, |
145 Proxy* proxy, | 148 Proxy* proxy, |
146 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 149 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
147 SharedBitmapManager* shared_bitmap_manager, | 150 SharedBitmapManager* shared_bitmap_manager, |
148 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 151 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
149 TaskGraphRunner* task_graph_runner, | 152 TaskGraphRunner* task_graph_runner, |
150 int id); | 153 int id); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); | 219 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); |
217 virtual void BeginCommit(); | 220 virtual void BeginCommit(); |
218 virtual void CommitComplete(); | 221 virtual void CommitComplete(); |
219 virtual void Animate(base::TimeTicks monotonic_time); | 222 virtual void Animate(base::TimeTicks monotonic_time); |
220 virtual void UpdateAnimationState(bool start_ready_animations); | 223 virtual void UpdateAnimationState(bool start_ready_animations); |
221 void ActivateAnimations(); | 224 void ActivateAnimations(); |
222 void MainThreadHasStoppedFlinging(); | 225 void MainThreadHasStoppedFlinging(); |
223 void DidAnimateScrollOffset(); | 226 void DidAnimateScrollOffset(); |
224 void SetViewportDamage(const gfx::Rect& damage_rect); | 227 void SetViewportDamage(const gfx::Rect& damage_rect); |
225 | 228 |
| 229 void SetTreeLayerFilterMutated(int layer_id, |
| 230 LayerTreeImpl* tree, |
| 231 const FilterOperations& filters); |
| 232 void SetTreeLayerOpacityMutated(int layer_id, |
| 233 LayerTreeImpl* tree, |
| 234 float opacity); |
| 235 void SetTreeLayerTransformMutated(int layer_id, |
| 236 LayerTreeImpl* tree, |
| 237 const gfx::Transform& transform); |
| 238 void SetTreeLayerScrollOffsetMutated(int layer_id, |
| 239 LayerTreeImpl* tree, |
| 240 const gfx::ScrollOffset& scroll_offset); |
| 241 |
| 242 // LayerTreeMutatorsClient implementation. |
| 243 bool IsLayerInActiveTree(int layer_id) const override; |
| 244 bool IsLayerInPendingTree(int layer_id) const override; |
| 245 void SetMutatorsNeedCommit() override; |
| 246 void SetLayerFilterMutated(int layer_id, |
| 247 bool affects_active_tree, |
| 248 const FilterOperations& filters) override; |
| 249 void SetLayerOpacityMutated(int layer_id, |
| 250 bool affects_active_tree, |
| 251 float opacity) override; |
| 252 void SetLayerTransformMutated(int layer_id, |
| 253 bool affects_active_tree, |
| 254 const gfx::Transform& transform) override; |
| 255 void SetLayerScrollOffsetMutated( |
| 256 int layer_id, |
| 257 bool active_tree, |
| 258 const gfx::ScrollOffset& scroll_offset) override; |
| 259 |
226 virtual void PrepareTiles(); | 260 virtual void PrepareTiles(); |
227 | 261 |
228 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we | 262 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we |
229 // should try to avoid displaying the frame. If PrepareToDraw is called, | 263 // should try to avoid displaying the frame. If PrepareToDraw is called, |
230 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is | 264 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is |
231 // called between the two. | 265 // called between the two. |
232 virtual DrawResult PrepareToDraw(FrameData* frame); | 266 virtual DrawResult PrepareToDraw(FrameData* frame); |
233 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); | 267 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time); |
234 // Must be called if and only if PrepareToDraw was called. | 268 // Must be called if and only if PrepareToDraw was called. |
235 void DidDrawAllLayers(const FrameData& frame); | 269 void DidDrawAllLayers(const FrameData& frame); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 453 } |
420 const GlobalStateThatImpactsTilePriority& global_tile_state() { | 454 const GlobalStateThatImpactsTilePriority& global_tile_state() { |
421 return global_tile_state_; | 455 return global_tile_state_; |
422 } | 456 } |
423 | 457 |
424 Proxy* proxy() const { return proxy_; } | 458 Proxy* proxy() const { return proxy_; } |
425 | 459 |
426 AnimationRegistrar* animation_registrar() const { | 460 AnimationRegistrar* animation_registrar() const { |
427 return animation_registrar_.get(); | 461 return animation_registrar_.get(); |
428 } | 462 } |
| 463 AnimationHost* animation_host() const { return animation_host_.get(); } |
429 | 464 |
430 void SetDebugState(const LayerTreeDebugState& new_debug_state); | 465 void SetDebugState(const LayerTreeDebugState& new_debug_state); |
431 const LayerTreeDebugState& debug_state() const { return debug_state_; } | 466 const LayerTreeDebugState& debug_state() const { return debug_state_; } |
432 | 467 |
433 class CC_EXPORT CullRenderPassesWithNoQuads { | 468 class CC_EXPORT CullRenderPassesWithNoQuads { |
434 public: | 469 public: |
435 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad, | 470 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad, |
436 const FrameData& frame) const; | 471 const FrameData& frame) const; |
437 | 472 |
438 // Iterates in draw order, so that when a surface is removed, and its | 473 // Iterates in draw order, so that when a surface is removed, and its |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 bool resourceless_software_draw_; | 762 bool resourceless_software_draw_; |
728 | 763 |
729 gfx::Rect viewport_damage_rect_; | 764 gfx::Rect viewport_damage_rect_; |
730 | 765 |
731 BeginFrameArgs current_begin_frame_args_; | 766 BeginFrameArgs current_begin_frame_args_; |
732 | 767 |
733 // Expected time between two begin impl frame calls. | 768 // Expected time between two begin impl frame calls. |
734 base::TimeDelta begin_impl_frame_interval_; | 769 base::TimeDelta begin_impl_frame_interval_; |
735 | 770 |
736 scoped_ptr<AnimationRegistrar> animation_registrar_; | 771 scoped_ptr<AnimationRegistrar> animation_registrar_; |
| 772 scoped_ptr<AnimationHost> animation_host_; |
737 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; | 773 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; |
738 | 774 |
739 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 775 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
740 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 776 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
741 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; | 777 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
742 | 778 |
743 // Optional callback to notify of new tree activations. | 779 // Optional callback to notify of new tree activations. |
744 base::Closure tree_activation_callback_; | 780 base::Closure tree_activation_callback_; |
745 | 781 |
746 SharedBitmapManager* shared_bitmap_manager_; | 782 SharedBitmapManager* shared_bitmap_manager_; |
(...skipping 10 matching lines...) Expand all Loading... |
757 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 793 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
758 | 794 |
759 scoped_ptr<Viewport> viewport_; | 795 scoped_ptr<Viewport> viewport_; |
760 | 796 |
761 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 797 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
762 }; | 798 }; |
763 | 799 |
764 } // namespace cc | 800 } // namespace cc |
765 | 801 |
766 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 802 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |