Chromium Code Reviews| Index: content/renderer/input/render_widget_input_handler.cc |
| diff --git a/content/renderer/input/render_widget_input_handler.cc b/content/renderer/input/render_widget_input_handler.cc |
| index 7914eea088138371c0c2801e3f51be82cc5250a8..261f7799da32cd89fca860991c1cf7e050c2a67a 100644 |
| --- a/content/renderer/input/render_widget_input_handler.cc |
| +++ b/content/renderer/input/render_widget_input_handler.cc |
| @@ -122,8 +122,7 @@ void LogPassiveLatency(int64_t latency) { |
| } |
| void LogPassiveEventListenersUma(WebInputEventResult result, |
|
tdresser
2016/04/18 15:12:02
Could we add some kind of test for this? Worst cas
dtapuska
2016/04/18 19:19:33
Done.
|
| - bool non_blocking, |
| - bool cancelable, |
| + WebInputEvent::DispatchType dispatch_type, |
| double event_timestamp, |
| const ui::LatencyInfo& latency_info) { |
| enum { |
| @@ -132,20 +131,33 @@ void LogPassiveEventListenersUma(WebInputEventResult result, |
| PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, |
| PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, |
| PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, |
| + PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING, |
| PASSIVE_LISTENER_UMA_ENUM_COUNT |
| }; |
| int enum_value; |
| - if (non_blocking) |
| - enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; |
| - else if (!cancelable) |
| - enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; |
| - else if (result == WebInputEventResult::HandledApplication) |
| - enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; |
| - else if (result == WebInputEventResult::HandledSuppressed) |
| - enum_value = PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED; |
| - else |
| - enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; |
| + switch (dispatch_type) { |
| + case WebInputEvent::NonBlockingForced: |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING; |
| + break; |
| + case WebInputEvent::NonBlockingPassive: |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE; |
| + break; |
| + case WebInputEvent::NonBlocking: |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE; |
| + break; |
| + case WebInputEvent::Blocking: |
| + if (result == WebInputEventResult::HandledApplication) |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED; |
| + else if (result == WebInputEventResult::HandledSuppressed) |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED; |
| + else |
| + enum_value = PASSIVE_LISTENER_UMA_ENUM_CANCELABLE; |
| + break; |
| + default: |
| + NOTREACHED(); |
| + return; |
| + } |
| UMA_HISTOGRAM_ENUMERATION("Event.PassiveListeners", enum_value, |
| PASSIVE_LISTENER_UMA_ENUM_COUNT); |
| @@ -305,10 +317,6 @@ void RenderWidgetInputHandler::HandleInputEvent( |
| processed = widget_->webwidget()->handleInputEvent(input_event); |
| } |
| - bool non_blocking = |
| - dispatch_type == |
| - InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING_NOTIFY_MAIN || |
| - dispatch_type == InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING; |
| // TODO(dtapuska): Use the input_event.timeStampSeconds as the start |
| // ideally this should be when the event was sent by the compositor to the |
| // renderer. crbug.com/565348 |
| @@ -316,12 +324,17 @@ void RenderWidgetInputHandler::HandleInputEvent( |
| input_event.type == WebInputEvent::TouchMove || |
| input_event.type == WebInputEvent::TouchEnd) { |
| LogPassiveEventListenersUma( |
| - processed, non_blocking, |
| - static_cast<const WebTouchEvent&>(input_event).cancelable, |
| + processed, static_cast<const WebTouchEvent&>(input_event).dispatchType, |
| input_event.timeStampSeconds, latency_info); |
| } else if (input_event.type == WebInputEvent::MouseWheel) { |
| - LogPassiveEventListenersUma(processed, non_blocking, !non_blocking, |
| - input_event.timeStampSeconds, latency_info); |
| + bool non_blocking = |
| + dispatch_type == |
| + InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING_NOTIFY_MAIN || |
|
tdresser
2016/04/18 15:12:03
Would it be clearer to negate this boolean?
dtapuska
2016/04/18 19:19:33
can I leave this for now. It is going away in a fo
tdresser
2016/04/18 19:40:45
SGTM.
|
| + dispatch_type == InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING; |
| + LogPassiveEventListenersUma( |
| + processed, |
| + non_blocking ? WebInputEvent::NonBlocking : WebInputEvent::Blocking, |
| + input_event.timeStampSeconds, latency_info); |
| } |
| // If this RawKeyDown event corresponds to a browser keyboard shortcut and |