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

Unified Diff: ui/events/blink/input_handler_proxy.cc

Issue 2636583002: UMA metrics for fractions of wheel and touch scrolls blocked on the main thread. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/input_handler_proxy.cc
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 6b70036e9e7a645e0dfa4d39cc63c90f23bccd1d..86f1676edca0d6a890afa6a18a26355bfb1c3720 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -232,6 +232,13 @@ cc::InputHandler::ScrollInputType GestureScrollInputType(
: cc::InputHandler::TOUCHSCREEN;
}
+enum ScrollingThreadStatus {
+ SCROLLING_ON_COMPOSITOR,
+ SCROLLING_ON_COMPOSITOR_BLOCKED_ON_MAIN,
+ SCROLLING_ON_MAIN,
+ LAST_SCROLLING_THREAD_STATUS_VALUE = SCROLLING_ON_MAIN,
+};
+
} // namespace
namespace ui {
@@ -256,6 +263,7 @@ InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler,
uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()),
touchpad_and_wheel_scroll_latching_enabled_(false),
touch_start_result_(kEventDispositionUndefined),
+ mouse_wheel_result_(kEventDispositionUndefined),
current_overscroll_params_(nullptr),
has_ongoing_compositor_scroll_pinch_(false),
tick_clock_(base::MakeUnique<base::DefaultTickClock>()) {
@@ -585,6 +593,57 @@ void InputHandlerProxy::RecordMainThreadScrollingReasons(
}
}
+void InputHandlerProxy::RecordScrollingThreadStatus(
+ blink::WebGestureDevice device,
+ uint32_t reasons) {
+ static const char* kGestureHistogramName =
dtapuska 2017/01/13 21:57:58 why do we need static variables for these?
sahel 2017/01/17 18:30:30 So that we don't need to initialize the values for
+ "Renderer4.GestureScrollingThreadStatus";
dtapuska 2017/01/13 21:57:58 I think the names are a little funky but I see tha
sahel 2017/01/17 18:30:30 Yes, I tried to be consistent with RecordMainThrea
+ static const char* kWheelHistogramName =
+ "Renderer4.WheelScrollingThreadStatus";
+
+ DCHECK(device == blink::WebGestureDeviceTouchpad ||
+ device == blink::WebGestureDeviceTouchscreen);
+
+ if (device != blink::WebGestureDeviceTouchpad &&
+ device != blink::WebGestureDeviceTouchscreen) {
+ return;
+ }
+
+ ScrollingThreadStatus scrolling_thread_status = SCROLLING_ON_MAIN;
+ if (reasons == cc::MainThreadScrollingReason::kNotScrollingOnMain) {
+ int32_t event_disposition_result =
+ (device == blink::WebGestureDeviceTouchpad ? mouse_wheel_result_
+ : touch_start_result_);
+ switch (event_disposition_result) {
+ case kEventDispositionUndefined:
+ case DID_NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING:
+ case DID_HANDLE_NON_BLOCKING:
+ case DROP_EVENT:
+ scrolling_thread_status = SCROLLING_ON_COMPOSITOR;
+ break;
+ case DID_NOT_HANDLE:
+ scrolling_thread_status = SCROLLING_ON_COMPOSITOR_BLOCKED_ON_MAIN;
+ break;
+ default:
+ NOTREACHED();
+ scrolling_thread_status = SCROLLING_ON_COMPOSITOR;
+ }
+ }
+
+ // UMA_HISTOGRAM_ENUMERATION requires that the enum_max must be strictly
+ // greater than the sample value.
+ uint32_t scrolling_thread_status_enum_max =
dtapuska 2017/01/13 21:57:58 This can be const... and the name like kScrolingTh
sahel 2017/01/17 18:30:30 Done.
+ ScrollingThreadStatus::LAST_SCROLLING_THREAD_STATUS_VALUE + 1;
+
+ if (device == blink::WebGestureDeviceTouchscreen) {
+ UMA_HISTOGRAM_ENUMERATION(kGestureHistogramName, scrolling_thread_status,
+ scrolling_thread_status_enum_max);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION(kWheelHistogramName, scrolling_thread_status,
+ scrolling_thread_status_enum_max);
+ }
+}
+
bool InputHandlerProxy::ShouldAnimate(bool has_precise_scroll_deltas) const {
#if defined(OS_MACOSX)
// Mac does not smooth scroll wheel events (crbug.com/574283).
@@ -601,21 +660,28 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
if (!wheel_event.hasPreciseScrollingDeltas && fling_curve_)
CancelCurrentFling();
+ InputHandlerProxy::EventDisposition result = DROP_EVENT;
cc::EventListenerProperties properties =
input_handler_->GetEventListenerProperties(
cc::EventListenerClass::kMouseWheel);
switch (properties) {
case cc::EventListenerProperties::kPassive:
- return DID_HANDLE_NON_BLOCKING;
+ result = DID_HANDLE_NON_BLOCKING;
+ break;
case cc::EventListenerProperties::kBlockingAndPassive:
case cc::EventListenerProperties::kBlocking:
- return DID_NOT_HANDLE;
+ result = DID_NOT_HANDLE;
+ break;
case cc::EventListenerProperties::kNone:
- return DROP_EVENT;
+ result = DROP_EVENT;
+ break;
default:
NOTREACHED();
- return DROP_EVENT;
+ result = DROP_EVENT;
}
+
+ mouse_wheel_result_ = result;
+ return result;
}
InputHandlerProxy::EventDisposition InputHandlerProxy::FlingScrollByMouseWheel(
@@ -751,6 +817,8 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
RecordMainThreadScrollingReasons(gesture_event.sourceDevice,
scroll_status.main_thread_scrolling_reasons);
+ RecordScrollingThreadStatus(gesture_event.sourceDevice,
+ scroll_status.main_thread_scrolling_reasons);
InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE;
switch (scroll_status.thread) {

Powered by Google App Engine
This is Rietveld 408576698