Commit 936c6f5f authored by jamesr@chromium.org's avatar jamesr@chromium.org

Send the pending input event ack before the UpdateRect message

This can potentially cut the mouse move, mouse wheel, and touch move
latency for platforms that send the UpdateRect_ACK message within the
UpdateRect IPC handler. Today, it seems that windows and mac will
sometimes send the UpdateRect_ACK synchronously, while linux never will.

Patch also includes some extra instrumentation to make this easier to
track that we may or may not want to land.

BUG=none


Review URL: http://codereview.chromium.org/8820001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114141 0039d316-1c4b-4281-b951-d872f2087c98
parent 1969485f
......@@ -554,7 +554,8 @@ void RenderWidgetHost::StopHangMonitorTimeout() {
}
void RenderWidgetHost::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
TRACE_EVENT0("renderer_host", "RenderWidgetHost::ForwardMouseEvent");
TRACE_EVENT2("renderer_host", "RenderWidgetHost::ForwardMouseEvent",
"x", mouse_event.x, "y", mouse_event.y);
if (ignore_input_events_ || process_->IgnoreInputEvents())
return;
......
......@@ -481,8 +481,11 @@ void RenderWidget::OnHandleInputEvent(const IPC::Message& message) {
bool prevent_default = false;
if (WebInputEvent::isMouseEventType(input_event->type)) {
prevent_default = WillHandleMouseEvent(
*(static_cast<const WebMouseEvent*>(input_event)));
const WebMouseEvent& mouse_event =
*static_cast<const WebMouseEvent*>(input_event);
TRACE_EVENT2("renderer", "HandleMouseMove",
"x", mouse_event.x, "y", mouse_event.y);
prevent_default = WillHandleMouseEvent(mouse_event);
}
bool processed = prevent_default;
......@@ -879,6 +882,13 @@ void RenderWidget::DoDeferredUpdate() {
webwidget_->composite(false);
}
// If we're holding a pending input event ACK, send the ACK before sending the
// UpdateReply message so we can receive another input event before the
// UpdateRect_ACK on platforms where the UpdateRect_ACK is sent from within
// the UpdateRect IPC message handler.
if (pending_input_event_ack_.get())
Send(pending_input_event_ack_.release());
// If composite() called SwapBuffers, pending_update_params_ will be reset (in
// OnSwapBuffersPosted), meaning a message has been added to the
// updates_pending_swap_ queue, that will be sent later. Otherwise, we send
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment