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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "cc/animation/animation_events.h" | 16 #include "cc/animation/animation_events.h" |
17 #include "cc/animation/animation_registrar.h" | 17 #include "cc/animation/animation_registrar.h" |
18 #include "cc/animation/scrollbar_animation_controller.h" | 18 #include "cc/animation/scrollbar_animation_controller.h" |
19 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
20 #include "cc/base/synced_property.h" | 20 #include "cc/base/synced_property.h" |
| 21 #include "cc/debug/frame_timing_tracker.h" |
21 #include "cc/debug/micro_benchmark_controller_impl.h" | 22 #include "cc/debug/micro_benchmark_controller_impl.h" |
22 #include "cc/input/input_handler.h" | 23 #include "cc/input/input_handler.h" |
23 #include "cc/input/layer_scroll_offset_delegate.h" | 24 #include "cc/input/layer_scroll_offset_delegate.h" |
24 #include "cc/input/top_controls_manager_client.h" | 25 #include "cc/input/top_controls_manager_client.h" |
25 #include "cc/layers/layer_lists.h" | 26 #include "cc/layers/layer_lists.h" |
26 #include "cc/layers/render_pass_sink.h" | 27 #include "cc/layers/render_pass_sink.h" |
27 #include "cc/output/begin_frame_args.h" | 28 #include "cc/output/begin_frame_args.h" |
28 #include "cc/output/managed_memory_policy.h" | 29 #include "cc/output/managed_memory_policy.h" |
29 #include "cc/output/output_surface_client.h" | 30 #include "cc/output/output_surface_client.h" |
30 #include "cc/output/renderer.h" | 31 #include "cc/output/renderer.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const gfx::Point& anchor) override; | 161 const gfx::Point& anchor) override; |
161 void PinchGestureEnd() override; | 162 void PinchGestureEnd() override; |
162 void StartPageScaleAnimation(const gfx::Vector2d& target_offset, | 163 void StartPageScaleAnimation(const gfx::Vector2d& target_offset, |
163 bool anchor_point, | 164 bool anchor_point, |
164 float page_scale, | 165 float page_scale, |
165 base::TimeDelta duration); | 166 base::TimeDelta duration); |
166 void SetNeedsAnimate() override; | 167 void SetNeedsAnimate() override; |
167 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 168 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
168 InputHandler::ScrollInputType type) override; | 169 InputHandler::ScrollInputType type) override; |
169 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override; | 170 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override; |
170 bool HaveTouchEventHandlersAt(const gfx::Point& viewport_port) override; | 171 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; |
171 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 172 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
172 ui::LatencyInfo* latency) override; | 173 ui::LatencyInfo* latency) override; |
173 ScrollElasticityHelper* CreateScrollElasticityHelper() override; | 174 ScrollElasticityHelper* CreateScrollElasticityHelper() override; |
174 | 175 |
175 // TopControlsManagerClient implementation. | 176 // TopControlsManagerClient implementation. |
176 void SetControlsTopOffset(float offset) override; | 177 void SetControlsTopOffset(float offset) override; |
177 float ControlsTopOffset() const override; | 178 float ControlsTopOffset() const override; |
178 void DidChangeTopControlsPosition() override; | 179 void DidChangeTopControlsPosition() override; |
179 bool HaveRootScrollLayer() const override; | 180 bool HaveRootScrollLayer() const override; |
180 | 181 |
181 struct CC_EXPORT FrameData : public RenderPassSink { | 182 struct CC_EXPORT FrameData : public RenderPassSink { |
182 FrameData(); | 183 FrameData(); |
183 ~FrameData() override; | 184 ~FrameData() override; |
184 void AsValueInto(base::debug::TracedValue* value) const; | 185 void AsValueInto(base::debug::TracedValue* value) const; |
185 | 186 |
186 std::vector<gfx::Rect> occluding_screen_space_rects; | 187 std::vector<gfx::Rect> occluding_screen_space_rects; |
187 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 188 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
| 189 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; |
188 RenderPassList render_passes; | 190 RenderPassList render_passes; |
189 RenderPassIdHashMap render_passes_by_id; | 191 RenderPassIdHashMap render_passes_by_id; |
190 const LayerImplList* render_surface_layer_list; | 192 const LayerImplList* render_surface_layer_list; |
191 LayerImplList will_draw_layers; | 193 LayerImplList will_draw_layers; |
192 bool has_no_damage; | 194 bool has_no_damage; |
193 | 195 |
194 // RenderPassSink implementation. | 196 // RenderPassSink implementation. |
195 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; | 197 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; |
196 }; | 198 }; |
197 | 199 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 void SynchronouslyInitializeAllTiles(); | 509 void SynchronouslyInitializeAllTiles(); |
508 | 510 |
509 virtual scoped_ptr<Rasterizer> CreateRasterizer(); | 511 virtual scoped_ptr<Rasterizer> CreateRasterizer(); |
510 virtual void CreateResourceAndTileTaskWorkerPool( | 512 virtual void CreateResourceAndTileTaskWorkerPool( |
511 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 513 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
512 scoped_ptr<ResourcePool>* resource_pool, | 514 scoped_ptr<ResourcePool>* resource_pool, |
513 scoped_ptr<ResourcePool>* staging_resource_pool); | 515 scoped_ptr<ResourcePool>* staging_resource_pool); |
514 | 516 |
515 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } | 517 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
516 | 518 |
| 519 FrameTimingTracker* frame_timing_tracker() { |
| 520 return frame_timing_tracker_.get(); |
| 521 } |
| 522 |
517 protected: | 523 protected: |
518 LayerTreeHostImpl( | 524 LayerTreeHostImpl( |
519 const LayerTreeSettings& settings, | 525 const LayerTreeSettings& settings, |
520 LayerTreeHostImplClient* client, | 526 LayerTreeHostImplClient* client, |
521 Proxy* proxy, | 527 Proxy* proxy, |
522 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 528 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
523 SharedBitmapManager* shared_bitmap_manager, | 529 SharedBitmapManager* shared_bitmap_manager, |
524 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 530 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
525 int id); | 531 int id); |
526 | 532 |
527 void UpdateViewportContainerSizes(); | 533 void UpdateViewportContainerSizes(); |
528 | 534 |
529 // Virtual for testing. | 535 // Virtual for testing. |
530 virtual void AnimateLayers(base::TimeTicks monotonic_time); | 536 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
531 const AnimationRegistrar::AnimationControllerMap& | 537 const AnimationRegistrar::AnimationControllerMap& |
532 active_animation_controllers() const { | 538 active_animation_controllers() const { |
533 return animation_registrar_->active_animation_controllers(); | 539 return animation_registrar_->active_animation_controllers(); |
534 } | 540 } |
535 | 541 |
536 LayerTreeHostImplClient* client_; | 542 LayerTreeHostImplClient* client_; |
537 Proxy* proxy_; | 543 Proxy* proxy_; |
538 | 544 |
539 private: | 545 private: |
540 void CreateAndSetRenderer(); | 546 void CreateAndSetRenderer(); |
541 void CreateAndSetTileManager(); | 547 void CreateAndSetTileManager(); |
542 void DestroyTileManager(); | 548 void DestroyTileManager(); |
543 void ReleaseTreeResources(); | 549 void ReleaseTreeResources(); |
| 550 void RecreateTreeResources(); |
544 void EnforceZeroBudget(bool zero_budget); | 551 void EnforceZeroBudget(bool zero_budget); |
545 | 552 |
546 bool UsePendingTreeForSync() const; | 553 bool UsePendingTreeForSync() const; |
547 bool IsSynchronousSingleThreaded() const; | 554 bool IsSynchronousSingleThreaded() const; |
548 | 555 |
549 // Scroll by preferring to move the outer viewport first, only moving the | 556 // Scroll by preferring to move the outer viewport first, only moving the |
550 // inner if the outer is at its scroll extents. | 557 // inner if the outer is at its scroll extents. |
551 void ScrollViewportBy(gfx::Vector2dF scroll_delta); | 558 void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
552 // Scroll by preferring to move the inner viewport first, only moving the | 559 // Scroll by preferring to move the inner viewport first, only moving the |
553 // outer if the inner is at its scroll extents. | 560 // outer if the inner is at its scroll extents. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 int id_; | 732 int id_; |
726 | 733 |
727 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 734 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
728 | 735 |
729 std::vector<PictureLayerImpl*> picture_layers_; | 736 std::vector<PictureLayerImpl*> picture_layers_; |
730 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 737 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
731 | 738 |
732 bool requires_high_res_to_draw_; | 739 bool requires_high_res_to_draw_; |
733 bool is_likely_to_require_a_draw_; | 740 bool is_likely_to_require_a_draw_; |
734 | 741 |
| 742 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
| 743 |
735 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 744 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
736 }; | 745 }; |
737 | 746 |
738 } // namespace cc | 747 } // namespace cc |
739 | 748 |
740 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 749 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |