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

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

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: Address comments && add unit tests 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 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 scroll_status.thread = SCROLL_UNKNOWN; 2762 scroll_status.thread = SCROLL_UNKNOWN;
2762 scroll_status.main_thread_scrolling_reasons = 2763 scroll_status.main_thread_scrolling_reasons =
2763 MainThreadScrollingReason::kFailedHitTest; 2764 MainThreadScrollingReason::kFailedHitTest;
2764 return scroll_status; 2765 return scroll_status;
2765 } 2766 }
2766 } 2767 }
2767 2768
2768 scrolling_node = FindScrollNodeForDeviceViewportPoint( 2769 scrolling_node = FindScrollNodeForDeviceViewportPoint(
2769 device_viewport_point, type, layer_impl, &scroll_on_main_thread, 2770 device_viewport_point, type, layer_impl, &scroll_on_main_thread,
2770 &scroll_status.main_thread_scrolling_reasons); 2771 &scroll_status.main_thread_scrolling_reasons);
2772 if (!scroll_on_main_thread && scrolling_node &&
2773 InnerViewportScrollLayer() && OuterViewportScrollLayer() &&
flackr 2017/04/20 07:15:01 Why do we need to have a inner and outer viewport
bokan 2017/04/20 14:34:06 I think it's meant to null check the conditions be
2774 scrolling_node->element_id !=
2775 InnerViewportScrollLayer()->element_id() &&
2776 scrolling_node->element_id !=
2777 OuterViewportScrollLayer()->element_id()) {
2778 if (IsWheelBasedScroll(type)) {
2779 UMA_HISTOGRAM_CUSTOM_COUNTS(
2780 "Event.Scroll.ScrollerSize.OnScroll_Wheel",
2781 scrolling_node->scroll_clip_layer_bounds.GetArea(), 1,
2782 kMaxScrollerSize, kScrollerSizeBucketCount);
2783 } else {
2784 UMA_HISTOGRAM_CUSTOM_COUNTS(
2785 "Event.Scroll.ScrollerSize.OnScroll_Touch",
2786 scrolling_node->scroll_clip_layer_bounds.GetArea(), 1,
2787 kMaxScrollerSize, kScrollerSizeBucketCount);
2788 }
2789 }
2771 } 2790 }
2772 2791
2773 if (scroll_on_main_thread) { 2792 if (scroll_on_main_thread) {
2774 RecordCompositorSlowScrollMetric(type, MAIN_THREAD); 2793 RecordCompositorSlowScrollMetric(type, MAIN_THREAD);
2775 2794
2776 scroll_status.thread = SCROLL_ON_MAIN_THREAD; 2795 scroll_status.thread = SCROLL_ON_MAIN_THREAD;
2777 return scroll_status; 2796 return scroll_status;
2778 } else if (scrolling_node) { 2797 } else if (scrolling_node) {
2779 scroll_affects_scroll_handler_ = active_tree_->have_scroll_event_handlers(); 2798 scroll_affects_scroll_handler_ = active_tree_->have_scroll_event_handlers();
2780 } 2799 }
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
4277 } 4296 }
4278 4297
4279 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { 4298 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
4280 if (is_wheel_scroll) 4299 if (is_wheel_scroll)
4281 has_scrolled_by_wheel_ = true; 4300 has_scrolled_by_wheel_ = true;
4282 else 4301 else
4283 has_scrolled_by_touch_ = true; 4302 has_scrolled_by_touch_ = true;
4284 } 4303 }
4285 4304
4286 } // namespace cc 4305 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698