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 its | |
| 137 // corresponding scroll event. | |
|
tdresser
2016/10/26 15:38:18
It doesn't latch the fling to the scroll event, it
sahel
2016/10/26 18:47:45
Done.
| |
| 138 class ScrollStateForFling { | |
| 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 scrollingLayerId() { return scrolling_layer_id_; } | |
|
bokan
2016/10/26 14:17:43
nit: these methods should all be of the style scro
sahel
2016/10/26 18:47:45
Done.
| |
| 153 bool didLockScrollingLayer() { return did_lock_scrolling_layer_; } | |
| 154 bool scrollAffectsScrollHandler() { return scroll_affects_scroll_handler_; } | |
| 155 gfx::Vector2dF accumulatedRootOverscroll() { | |
| 156 return accumulated_root_overscroll_; | |
| 157 } | |
| 158 | |
| 159 private: | |
| 160 int scrolling_layer_id_; | |
| 161 bool did_lock_scrolling_layer_; | |
| 162 bool scroll_affects_scroll_handler_; | |
| 163 gfx::Vector2dF accumulated_root_overscroll_; | |
| 164 }; | |
| 165 | |
| 134 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 166 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| 135 // state. | 167 // state. |
| 136 class CC_EXPORT LayerTreeHostImpl | 168 class CC_EXPORT LayerTreeHostImpl |
| 137 : public InputHandler, | 169 : public InputHandler, |
| 138 public TileManagerClient, | 170 public TileManagerClient, |
| 139 public CompositorFrameSinkClient, | 171 public CompositorFrameSinkClient, |
| 140 public TopControlsManagerClient, | 172 public TopControlsManagerClient, |
| 141 public ScrollbarAnimationControllerClient, | 173 public ScrollbarAnimationControllerClient, |
| 142 public VideoFrameControllerClient, | 174 public VideoFrameControllerClient, |
| 143 public LayerTreeMutatorClient, | 175 public LayerTreeMutatorClient, |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 | 726 |
| 695 void ScrollAnimationAbort(LayerImpl* layer_impl); | 727 void ScrollAnimationAbort(LayerImpl* layer_impl); |
| 696 | 728 |
| 697 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node, | 729 bool ScrollAnimationUpdateTarget(ScrollNode* scroll_node, |
| 698 const gfx::Vector2dF& scroll_delta, | 730 const gfx::Vector2dF& scroll_delta, |
| 699 base::TimeDelta delayed_by); | 731 base::TimeDelta delayed_by); |
| 700 | 732 |
| 701 void SetCompositorContextVisibility(bool is_visible); | 733 void SetCompositorContextVisibility(bool is_visible); |
| 702 void SetWorkerContextVisibility(bool is_visible); | 734 void SetWorkerContextVisibility(bool is_visible); |
| 703 | 735 |
| 736 // Cache & restore variables that get reset in ClearCurrentlyScrollingLayer. | |
| 737 // This is used to restore the variables' values in a scrollBegin event | |
| 738 // that is in inertial phase (a fling) to latch the event to its | |
| 739 // corresponding scroller. | |
| 740 void CacheScrollStateForFling(); | |
| 741 LayerImpl* RestoreScrollStateForFling(); | |
| 742 | |
| 704 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; | 743 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; |
| 705 UIResourceMap ui_resource_map_; | 744 UIResourceMap ui_resource_map_; |
| 706 | 745 |
| 707 // Resources that were evicted by EvictAllUIResources. Resources are removed | 746 // Resources that were evicted by EvictAllUIResources. Resources are removed |
| 708 // from this when they are touched by a create or destroy from the UI resource | 747 // from this when they are touched by a create or destroy from the UI resource |
| 709 // request queue. | 748 // request queue. |
| 710 std::set<UIResourceId> evicted_ui_resources_; | 749 std::set<UIResourceId> evicted_ui_resources_; |
| 711 | 750 |
| 712 CompositorFrameSink* compositor_frame_sink_; | 751 CompositorFrameSink* compositor_frame_sink_; |
| 713 | 752 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 // it's lost instead of having this bool. | 873 // it's lost instead of having this bool. |
| 835 bool has_valid_compositor_frame_sink_; | 874 bool has_valid_compositor_frame_sink_; |
| 836 | 875 |
| 837 std::unique_ptr<Viewport> viewport_; | 876 std::unique_ptr<Viewport> viewport_; |
| 838 | 877 |
| 839 std::unique_ptr<LayerTreeMutator> mutator_; | 878 std::unique_ptr<LayerTreeMutator> mutator_; |
| 840 | 879 |
| 841 std::unique_ptr<PendingTreeDurationHistogramTimer> | 880 std::unique_ptr<PendingTreeDurationHistogramTimer> |
| 842 pending_tree_duration_timer_; | 881 pending_tree_duration_timer_; |
| 843 | 882 |
| 883 ScrollStateForFling cached_scroll_state_for_fling_; | |
| 884 | |
| 844 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 885 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
| 845 }; | 886 }; |
| 846 | 887 |
| 847 } // namespace cc | 888 } // namespace cc |
| 848 | 889 |
| 849 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 890 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| OLD | NEW |