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 ancestor is same as child or its ancestor. | |
158 bool isAncestor(LayerImpl* child, LayerImpl* ancestor) { | |
bokan
2016/11/14 18:32:48
This should be called isScrollingAncestor to make
weiliangc
2016/11/14 19:02:55
It is an unfortunate implementation detail of Prop
bokan
2016/11/14 19:04:32
But in that case, there shouldn't be a LayerImpl t
weiliangc
2016/11/14 20:57:20
Yeah, so only one of the two function would be fin
lanwei
2016/11/14 22:47:45
https://codesearch.chromium.org/chromium/src/cc/tr
weiliangc
2016/11/15 15:32:35
How about rename the function to isScrolledBy? It
| |
159 DCHECK(ancestor); | |
160 if (!child) | |
161 return false; | |
162 | |
163 ScrollTree& scroll_tree = | |
164 child->layer_tree_impl()->property_trees()->scroll_tree; | |
165 for (ScrollNode* scroll_node = scroll_tree.Node(child->scroll_tree_index()); | |
166 scroll_node; scroll_node = scroll_tree.parent(scroll_node)) { | |
167 if (scroll_node->owner_id == ancestor->id()) | |
168 return true; | |
169 } | |
170 return false; | |
171 } | |
172 | |
157 } // namespace | 173 } // namespace |
158 | 174 |
159 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, | 175 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
160 "Scheduling.%s.PendingTreeDuration"); | 176 "Scheduling.%s.PendingTreeDuration"); |
161 | 177 |
162 LayerTreeHostImpl::FrameData::FrameData() | 178 LayerTreeHostImpl::FrameData::FrameData() |
163 : render_surface_layer_list(nullptr), | 179 : render_surface_layer_list(nullptr), |
164 has_no_damage(false), | 180 has_no_damage(false), |
165 may_contain_video(false) {} | 181 may_contain_video(false) {} |
166 | 182 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 } | 590 } |
575 | 591 |
576 return false; | 592 return false; |
577 } | 593 } |
578 | 594 |
579 EventListenerProperties LayerTreeHostImpl::GetEventListenerProperties( | 595 EventListenerProperties LayerTreeHostImpl::GetEventListenerProperties( |
580 EventListenerClass event_class) const { | 596 EventListenerClass event_class) const { |
581 return active_tree_->event_listener_properties(event_class); | 597 return active_tree_->event_listener_properties(event_class); |
582 } | 598 } |
583 | 599 |
584 bool LayerTreeHostImpl::DoTouchEventsBlockScrollAt( | 600 EventListenerProperties LayerTreeHostImpl::DoTouchHandlersBlockScrollAt( |
585 const gfx::Point& viewport_point) { | 601 const gfx::Point& viewport_point) { |
586 gfx::PointF device_viewport_point = gfx::ScalePoint( | 602 gfx::PointF device_viewport_point = gfx::ScalePoint( |
587 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 603 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
588 | 604 |
589 // Now determine if there are actually any handlers at that point. | 605 // Now determine if there are actually any handlers at that point. |
590 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272). | 606 // TODO(rbyers): Consider also honoring touch-action (crbug.com/347272). |
591 LayerImpl* layer_impl = | 607 LayerImpl* layer_impl = |
592 active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( | 608 active_tree_->FindLayerThatIsHitByPointInTouchHandlerRegion( |
593 device_viewport_point); | 609 device_viewport_point); |
594 return layer_impl != NULL; | 610 if (layer_impl == NULL) |
611 return EventListenerProperties::kNone; | |
612 | |
613 if (!CurrentlyScrollingLayer()) | |
614 return EventListenerProperties::kBlocking; | |
615 | |
616 bool is_ancestor = | |
617 isAncestor(layer_impl, active_tree_->CurrentlyScrollingLayer()); | |
618 return is_ancestor ? EventListenerProperties::kBlockingAndPassiveDueToFling | |
619 : EventListenerProperties::kBlocking; | |
595 } | 620 } |
596 | 621 |
597 std::unique_ptr<SwapPromiseMonitor> | 622 std::unique_ptr<SwapPromiseMonitor> |
598 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 623 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
599 ui::LatencyInfo* latency) { | 624 ui::LatencyInfo* latency) { |
600 return base::WrapUnique( | 625 return base::WrapUnique( |
601 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 626 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
602 } | 627 } |
603 | 628 |
604 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { | 629 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { |
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4084 if (is_visible) { | 4109 if (is_visible) { |
4085 worker_context_visibility_ = | 4110 worker_context_visibility_ = |
4086 worker_context->CacheController()->ClientBecameVisible(); | 4111 worker_context->CacheController()->ClientBecameVisible(); |
4087 } else { | 4112 } else { |
4088 worker_context->CacheController()->ClientBecameNotVisible( | 4113 worker_context->CacheController()->ClientBecameNotVisible( |
4089 std::move(worker_context_visibility_)); | 4114 std::move(worker_context_visibility_)); |
4090 } | 4115 } |
4091 } | 4116 } |
4092 | 4117 |
4093 } // namespace cc | 4118 } // namespace cc |
OLD | NEW |