Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2702143002: Refactor IsScrolledBy and IsClosestScrollAncestor to use ScrollNode ids (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 bool scroll_on_main_thread = (scroll_thread == MAIN_THREAD); 147 bool scroll_on_main_thread = (scroll_thread == MAIN_THREAD);
148 if (IsWheelBasedScroll(type)) { 148 if (IsWheelBasedScroll(type)) {
149 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorWheelScrollUpdateThread", 149 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorWheelScrollUpdateThread",
150 scroll_on_main_thread); 150 scroll_on_main_thread);
151 } else { 151 } else {
152 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread", 152 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread",
153 scroll_on_main_thread); 153 scroll_on_main_thread);
154 } 154 }
155 } 155 }
156 156
157 // Return true if scrollable 'ancestor' is the same layer as 'child' or its 157 // Return true if scrollable 'ancestor' has the same scroll node as 'child' or
158 // ancestor along the scroll tree. 158 // an ancestor along the scroll tree.
159 bool IsScrolledBy(LayerImpl* child, LayerImpl* ancestor) { 159 bool IsScrolledBy(LayerImpl* child, LayerImpl* ancestor) {
160 DCHECK(ancestor && ancestor->scrollable()); 160 DCHECK(ancestor && ancestor->scrollable());
161 if (!child) 161 if (!child)
162 return false; 162 return false;
163 163
164 ScrollTree& scroll_tree = 164 ScrollTree& scroll_tree =
165 child->layer_tree_impl()->property_trees()->scroll_tree; 165 child->layer_tree_impl()->property_trees()->scroll_tree;
166 for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); 166 for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index());
167 scroll_node; scroll_node = scroll_tree.parent(scroll_node)) { 167 scroll_node; scroll_node = scroll_tree.parent(scroll_node)) {
168 if (scroll_node->owning_layer_id == ancestor->id()) 168 if (scroll_node->id == ancestor->scroll_tree_index())
ajuma 2017/02/21 16:05:25 Just wanted to point out that this could change be
bokan 2017/02/21 19:45:25 Ali, could you help me understand how that could h
ajuma 2017/02/21 20:07:56 Every layer has a scroll_tree_index. If a layer do
bokan 2017/02/21 20:25:22 Ah, got it - I was misunderstanding how that worke
pdr. 2017/02/23 05:44:26 +1, I had the same misunderstanding.
169 return true; 169 return true;
170 } 170 }
171 return false; 171 return false;
172 } 172 }
173 173
174 } // namespace 174 } // namespace
175 175
176 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, 176 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer,
177 "Scheduling.%s.PendingTreeDuration"); 177 "Scheduling.%s.PendingTreeDuration");
178 178
(...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after
2619 LayerImpl* scroll_ancestor) { 2619 LayerImpl* scroll_ancestor) {
2620 DCHECK(scroll_ancestor); 2620 DCHECK(scroll_ancestor);
2621 if (!child) 2621 if (!child)
2622 return false; 2622 return false;
2623 ScrollTree& scroll_tree = 2623 ScrollTree& scroll_tree =
2624 child->layer_tree_impl()->property_trees()->scroll_tree; 2624 child->layer_tree_impl()->property_trees()->scroll_tree;
2625 ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); 2625 ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index());
2626 for (; scroll_tree.parent(scroll_node); 2626 for (; scroll_tree.parent(scroll_node);
2627 scroll_node = scroll_tree.parent(scroll_node)) { 2627 scroll_node = scroll_tree.parent(scroll_node)) {
2628 if (scroll_node->scrollable) 2628 if (scroll_node->scrollable)
2629 return scroll_node->owning_layer_id == scroll_ancestor->id(); 2629 return scroll_node->id == scroll_ancestor->scroll_tree_index();
ajuma 2017/02/21 16:05:25 Same comment as above, but this time it looks like
sunxd 2017/02/22 22:25:19 In some cases we have MainThreadScrollingReason::k
2630 } 2630 }
2631 return false; 2631 return false;
2632 } 2632 }
2633 2633
2634 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( 2634 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
2635 ScrollState* scroll_state, 2635 ScrollState* scroll_state,
2636 LayerImpl* scrolling_layer_impl, 2636 LayerImpl* scrolling_layer_impl,
2637 InputHandler::ScrollInputType type) { 2637 InputHandler::ScrollInputType type) {
2638 DCHECK(scroll_state); 2638 DCHECK(scroll_state);
2639 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); 2639 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
4116 worker_context_visibility_ = 4116 worker_context_visibility_ =
4117 worker_context->CacheController()->ClientBecameVisible(); 4117 worker_context->CacheController()->ClientBecameVisible();
4118 } else { 4118 } else {
4119 worker_context->CacheController()->ClientBecameNotVisible( 4119 worker_context->CacheController()->ClientBecameNotVisible(
4120 std::move(worker_context_visibility_)); 4120 std::move(worker_context_visibility_));
4121 } 4121 }
4122 } 4122 }
4123 } 4123 }
4124 4124
4125 } // namespace cc 4125 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698