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