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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 681763003: Add input latency histograms for wheel events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 7e9dc75f05c4a6914b23cd0a17ce9ad73685cd20..5f90184ab12ca2973ee2ca2005f08b2082afff89 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -865,7 +865,7 @@ void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo(
ui::LatencyInfo::InputCoordinate logical_coordinate(mouse_event.x,
mouse_event.y);
- ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist(
+ ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
&ui_latency, mouse_event.type, &logical_coordinate, 1);
for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) {
@@ -899,7 +899,7 @@ void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo(
ui::LatencyInfo::InputCoordinate logical_coordinate(wheel_event.x,
wheel_event.y);
- ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist(
+ ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
&ui_latency, wheel_event.type, &logical_coordinate, 1);
if (IgnoreInputEvents())
@@ -931,7 +931,7 @@ void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo(
ui::LatencyInfo::InputCoordinate logical_coordinate(gesture_event.x,
gesture_event.y);
- ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist(
+ ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
&ui_latency, gesture_event.type, &logical_coordinate, 1);
if (gesture_event.type == blink::WebInputEvent::GestureScrollUpdate) {
@@ -974,7 +974,7 @@ void RenderWidgetHostImpl::ForwardEmulatedTouchEvent(
touch_event.touches[i].position.x, touch_event.touches[i].position.y);
}
- ui::LatencyInfo latency_info = CreateRWHLatencyInfoIfNotExist(
+ ui::LatencyInfo latency_info = CreateInputEventLatencyInfoIfNotExist(
NULL, touch_event.type, logical_coordinates, logical_coordinates_size);
TouchEventWithLatencyInfo touch_with_latency(touch_event, latency_info);
input_router_->SendTouchEvent(touch_with_latency);
@@ -999,7 +999,7 @@ void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo(
}
ui::LatencyInfo latency_info =
- CreateRWHLatencyInfoIfNotExist(&ui_latency,
+ CreateInputEventLatencyInfoIfNotExist(&ui_latency,
touch_event.type,
logical_coordinates,
logical_coordinates_size);
@@ -1083,7 +1083,7 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent(
input_router_->SendKeyboardEvent(
key_event,
- CreateRWHLatencyInfoIfNotExist(NULL, key_event.type, NULL, 0),
+ CreateInputEventLatencyInfoIfNotExist(NULL, key_event.type, NULL, 0),
is_shortcut);
}
@@ -1125,7 +1125,7 @@ void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() {
g_check_for_pending_resize_ack = false;
}
-ui::LatencyInfo RenderWidgetHostImpl::CreateRWHLatencyInfoIfNotExist(
+ui::LatencyInfo RenderWidgetHostImpl::CreateInputEventLatencyInfoIfNotExist(
const ui::LatencyInfo* original,
WebInputEvent::Type type,
const ui::LatencyInfo::InputCoordinate* logical_coordinates,
@@ -1897,14 +1897,15 @@ void RenderWidgetHostImpl::OnKeyboardEventAck(
void RenderWidgetHostImpl::OnWheelEventAck(
const MouseWheelEventWithLatencyInfo& wheel_event,
InputEventAckState ack_result) {
+ ui::LatencyInfo latency = wheel_event.latency;
if (!wheel_event.latency.FindLatency(
ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) {
// MouseWheelEvent latency ends when it is acked but does not cause any
// rendering scheduled.
- ui::LatencyInfo latency = wheel_event.latency;
latency.AddLatencyNumber(
ui::INPUT_EVENT_LATENCY_TERMINATED_MOUSE_COMPONENT, 0, 0);
}
+ CreateInputAckLatencyInfoAndHistogram("Wheel", &latency);
if (!is_hidden() && view_) {
if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
@@ -1940,15 +1941,13 @@ void RenderWidgetHostImpl::OnTouchEventAck(
const TouchEventWithLatencyInfo& event,
InputEventAckState ack_result) {
TouchEventWithLatencyInfo touch_event = event;
- touch_event.latency.AddLatencyNumber(
- ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0);
// TouchEvent latency ends at ack if it didn't cause any rendering.
if (!touch_event.latency.FindLatency(
ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) {
touch_event.latency.AddLatencyNumber(
ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0);
}
- ComputeTouchLatency(touch_event.latency);
+ CreateInputAckLatencyInfoAndHistogram("Touch", &touch_event.latency);
Yufeng Shen (Slow to review) 2014/10/28 15:51:24 Please add the acked component before adding the
if (touch_emulator_ &&
touch_emulator_->HandleTouchEventAck(event.event, ack_result)) {
@@ -2079,40 +2078,44 @@ void RenderWidgetHostImpl::DetachDelegate() {
delegate_ = NULL;
}
-void RenderWidgetHostImpl::ComputeTouchLatency(
- const ui::LatencyInfo& latency_info) {
- ui::LatencyInfo::LatencyComponent ui_component;
- ui::LatencyInfo::LatencyComponent rwh_component;
- ui::LatencyInfo::LatencyComponent acked_component;
+void RenderWidgetHostImpl::CreateInputAckLatencyInfoAndHistogram(
+ const std::string& type,
+ ui::LatencyInfo* latency_info) {
+ latency_info->AddLatencyNumber(
+ ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0);
- if (!latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
- 0,
- &ui_component) ||
- !latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
+ ui::LatencyInfo::LatencyComponent rwh_component;
+ if (!latency_info->FindLatency(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
GetLatencyComponentId(),
&rwh_component))
return;
-
- DCHECK(ui_component.event_count == 1);
DCHECK(rwh_component.event_count == 1);
- base::TimeDelta ui_delta =
- rwh_component.event_time - ui_component.event_time;
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Event.Latency.Browser.TouchUI",
- ui_delta.InMicroseconds(),
- 1,
- 20000,
- 100);
+ ui::LatencyInfo::LatencyComponent ui_component;
+ if (latency_info->FindLatency(ui::INPUT_EVENT_LATENCY_UI_COMPONENT,
+ 0,
+ &ui_component)) {
+ DCHECK(ui_component.event_count == 1);
- if (latency_info.FindLatency(ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT,
+ base::TimeDelta ui_delta =
+ rwh_component.event_time - ui_component.event_time;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ std::string("Event.Latency.Browser.") + type + std::string("UI"),
+ ui_delta.InMicroseconds(),
+ 1,
+ 20000,
+ 100);
+ }
+
+ ui::LatencyInfo::LatencyComponent acked_component;
+ if (latency_info->FindLatency(ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
0,
&acked_component)) {
DCHECK(acked_component.event_count == 1);
base::TimeDelta acked_delta =
acked_component.event_time - rwh_component.event_time;
UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Event.Latency.Browser.TouchAcked",
+ std::string("Event.Latency.Browser.") + type + std::string("Acked"),
acked_delta.InMicroseconds(),
1,
1000000,
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | ui/aura/gestures/gesture_recognizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698