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 bool has_scrolled_by_wheel = info->has_scrolled_by_wheel; |
| 742 bool has_scrolled_by_touch = info->has_scrolled_by_touch; |
| 743 |
| 744 if (has_scrolled_by_wheel || has_scrolled_by_touch) { |
| 745 client_->RecordWheelAndTouchScrollingCount(has_scrolled_by_wheel, |
| 746 has_scrolled_by_touch); |
| 747 } |
| 748 } |
| 749 |
740 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 750 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
741 for (auto& swap_promise : info->swap_promises) { | 751 for (auto& swap_promise : info->swap_promises) { |
742 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 752 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
743 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 753 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
744 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 754 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
745 "step", "Main thread scroll update"); | 755 "step", "Main thread scroll update"); |
746 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); | 756 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
747 } | 757 } |
748 | 758 |
749 if (root_layer_) { | 759 if (root_layer_) { |
(...skipping 10 matching lines...) Expand all Loading... |
760 if (!layer) | 770 if (!layer) |
761 continue; | 771 continue; |
762 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); | 772 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); |
763 } | 773 } |
764 } | 774 } |
765 | 775 |
766 // This needs to happen after scroll deltas have been sent to prevent top | 776 // 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 | 777 // controls from clamping the layout viewport both on the compositor and |
768 // on the main thread. | 778 // on the main thread. |
769 ApplyViewportDeltas(info); | 779 ApplyViewportDeltas(info); |
| 780 |
| 781 RecordWheelAndTouchScrollingCount(info); |
770 } | 782 } |
771 | 783 |
772 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() | 784 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() |
773 const { | 785 const { |
774 return input_handler_weak_ptr_; | 786 return input_handler_weak_ptr_; |
775 } | 787 } |
776 | 788 |
777 void LayerTreeHost::UpdateBrowserControlsState( | 789 void LayerTreeHost::UpdateBrowserControlsState( |
778 BrowserControlsState constraints, | 790 BrowserControlsState constraints, |
779 BrowserControlsState current, | 791 BrowserControlsState current, |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1343 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
1332 return LayerListReverseIterator<Layer>(nullptr); | 1344 return LayerListReverseIterator<Layer>(nullptr); |
1333 } | 1345 } |
1334 | 1346 |
1335 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1347 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
1336 for (auto* layer : *this) | 1348 for (auto* layer : *this) |
1337 layer->SetNeedsDisplay(); | 1349 layer->SetNeedsDisplay(); |
1338 } | 1350 } |
1339 | 1351 |
1340 } // namespace cc | 1352 } // namespace cc |
OLD | NEW |