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

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

Issue 2233543002: Make first TouchStart and first TouchMove events on a flinging layer non-blocking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new fling Created 4 years, 4 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 ebc894b4d2068aba2f37ca5fd5b85251c2a96468..b1fdadc9c2aa0a437712fb40d412b15b1520200f 100644
--- a/content/renderer/input/render_widget_input_handler.cc
+++ b/content/renderer/input/render_widget_input_handler.cc
@@ -127,14 +127,14 @@ 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_FORCED_NON_BLOCKING_DUE_TO_FLING,
PASSIVE_LISTENER_UMA_ENUM_COUNT
};
int enum_value;
switch (dispatch_type) {
- case WebInputEvent::ListenersForcedNonBlockingPassive:
- enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING;
+ case WebInputEvent::ListenersForcedNonBlockingPassiveDueToFling:
+ enum_value = PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING;
break;
case WebInputEvent::ListenersNonBlockingPassive:
enum_value = PASSIVE_LISTENER_UMA_ENUM_PASSIVE;
@@ -164,10 +164,11 @@ void LogPassiveEventListenersUma(WebInputEventResult result,
UMA_HISTOGRAM_CUSTOM_COUNTS("Event.PassiveListeners.Latency",
GetEventLatencyMicros(event_timestamp, now),
1, 10000000, 100);
- } else if (enum_value == PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING) {
+ } else if (enum_value ==
+ PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING) {
base::TimeTicks now = base::TimeTicks::Now();
UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Event.PassiveListeners.ForcedNonBlockingLatency",
+ "Event.PassiveListeners.ForcedNonBlockingLatencyDueToFling",
GetEventLatencyMicros(event_timestamp, now), 1, 10000000, 100);
}
}
@@ -185,7 +186,8 @@ RenderWidgetInputHandler::RenderWidgetInputHandler(
handling_event_type_(WebInputEvent::Undefined),
context_menu_source_type_(ui::MENU_SOURCE_MOUSE),
suppress_next_char_events_(false),
- ignore_ack_for_mouse_move_from_debugger_(false) {
+ ignore_ack_for_mouse_move_from_debugger_(false),
+ waiting_for_first_touch_move_(false) {
DCHECK(delegate);
DCHECK(widget);
delegate->SetInputHandler(this);
@@ -334,18 +336,22 @@ void RenderWidgetInputHandler::HandleInputEvent(
LogPassiveEventListenersUma(processed, touch.dispatchType,
input_event.timeStampSeconds, latency_info);
- if (input_event.type == WebInputEvent::TouchStart &&
- touch.dispatchType == WebInputEvent::Blocking &&
+ // TODO(lanwei): May remove it when we no longer need any metric for event
+ // latency outside fling.
+ if (touch.dispatchType == WebInputEvent::Blocking &&
base::TimeTicks::IsHighResolution()) {
- base::TimeTicks now = base::TimeTicks::Now();
- if (touch.dispatchedDuringFling) {
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Event.Touch.TouchStartLatencyDuringFling",
- GetEventLatencyMicros(input_event.timeStampSeconds, now), 1,
- 100000000, 50);
- } else {
+ bool touch_start_or_first_touch_move = false;
+ if (touch.type == WebInputEvent::TouchStart) {
+ waiting_for_first_touch_move_ = true;
+ touch_start_or_first_touch_move = true;
+ } else if (touch.type == WebInputEvent::TouchMove) {
+ touch_start_or_first_touch_move = waiting_for_first_touch_move_;
+ waiting_for_first_touch_move_ = false;
+ }
+ if (touch_start_or_first_touch_move) {
+ base::TimeTicks now = base::TimeTicks::Now();
UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Event.Touch.TouchStartLatencyOutsideFling",
+ "Event.Touch.TouchLatencyOutsideFling",
GetEventLatencyMicros(input_event.timeStampSeconds, now), 1,
100000000, 50);
}

Powered by Google App Engine
This is Rietveld 408576698