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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 info->elastic_overscroll_delta); | 749 info->elastic_overscroll_delta); |
750 // TODO(ccameron): pass the elastic overscroll here so that input events | 750 // TODO(ccameron): pass the elastic overscroll here so that input events |
751 // may be translated appropriately. | 751 // may be translated appropriately. |
752 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), | 752 client_->ApplyViewportDeltas(inner_viewport_scroll_delta, gfx::Vector2dF(), |
753 info->elastic_overscroll_delta, | 753 info->elastic_overscroll_delta, |
754 info->page_scale_delta, | 754 info->page_scale_delta, |
755 info->top_controls_delta); | 755 info->top_controls_delta); |
756 SetNeedsUpdateLayers(); | 756 SetNeedsUpdateLayers(); |
757 } | 757 } |
758 | 758 |
| 759 void LayerTreeHost::RecordWheelAndTouchScrollingCount(ScrollAndScaleSet* info) { |
| 760 bool has_scrolled_by_wheel = info->has_scrolled_by_wheel; |
| 761 bool has_scrolled_by_touch = info->has_scrolled_by_touch; |
| 762 |
| 763 if (has_scrolled_by_wheel || has_scrolled_by_touch) { |
| 764 client_->RecordWheelAndTouchScrollingCount(has_scrolled_by_wheel, |
| 765 has_scrolled_by_touch); |
| 766 } |
| 767 } |
| 768 |
759 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 769 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
760 for (auto& swap_promise : info->swap_promises) { | 770 for (auto& swap_promise : info->swap_promises) { |
761 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 771 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
762 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), | 772 TRACE_ID_DONT_MANGLE(swap_promise->TraceId()), |
763 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, | 773 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, |
764 "step", "Main thread scroll update"); | 774 "step", "Main thread scroll update"); |
765 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); | 775 swap_promise_manager_.QueueSwapPromise(std::move(swap_promise)); |
766 } | 776 } |
767 | 777 |
768 if (root_layer_) { | 778 if (root_layer_) { |
(...skipping 10 matching lines...) Expand all Loading... |
779 if (!layer) | 789 if (!layer) |
780 continue; | 790 continue; |
781 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); | 791 layer->SetScrollbarsHiddenFromImplSide(info->scrollbars[i].hidden); |
782 } | 792 } |
783 } | 793 } |
784 | 794 |
785 // This needs to happen after scroll deltas have been sent to prevent top | 795 // This needs to happen after scroll deltas have been sent to prevent top |
786 // controls from clamping the layout viewport both on the compositor and | 796 // controls from clamping the layout viewport both on the compositor and |
787 // on the main thread. | 797 // on the main thread. |
788 ApplyViewportDeltas(info); | 798 ApplyViewportDeltas(info); |
| 799 |
| 800 RecordWheelAndTouchScrollingCount(info); |
789 } | 801 } |
790 | 802 |
791 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() | 803 const base::WeakPtr<InputHandler>& LayerTreeHost::GetInputHandler() |
792 const { | 804 const { |
793 return input_handler_weak_ptr_; | 805 return input_handler_weak_ptr_; |
794 } | 806 } |
795 | 807 |
796 void LayerTreeHost::UpdateBrowserControlsState( | 808 void LayerTreeHost::UpdateBrowserControlsState( |
797 BrowserControlsState constraints, | 809 BrowserControlsState constraints, |
798 BrowserControlsState current, | 810 BrowserControlsState current, |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 LayerListReverseIterator<Layer> LayerTreeHost::rend() { | 1368 LayerListReverseIterator<Layer> LayerTreeHost::rend() { |
1357 return LayerListReverseIterator<Layer>(nullptr); | 1369 return LayerListReverseIterator<Layer>(nullptr); |
1358 } | 1370 } |
1359 | 1371 |
1360 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { | 1372 void LayerTreeHost::SetNeedsDisplayOnAllLayers() { |
1361 for (auto* layer : *this) | 1373 for (auto* layer : *this) |
1362 layer->SetNeedsDisplay(); | 1374 layer->SetNeedsDisplay(); |
1363 } | 1375 } |
1364 | 1376 |
1365 } // namespace cc | 1377 } // namespace cc |
OLD | NEW |