Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; | 124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; |
| 125 | 125 |
| 126 // Called when output surface asks for a draw. | 126 // Called when output surface asks for a draw. |
| 127 virtual void OnDrawForCompositorFrameSink( | 127 virtual void OnDrawForCompositorFrameSink( |
| 128 bool resourceless_software_draw) = 0; | 128 bool resourceless_software_draw) = 0; |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 virtual ~LayerTreeHostImplClient() {} | 131 virtual ~LayerTreeHostImplClient() {} |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // Used to cache scroll related variables that get reset while clearing | |
| 135 // the currently scrolling layer. Cached values are restored in case of a | |
| 136 // scrollBegin in inertial phase (fling) to latch the fling to the previously | |
| 137 // scrolling layer. | |
| 138 class ScrollStateForFling { | |
|
aelias_OOO_until_Jul13
2016/10/27 21:48:11
What's the event sequence that makes this needed?
sahel
2016/10/27 22:57:06
Yes, that's the even sequence and it only happens
| |
| 139 public: | |
| 140 ScrollStateForFling() { | |
| 141 ScrollStateForFling(Layer::INVALID_ID, false, false, gfx::Vector2dF()); | |
| 142 } | |
| 143 ScrollStateForFling(int scrolling_layer_id, | |
| 144 bool did_lock_scrolling_layer, | |
| 145 bool scroll_affects_scroll_handler, | |
| 146 gfx::Vector2dF accumulated_root_overscroll) | |
| 147 : scrolling_layer_id_(scrolling_layer_id), | |
| 148 did_lock_scrolling_layer_(did_lock_scrolling_layer), | |
| 149 scroll_affects_scroll_handler_(scroll_affects_scroll_handler), | |
| 150 accumulated_root_overscroll_(accumulated_root_overscroll) {} | |
| 151 | |
| 152 int scrolling_layer_id() { return scrolling_layer_id_; } | |
| 153 bool did_lock_scrolling_layer() { return did_lock_scrolling_layer_; } | |
| 154 bool scroll_affects_scroll_handler() { | |
| 155 return scroll_affects_scroll_handler_; | |
| 156 } | |
| 157 gfx::Vector2dF accumulated_root_overscroll() { | |
| 158 return accumulated_root_overscroll_; | |
| 159 } | |
| 160 | |
| 161 private: | |
| 162 int scrolling_layer_id_; | |
| 163 bool did_lock_scrolling_layer_; | |
| 164 bool scroll_affects_scroll_handler_; | |
| 165 gfx::Vector2dF accumulated_root_overscroll_; | |
| 166 }; | |
| 167 | |
| 134 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 168 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| 135 // state. | 169 // state. |
| 136 class CC_EXPORT LayerTreeHostImpl | 170 class CC_EXPORT LayerTreeHostImpl |
| 137 : public InputHandler, | 171 : public InputHandler, |
| 138 public TileManagerClient, | 172 public TileManagerClient, |
| 139 public CompositorFrameSinkClient, | 173 public CompositorFrameSinkClient, |
| 140 public TopControlsManagerClient, | 174 public TopControlsManagerClient, |
| 141 public ScrollbarAnimationControllerClient, | 175 public ScrollbarAnimationControllerClient, |
| 142 public VideoFrameControllerClient, | 176 public VideoFrameControllerClient, |
| 143 public LayerTreeMutatorClient, | 177 public LayerTreeMutatorClient, |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 | 723 |
| 690 void ScrollAnimationAbort(LayerImpl* layer_impl); | 724 void ScrollAnimationAbort(LayerImpl* layer_impl); |
| 691 | 725 |
| 692 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node, | 726 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node, |
| 693 const gfx::Vector2dF& scroll_delta, | 727 const gfx::Vector2dF& scroll_delta, |
| 694 base::TimeDelta delayed_by); | 728 base::TimeDelta delayed_by); |
| 695 | 729 |
| 696 void SetCompositorContextVisibility(bool is_visible); | 730 void SetCompositorContextVisibility(bool is_visible); |
| 697 void SetWorkerContextVisibility(bool is_visible); | 731 void SetWorkerContextVisibility(bool is_visible); |
| 698 | 732 |
| 733 // Cache & restore variables that get reset in ClearCurrentlyScrollingLayer. | |
| 734 // This is used to restore the variables' values in a scrollBegin event | |
| 735 // that is in inertial phase (a fling) to latch the event to its | |
| 736 // corresponding scroller. | |
| 737 void CacheScrollStateForFling(); | |
| 738 void RestoreScrollStateForFling(); | |
| 739 | |
| 699 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; | 740 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; |
| 700 UIResourceMap ui_resource_map_; | 741 UIResourceMap ui_resource_map_; |
| 701 | 742 |
| 702 // Resources that were evicted by EvictAllUIResources. Resources are removed | 743 // Resources that were evicted by EvictAllUIResources. Resources are removed |
| 703 // from this when they are touched by a create or destroy from the UI resource | 744 // from this when they are touched by a create or destroy from the UI resource |
| 704 // request queue. | 745 // request queue. |
| 705 std::set<UIResourceId> evicted_ui_resources_; | 746 std::set<UIResourceId> evicted_ui_resources_; |
| 706 | 747 |
| 707 CompositorFrameSink* compositor_frame_sink_; | 748 CompositorFrameSink* compositor_frame_sink_; |
| 708 | 749 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 // it's lost instead of having this bool. | 869 // it's lost instead of having this bool. |
| 829 bool has_valid_compositor_frame_sink_; | 870 bool has_valid_compositor_frame_sink_; |
| 830 | 871 |
| 831 std::unique_ptr<Viewport> viewport_; | 872 std::unique_ptr<Viewport> viewport_; |
| 832 | 873 |
| 833 std::unique_ptr<LayerTreeMutator> mutator_; | 874 std::unique_ptr<LayerTreeMutator> mutator_; |
| 834 | 875 |
| 835 std::unique_ptr<PendingTreeDurationHistogramTimer> | 876 std::unique_ptr<PendingTreeDurationHistogramTimer> |
| 836 pending_tree_duration_timer_; | 877 pending_tree_duration_timer_; |
| 837 | 878 |
| 879 ScrollStateForFling cached_scroll_state_for_fling_; | |
| 880 | |
| 838 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 881 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 839 }; | 882 }; |
| 840 | 883 |
| 841 } // namespace cc | 884 } // namespace cc |
| 842 | 885 |
| 843 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 886 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |