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.h" | 5 #include "cc/trees/layer_tree_host.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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 730 info->elastic_overscroll_delta); | 730 info->elastic_overscroll_delta); |
| 731 // TODO(ccameron): pass the elastic overscroll here so that input events | 731 // TODO(ccameron): pass the elastic overscroll here so that input events |
| 732 // may be translated appropriately. | 732 // may be translated appropriately. |
| 733 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), | 733 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), |
| 734 info->elastic_overscroll_delta, | 734 info->elastic_overscroll_delta, |
| 735 info->page_scale_delta, | 735 info->page_scale_delta, |
| 736 info->top_controls_delta); | 736 info->top_controls_delta); |
| 737 SetNeedsUpdateLayers(); | 737 SetNeedsUpdateLayers(); |
| 738 } | 738 } |
| 739 | 739 |
| 740 void LayerTreeHost::RecordWheelAndTouchScrollingCount(ScrollAndScaleSet* info) { | |
| 741 if (!info || info->scroll_source_info == 0) | |
|
danakj
2017/03/10 20:52:48
When will info be null?
sahel
2017/03/13 20:13:43
Done.
| |
| 742 return; | |
| 743 | |
| 744 bool has_scrolled_by_wheel = | |
| 745 (info->scroll_source_info & | |
| 746 InputHandler::ScrollSourceInfo::SCROLLED_BY_WHEEL) != 0; | |
| 747 bool has_scrolled_by_touch = | |
| 748 (info->scroll_source_info & | |
| 749 InputHandler::ScrollSourceInfo::SCROLLED_BY_TOUCH) != 0; | |
| 750 | |
| 751 client_->RecordWheelAndTouchScrollingCount(has_scrolled_by_wheel, | |
| 752 has_scrolled_by_touch); | |
| 753 } | |
| 754 | |
| 740 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 755 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
| 741 for (auto& swap_promise : info->swap_promises) { | 756 for (auto& swap_promise : info->swap_promises) { |
| 742 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 757 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
| 743 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 758 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
| 744 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 759 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
| 745 "step", "Main thread scroll update"); | 760 "step", "Main thread scroll update"); |
| 746 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); | 761 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
| 747 } | 762 } |
| 748 | 763 |
| 749 if (root_layer_) { | 764 if (root_layer_) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 760 if (!layer) | 775 if (!layer) |
| 761 continue; | 776 continue; |
| 762 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); | 777 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); |
| 763 } | 778 } |
| 764 } | 779 } |
| 765 | 780 |
| 766 // This needs to happen after scroll deltas have been sent to prevent top | 781 // This needs to happen after scroll deltas have been sent to prevent top |
| 767 // controls from clamping the layout viewport both on the compositor and | 782 // controls from clamping the layout viewport both on the compositor and |
| 768 // on the main thread. | 783 // on the main thread. |
| 769 ApplyViewportDeltas(info); | 784 ApplyViewportDeltas(info); |
| 785 | |
| 786 RecordWheelAndTouchScrollingCount(info); | |
| 770 } | 787 } |
| 771 | 788 |
| 772 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() | 789 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() |
| 773 const { | 790 const { |
| 774 return input_handler_weak_ptr_; | 791 return input_handler_weak_ptr_; |
| 775 } | 792 } |
| 776 | 793 |
| 777 void LayerTreeHost::UpdateBrowserControlsState( | 794 void LayerTreeHost::UpdateBrowserControlsState( |
| 778 BrowserControlsState constraints, | 795 BrowserControlsState constraints, |
| 779 BrowserControlsState current, | 796 BrowserControlsState current, |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1331 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1348 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
| 1332 return LayerListReverseIterator<Layer>(nullptr); | 1349 return LayerListReverseIterator<Layer>(nullptr); |
| 1333 } | 1350 } |
| 1334 | 1351 |
| 1335 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1352 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
| 1336 for (auto* layer : *this) | 1353 for (auto* layer : *this) |
| 1337 layer->SetNeedsDisplay(); | 1354 layer->SetNeedsDisplay(); |
| 1338 } | 1355 } |
| 1339 | 1356 |
| 1340 } // namespace cc | 1357 } // namespace cc |
| OLD | NEW |