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 #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 Loading... | |
| 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 node for 'ancestor' is the same as 'child' or an |
| 158 // ancestor along the scroll tree. | 158 // 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 auto* property_trees = child->layer_tree_impl()->property_trees(); |
| 165 child->layer_tree_impl()->property_trees()->scroll_tree; | 165 auto ancestor_scroll_id = |
| 166 property_trees->layer_id_to_scroll_node_index.find(ancestor->id()); | |
|
ajuma
2017/02/23 14:19:00
Is the idea that for SPv2, we'd potentially have m
pdr.
2017/02/23 19:19:18
Yeah, here's my mental model of a usecase and how
| |
| 167 if (ancestor_scroll_id == property_trees->layer_id_to_scroll_node_index.end()) | |
| 168 return false; | |
| 169 | |
| 170 ScrollTree& scroll_tree = property_trees->scroll_tree; | |
| 166 for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); | 171 for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); |
| 167 scroll_node; scroll_node = scroll_tree.parent(scroll_node)) { | 172 scroll_node; scroll_node = scroll_tree.parent(scroll_node)) { |
| 168 if (scroll_node->owning_layer_id == ancestor->id()) | 173 if (scroll_node->id == ancestor_scroll_id->second) |
| 169 return true; | 174 return true; |
| 170 } | 175 } |
| 171 return false; | 176 return false; |
| 172 } | 177 } |
| 173 | 178 |
| 174 } // namespace | 179 } // namespace |
| 175 | 180 |
| 176 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, | 181 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
| 177 "Scheduling.%s.PendingTreeDuration"); | 182 "Scheduling.%s.PendingTreeDuration"); |
| 178 | 183 |
| (...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2621 if (!impl_scroll_node) | 2626 if (!impl_scroll_node) |
| 2622 return nullptr; | 2627 return nullptr; |
| 2623 return active_tree_->LayerById(impl_scroll_node->owning_layer_id); | 2628 return active_tree_->LayerById(impl_scroll_node->owning_layer_id); |
| 2624 } | 2629 } |
| 2625 | 2630 |
| 2626 static bool IsClosestScrollAncestor(LayerImpl* child, | 2631 static bool IsClosestScrollAncestor(LayerImpl* child, |
| 2627 LayerImpl* scroll_ancestor) { | 2632 LayerImpl* scroll_ancestor) { |
| 2628 DCHECK(scroll_ancestor); | 2633 DCHECK(scroll_ancestor); |
| 2629 if (!child) | 2634 if (!child) |
| 2630 return false; | 2635 return false; |
| 2631 ScrollTree& scroll_tree = | 2636 |
| 2632 child->layer_tree_impl()->property_trees()->scroll_tree; | 2637 auto* property_trees = child->layer_tree_impl()->property_trees(); |
| 2638 auto ancestor_scroll_id = | |
| 2639 property_trees->layer_id_to_scroll_node_index.find(scroll_ancestor->id()); | |
| 2640 if (ancestor_scroll_id == property_trees->layer_id_to_scroll_node_index.end()) | |
| 2641 return false; | |
| 2642 | |
| 2643 ScrollTree& scroll_tree = property_trees->scroll_tree; | |
| 2633 ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); | 2644 ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); |
| 2634 for (; scroll_tree.parent(scroll_node); | 2645 for (; scroll_tree.parent(scroll_node); |
| 2635 scroll_node = scroll_tree.parent(scroll_node)) { | 2646 scroll_node = scroll_tree.parent(scroll_node)) { |
| 2636 if (scroll_node->scrollable) | 2647 if (scroll_node->scrollable) |
| 2637 return scroll_node->owning_layer_id == scroll_ancestor->id(); | 2648 return scroll_node->id == ancestor_scroll_id->second; |
| 2638 } | 2649 } |
| 2639 return false; | 2650 return false; |
| 2640 } | 2651 } |
| 2641 | 2652 |
| 2642 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( | 2653 InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl( |
| 2643 ScrollState* scroll_state, | 2654 ScrollState* scroll_state, |
| 2644 LayerImpl* scrolling_layer_impl, | 2655 LayerImpl* scrolling_layer_impl, |
| 2645 InputHandler::ScrollInputType type) { | 2656 InputHandler::ScrollInputType type) { |
| 2646 DCHECK(scroll_state); | 2657 DCHECK(scroll_state); |
| 2647 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); | 2658 DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0); |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4130 worker_context_visibility_ = | 4141 worker_context_visibility_ = |
| 4131 worker_context->CacheController()->ClientBecameVisible(); | 4142 worker_context->CacheController()->ClientBecameVisible(); |
| 4132 } else { | 4143 } else { |
| 4133 worker_context->CacheController()->ClientBecameNotVisible( | 4144 worker_context->CacheController()->ClientBecameNotVisible( |
| 4134 std::move(worker_context_visibility_)); | 4145 std::move(worker_context_visibility_)); |
| 4135 } | 4146 } |
| 4136 } | 4147 } |
| 4137 } | 4148 } |
| 4138 | 4149 |
| 4139 } // namespace cc | 4150 } // namespace cc |
| OLD | NEW |