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

Unified Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 1861733002: Add touch drag UMA latency metric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually fix tests. 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/browser/renderer_host/input/input_router_impl.cc
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc
index 4f020675f6c9dede08ec957b15b5cd726d461bf5..50020aa5a3b055471d321999dad2c18adfc426e7 100644
--- a/content/browser/renderer_host/input/input_router_impl.cc
+++ b/content/browser/renderer_host/input/input_router_impl.cc
@@ -144,7 +144,7 @@ void InputRouterImpl::SendKeyboardEvent(
gesture_event_queue_.FlingHasBeenHalted();
// Only forward the non-native portions of our event.
- FilterAndSendWebInputEvent(key_event.event, key_event.latency);
+ FilterAndSendWebInputEvent(key_event.event, &key_event.latency);
}
void InputRouterImpl::SendGestureEvent(
@@ -190,7 +190,7 @@ void InputRouterImpl::SendMouseEventImmediately(
current_mouse_move_ = mouse_event;
}
- FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency);
+ FilterAndSendWebInputEvent(mouse_event.event, &mouse_event.latency);
}
void InputRouterImpl::SendTouchEventImmediately(
@@ -204,12 +204,12 @@ void InputRouterImpl::SendTouchEventImmediately(
UpdateTouchAckTimeoutEnabled();
}
- FilterAndSendWebInputEvent(touch_event.event, touch_event.latency);
+ FilterAndSendWebInputEvent(touch_event.event, &touch_event.latency);
}
void InputRouterImpl::SendGestureEventImmediately(
const GestureEventWithLatencyInfo& gesture_event) {
- FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency);
+ FilterAndSendWebInputEvent(gesture_event.event, &gesture_event.latency);
}
const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const {
@@ -291,7 +291,7 @@ void InputRouterImpl::OnGestureEventAck(
void InputRouterImpl::SendMouseWheelEventImmediately(
const MouseWheelEventWithLatencyInfo& wheel_event) {
- FilterAndSendWebInputEvent(wheel_event.event, wheel_event.latency);
+ FilterAndSendWebInputEvent(wheel_event.event, &wheel_event.latency);
}
void InputRouterImpl::OnMouseWheelEventAck(
@@ -339,14 +339,14 @@ bool InputRouterImpl::Send(IPC::Message* message) {
void InputRouterImpl::FilterAndSendWebInputEvent(
const WebInputEvent& input_event,
- const ui::LatencyInfo& latency_info) {
+ ui::LatencyInfo* latency_info) {
TRACE_EVENT1("input",
"InputRouterImpl::FilterAndSendWebInputEvent",
"type",
WebInputEventTraits::GetName(input_event.type));
TRACE_EVENT_WITH_FLOW2("input,benchmark,devtools.timeline",
"LatencyInfo.Flow",
- TRACE_ID_DONT_MANGLE(latency_info.trace_id()),
+ TRACE_ID_DONT_MANGLE(latency_info->trace_id()),
TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT,
"step", "SendInputEventUI",
"frameTreeNodeId", frame_tree_node_id_);
@@ -358,20 +358,21 @@ void InputRouterImpl::FilterAndSendWebInputEvent(
}
void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
- const ui::LatencyInfo& latency_info) {
+ ui::LatencyInfo* latency_info) {
output_stream_validator_.Validate(input_event);
- if (OfferToClient(input_event, latency_info))
+ if (OfferToClient(input_event, *latency_info))
return;
// Touch events should always indicate in the event whether they are
// cancelable (respect ACK disposition) or not except touchmove.
bool should_block = WebInputEventTraits::ShouldBlockEventStream(input_event);
- OfferToRenderer(input_event, latency_info,
+ OfferToRenderer(input_event,
should_block
? InputEventDispatchType::DISPATCH_TYPE_BLOCKING
- : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING);
+ : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING,
+ latency_info);
if (WebInputEvent::isTouchEventType(input_event.type) &&
input_event.type != WebInputEvent::TouchMove) {
@@ -382,7 +383,7 @@ void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
// Generate a synthetic ack if the event was sent so it doesn't block.
if (!should_block) {
ProcessInputEventAck(
- input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, latency_info,
+ input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, *latency_info,
WebInputEventTraits::GetUniqueTouchEventId(input_event),
IGNORING_DISPOSITION);
}
@@ -417,8 +418,8 @@ bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event,
}
bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event,
- const ui::LatencyInfo& latency_info,
- InputEventDispatchType dispatch_type) {
+ InputEventDispatchType dispatch_type,
+ ui::LatencyInfo* latency_info) {
// This conversion is temporary. WebInputEvent should be generated
// directly from ui::Event with the viewport coordinates. See
// crbug.com/563730.
@@ -427,8 +428,9 @@ bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event,
const WebInputEvent* event_to_send =
event_in_viewport ? event_in_viewport.get() : &input_event;
+ client_->OnForwardEventToRenderer(input_event, latency_info);
if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send,
- latency_info, dispatch_type))) {
+ *latency_info, dispatch_type))) {
// Ack messages for ignored ack event types should never be sent by the
// renderer. Consequently, such event types should not affect event time
// or in-flight event count metrics.

Powered by Google App Engine
This is Rietveld 408576698