Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: Logic update Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 18 matching lines...) Expand all
29 #include "cc/base/math_util.h" 29 #include "cc/base/math_util.h"
30 #include "cc/benchmarks/benchmark_instrumentation.h" 30 #include "cc/benchmarks/benchmark_instrumentation.h"
31 #include "cc/debug/rendering_stats_instrumentation.h" 31 #include "cc/debug/rendering_stats_instrumentation.h"
32 #include "cc/debug/traced_value.h" 32 #include "cc/debug/traced_value.h"
33 #include "cc/input/browser_controls_offset_manager.h" 33 #include "cc/input/browser_controls_offset_manager.h"
34 #include "cc/input/main_thread_scrolling_reason.h" 34 #include "cc/input/main_thread_scrolling_reason.h"
35 #include "cc/input/page_scale_animation.h" 35 #include "cc/input/page_scale_animation.h"
36 #include "cc/input/scroll_elasticity_helper.h" 36 #include "cc/input/scroll_elasticity_helper.h"
37 #include "cc/input/scroll_state.h" 37 #include "cc/input/scroll_state.h"
38 #include "cc/input/scrollbar_animation_controller.h" 38 #include "cc/input/scrollbar_animation_controller.h"
39 #include "cc/input/scroller_size.h"
39 #include "cc/layers/append_quads_data.h" 40 #include "cc/layers/append_quads_data.h"
40 #include "cc/layers/effect_tree_layer_list_iterator.h" 41 #include "cc/layers/effect_tree_layer_list_iterator.h"
41 #include "cc/layers/heads_up_display_layer_impl.h" 42 #include "cc/layers/heads_up_display_layer_impl.h"
42 #include "cc/layers/layer_impl.h" 43 #include "cc/layers/layer_impl.h"
43 #include "cc/layers/painted_scrollbar_layer_impl.h" 44 #include "cc/layers/painted_scrollbar_layer_impl.h"
44 #include "cc/layers/render_surface_impl.h" 45 #include "cc/layers/render_surface_impl.h"
45 #include "cc/layers/scrollbar_layer_impl_base.h" 46 #include "cc/layers/scrollbar_layer_impl_base.h"
46 #include "cc/layers/surface_layer_impl.h" 47 #include "cc/layers/surface_layer_impl.h"
47 #include "cc/layers/viewport.h" 48 #include "cc/layers/viewport.h"
48 #include "cc/output/compositor_frame.h" 49 #include "cc/output/compositor_frame.h"
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 } 2789 }
2789 } 2790 }
2790 2791
2791 auto* scrolling_layer = FindScrollLayerForDeviceViewportPoint( 2792 auto* scrolling_layer = FindScrollLayerForDeviceViewportPoint(
2792 device_viewport_point, type, layer_impl, &scroll_on_main_thread, 2793 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2793 &scroll_status.main_thread_scrolling_reasons); 2794 &scroll_status.main_thread_scrolling_reasons);
2794 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; 2795 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree;
2795 scrolling_node = 2796 scrolling_node =
2796 scrolling_layer ? scroll_tree.Node(scrolling_layer->scroll_tree_index()) 2797 scrolling_layer ? scroll_tree.Node(scrolling_layer->scroll_tree_index())
2797 : nullptr; 2798 : nullptr;
2799 if (!scroll_on_main_thread && scrolling_node &&
2800 !viewport()->MainScrollLayer()) {
bokan 2017/04/18 19:24:38 It'd be safer to check that the node is neither th
yigu 2017/04/19 20:53:05 Done.
2801 if (IsWheelBasedScroll(type)) {
2802 UMA_HISTOGRAM_CUSTOM_COUNTS(
2803 "Event.Scroll.ScrollerSize.OnScroll_Wheel",
2804 scrolling_node->scroll_clip_layer_bounds.GetArea(), 1,
2805 kMaxScrollerSize, kBucketNum);
2806 } else {
2807 UMA_HISTOGRAM_CUSTOM_COUNTS(
2808 "Event.Scroll.ScrollerSize.OnScroll_Touch",
2809 scrolling_node->scroll_clip_layer_bounds.GetArea(), 1,
2810 kMaxScrollerSize, kBucketNum);
2811 }
2812 }
2798 } 2813 }
2799 2814
2800 if (scroll_on_main_thread) { 2815 if (scroll_on_main_thread) {
2801 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); 2816 RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
2802 2817
2803 scroll_status.thread = SCROLL_ON_MAIN_THREAD; 2818 scroll_status.thread = SCROLL_ON_MAIN_THREAD;
2804 return scroll_status; 2819 return scroll_status;
2805 } else if (scrolling_node) { 2820 } else if (scrolling_node) {
2806 scroll_affects_scroll_handler_ = active_tree_->have_scroll_event_handlers(); 2821 scroll_affects_scroll_handler_ = active_tree_->have_scroll_event_handlers();
2807 } 2822 }
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 } 4313 }
4299 4314
4300 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { 4315 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
4301 if (is_wheel_scroll) 4316 if (is_wheel_scroll)
4302 has_scrolled_by_wheel_ = true; 4317 has_scrolled_by_wheel_ = true;
4303 else 4318 else
4304 has_scrolled_by_touch_ = true; 4319 has_scrolled_by_touch_ = true;
4305 } 4320 }
4306 4321
4307 } // namespace cc 4322 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698