Index: content/browser/renderer_host/input/render_widget_host_latency_tracker.cc |
diff --git a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc |
index 8ebace902992f25699280254bcd8b17cf708a4a8..43cbf8224118d1ef885c960ea1ef9ca0b745d974 100644 |
--- a/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc |
+++ b/content/browser/renderer_host/input/render_widget_host_latency_tracker.cc |
@@ -134,6 +134,8 @@ std::string LatencySourceEventTypeToInputModalityString( |
return "Wheel"; |
case ui::SourceEventType::TOUCH: |
return "Touch"; |
+ case ui::SourceEventType::KEY: |
+ return "Key"; |
default: |
return ""; |
} |
@@ -190,7 +192,7 @@ void ComputeScrollLatencyHistograms( |
} |
} |
-void ComputeTouchAndWheelScrollLatencyHistograms( |
+void ComputeEndToEndLatencyHistograms( |
RenderWidgetHostDelegate* render_widget_host_delegate, |
const ui::LatencyInfo::LatencyComponent& gpu_swap_begin_component, |
const ui::LatencyInfo::LatencyComponent& gpu_swap_end_component, |
@@ -246,6 +248,13 @@ void ComputeTouchAndWheelScrollLatencyHistograms( |
"Event.Latency.ScrollUpdate.Touch.TimeToScrollUpdateSwapBegin2", |
original_component, gpu_swap_begin_component); |
} |
+ } else if (latency.FindLatency(ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, |
+ &original_component)) { |
+ if (input_modality == "Key") { |
+ UMA_HISTOGRAM_INPUT_LATENCY_HIGH_RESOLUTION_MICROSECONDS( |
+ "Event.Latency.EndToEnd.Key", original_component, |
+ gpu_swap_begin_component); |
+ } |
} else { |
// No original component found. |
return; |
@@ -362,7 +371,8 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( |
return; |
if (type != blink::WebInputEvent::MouseWheel && |
- !WebInputEvent::isTouchEventType(type)) { |
+ !WebInputEvent::isTouchEventType(type) && |
+ !WebInputEvent::isKeyboardEventType(type)) { |
return; |
} |
@@ -383,10 +393,12 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( |
if (type == blink::WebInputEvent::MouseWheel) { |
UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.WheelUI", |
ui_delta.InMicroseconds(), 1, 20000, 100); |
- } else { |
- DCHECK(WebInputEvent::isTouchEventType(type)); |
+ } else if (WebInputEvent::isTouchEventType(type)) { |
UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.TouchUI", |
ui_delta.InMicroseconds(), 1, 20000, 100); |
+ } else if (WebInputEvent::isKeyboardEventType(type)) { |
mfomitchev
2017/04/04 14:59:05
Can we make this a DCHECK instead of an if?
tdresser
2017/05/01 15:49:21
Added an else with NOTREACHED().
|
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.Browser.KeyUI", |
+ ui_delta.InMicroseconds(), 1, 20000, 50); |
} |
} |
@@ -397,6 +409,8 @@ void RenderWidgetHostLatencyTracker::ComputeInputLatencyHistograms( |
ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
tdresser
2017/05/01 15:49:21
Ack, this is still broken in the non-touch case. I
|
std::string event_name = WebInputEvent::GetName(type); |
+ if (WebInputEvent::isKeyboardEventType(type)) |
+ event_name = "KeyEvent"; |
std::string default_action_status = |
action_prevented ? "DefaultPrevented" : "DefaultAllowed"; |
@@ -566,9 +580,11 @@ void RenderWidgetHostLatencyTracker::OnFrameSwapped( |
} |
ui::SourceEventType source_event_type = latency.source_event_type(); |
+ |
if (source_event_type == ui::SourceEventType::WHEEL || |
- source_event_type == ui::SourceEventType::TOUCH) { |
- ComputeTouchAndWheelScrollLatencyHistograms( |
+ source_event_type == ui::SourceEventType::TOUCH || |
+ source_event_type == ui::SourceEventType::KEY) { |
+ ComputeEndToEndLatencyHistograms( |
render_widget_host_delegate_, gpu_swap_begin_component, |
gpu_swap_end_component, latency_component_id_, latency); |
} |