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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 class ResourcePool; | 66 class ResourcePool; |
67 class ScrollElasticityHelper; | 67 class ScrollElasticityHelper; |
68 class ScrollbarLayerImplBase; | 68 class ScrollbarLayerImplBase; |
69 class SwapPromise; | 69 class SwapPromise; |
70 class SwapPromiseMonitor; | 70 class SwapPromiseMonitor; |
71 class TextureMailboxDeleter; | 71 class TextureMailboxDeleter; |
72 class TopControlsManager; | 72 class TopControlsManager; |
73 class UIResourceBitmap; | 73 class UIResourceBitmap; |
74 class UIResourceRequest; | 74 class UIResourceRequest; |
75 struct ScrollAndScaleSet; | 75 struct ScrollAndScaleSet; |
| 76 class Viewport; |
76 | 77 |
77 enum class GpuRasterizationStatus { | 78 enum class GpuRasterizationStatus { |
78 ON, | 79 ON, |
79 ON_FORCED, | 80 ON_FORCED, |
80 OFF_DEVICE, | 81 OFF_DEVICE, |
81 OFF_VIEWPORT, | 82 OFF_VIEWPORT, |
82 OFF_CONTENT | 83 OFF_CONTENT |
83 }; | 84 }; |
84 | 85 |
85 // LayerTreeHost->Proxy callback interface. | 86 // LayerTreeHost->Proxy callback interface. |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 518 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
518 scoped_ptr<ResourcePool>* resource_pool, | 519 scoped_ptr<ResourcePool>* resource_pool, |
519 scoped_ptr<ResourcePool>* staging_resource_pool); | 520 scoped_ptr<ResourcePool>* staging_resource_pool); |
520 | 521 |
521 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } | 522 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
522 | 523 |
523 FrameTimingTracker* frame_timing_tracker() { | 524 FrameTimingTracker* frame_timing_tracker() { |
524 return frame_timing_tracker_.get(); | 525 return frame_timing_tracker_.get(); |
525 } | 526 } |
526 | 527 |
| 528 gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl, |
| 529 const gfx::Vector2dF& delta, |
| 530 const gfx::Point& viewport_point, |
| 531 bool is_wheel_scroll); |
| 532 |
527 protected: | 533 protected: |
528 LayerTreeHostImpl( | 534 LayerTreeHostImpl( |
529 const LayerTreeSettings& settings, | 535 const LayerTreeSettings& settings, |
530 LayerTreeHostImplClient* client, | 536 LayerTreeHostImplClient* client, |
531 Proxy* proxy, | 537 Proxy* proxy, |
532 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 538 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
533 SharedBitmapManager* shared_bitmap_manager, | 539 SharedBitmapManager* shared_bitmap_manager, |
534 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 540 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
535 TaskGraphRunner* task_graph_runner, | 541 TaskGraphRunner* task_graph_runner, |
536 int id); | 542 int id); |
537 | 543 |
538 // Virtual for testing. | 544 // Virtual for testing. |
539 virtual void AnimateLayers(base::TimeTicks monotonic_time); | 545 virtual void AnimateLayers(base::TimeTicks monotonic_time); |
540 | 546 |
541 bool is_likely_to_require_a_draw() const { | 547 bool is_likely_to_require_a_draw() const { |
542 return is_likely_to_require_a_draw_; | 548 return is_likely_to_require_a_draw_; |
543 } | 549 } |
544 | 550 |
545 LayerTreeHostImplClient* client_; | 551 LayerTreeHostImplClient* client_; |
546 Proxy* proxy_; | 552 Proxy* proxy_; |
547 | 553 |
548 private: | 554 private: |
| 555 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta( |
| 556 LayerImpl* layer_impl, |
| 557 const gfx::PointF& viewport_point, |
| 558 const gfx::Vector2dF& viewport_delta); |
| 559 |
549 void CreateAndSetRenderer(); | 560 void CreateAndSetRenderer(); |
550 void CreateAndSetTileManager(); | 561 void CreateAndSetTileManager(); |
551 void DestroyTileManager(); | 562 void DestroyTileManager(); |
552 void ReleaseTreeResources(); | 563 void ReleaseTreeResources(); |
553 void RecreateTreeResources(); | 564 void RecreateTreeResources(); |
554 void EnforceZeroBudget(bool zero_budget); | 565 void EnforceZeroBudget(bool zero_budget); |
555 | 566 |
556 bool IsSynchronousSingleThreaded() const; | 567 bool IsSynchronousSingleThreaded() const; |
557 | 568 |
| 569 Viewport* viewport() { return viewport_.get(); } |
| 570 |
558 // Scroll by preferring to move the outer viewport first, only moving the | 571 // Scroll by preferring to move the outer viewport first, only moving the |
559 // inner if the outer is at its scroll extents. | 572 // inner if the outer is at its scroll extents. |
560 void ScrollViewportBy(gfx::Vector2dF scroll_delta); | 573 void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
561 // Scroll by preferring to move the inner viewport first, only moving the | 574 // Scroll by preferring to move the inner viewport first, only moving the |
562 // outer if the inner is at its scroll extents. | 575 // outer if the inner is at its scroll extents. |
563 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); | 576 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); |
564 void AnimatePageScale(base::TimeTicks monotonic_time); | 577 void AnimatePageScale(base::TimeTicks monotonic_time); |
565 void AnimateScrollbars(base::TimeTicks monotonic_time); | 578 void AnimateScrollbars(base::TimeTicks monotonic_time); |
566 void AnimateTopControls(base::TimeTicks monotonic_time); | 579 void AnimateTopControls(base::TimeTicks monotonic_time); |
567 | 580 |
568 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const; | |
569 | |
570 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta( | |
571 LayerImpl* layer_impl, | |
572 float scale_from_viewport_to_screen_space, | |
573 const gfx::PointF& viewport_point, | |
574 const gfx::Vector2dF& viewport_delta); | |
575 | |
576 void TrackDamageForAllSurfaces( | 581 void TrackDamageForAllSurfaces( |
577 LayerImpl* root_draw_layer, | 582 LayerImpl* root_draw_layer, |
578 const LayerImplList& render_surface_layer_list); | 583 const LayerImplList& render_surface_layer_list); |
579 | 584 |
580 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); | 585 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); |
581 | 586 |
582 // This function should only be called from PrepareToDraw, as DidDrawAllLayers | 587 // This function should only be called from PrepareToDraw, as DidDrawAllLayers |
583 // must be called if this helper function is called. Returns DRAW_SUCCESS if | 588 // must be called if this helper function is called. Returns DRAW_SUCCESS if |
584 // the frame should be drawn. | 589 // the frame should be drawn. |
585 DrawResult CalculateRenderPasses(FrameData* frame); | 590 DrawResult CalculateRenderPasses(FrameData* frame); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 int id_; | 745 int id_; |
741 | 746 |
742 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 747 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
743 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; | 748 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; |
744 | 749 |
745 bool requires_high_res_to_draw_; | 750 bool requires_high_res_to_draw_; |
746 bool is_likely_to_require_a_draw_; | 751 bool is_likely_to_require_a_draw_; |
747 | 752 |
748 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 753 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
749 | 754 |
| 755 scoped_ptr<Viewport> viewport_; |
| 756 |
750 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 757 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
751 }; | 758 }; |
752 | 759 |
753 } // namespace cc | 760 } // namespace cc |
754 | 761 |
755 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 762 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |