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

Unified Diff: content/renderer/input/render_widget_input_handler.cc

Issue 1888163003: Articulate the cancel behavior in the WebTouchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and non-const ref passed back Created 4 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 side-by-side diff with in-line comments
Download patch
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 401ce9691783d5d5c6a037e9d01224a5d02f0daf..c316cb93262a1caebd415ced69dd23ab6b1ab183 100644
--- a/content/renderer/input/render_widget_input_handler.cc
+++ b/content/renderer/input/render_widget_input_handler.cc
@@ -123,8 +123,7 @@ void LogPassiveLatency(int64_t latency) {
}
void LogPassiveEventListenersUma(WebInputEventResult result,
- bool non_blocking,
- bool cancelable,
+ WebInputEvent::DispatchType dispatch_type,
double event_timestamp,
const ui::LatencyInfo& latency_info) {
enum {
@@ -133,20 +132,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::ListenersForcedNonBlockingPassive:
+ enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING;
+ break;
+ case WebInputEvent::ListenersNonBlockingPassive:
+ enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
+ break;
+ case WebInputEvent::EventNonBlocking:
+ 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);
@@ -306,10 +318,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
@@ -317,11 +325,16 @@ 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,
+ bool non_blocking =
+ dispatch_type ==
+ InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING_NOTIFY_MAIN ||
+ dispatch_type == InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING;
+ LogPassiveEventListenersUma(processed,
+ non_blocking ? WebInputEvent::EventNonBlocking
+ : WebInputEvent::Blocking,
input_event.timeStampSeconds, latency_info);
}
« no previous file with comments | « content/renderer/input/main_thread_event_queue_unittest.cc ('k') | content/renderer/render_widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698