Commit 9bcb6065 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix flaky layout tests with Mojo Input Messages on.

When I landed MojoInputMessages by default yesterday in
https://chromium-review.googlesource.com/789590 the
dispatchKeyEvent-focus.js layout test became flaky.

The cause was layout tests don't use a compositor thread and events
could have been placed out of order because events hitting the
WidgetInputHandlerImpl (setFocus would get queued in the
input_event_queue_ whereas events received would get executed right away)

There is no need for the input_event_queue_ to be passed when there is
no compositor_task_queue_ as that causes an extra thread hop that isn't
necessary.

BUG=722928

Change-Id: I6d40ec67072e2ef98f2ebac04e6e8d54c7282ad0
Reviewed-on: https://chromium-review.googlesource.com/793972Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519829}
parent 8b18c17e
...@@ -290,8 +290,11 @@ void WidgetInputHandlerManager::BindAssociatedChannel( ...@@ -290,8 +290,11 @@ void WidgetInputHandlerManager::BindAssociatedChannel(
mojom::WidgetInputHandlerAssociatedRequest request) { mojom::WidgetInputHandlerAssociatedRequest request) {
if (!request.is_pending()) if (!request.is_pending())
return; return;
// Don't pass the |input_event_queue_| on if we don't have a
// |compositor_task_runner_| as events might get out of order.
WidgetInputHandlerImpl* handler = new WidgetInputHandlerImpl( WidgetInputHandlerImpl* handler = new WidgetInputHandlerImpl(
this, main_thread_task_runner_, input_event_queue_, render_widget_); this, main_thread_task_runner_,
compositor_task_runner_ ? input_event_queue_ : nullptr, render_widget_);
handler->SetAssociatedBinding(std::move(request)); handler->SetAssociatedBinding(std::move(request));
} }
...@@ -299,8 +302,11 @@ void WidgetInputHandlerManager::BindChannel( ...@@ -299,8 +302,11 @@ void WidgetInputHandlerManager::BindChannel(
mojom::WidgetInputHandlerRequest request) { mojom::WidgetInputHandlerRequest request) {
if (!request.is_pending()) if (!request.is_pending())
return; return;
// Don't pass the |input_event_queue_| on if we don't have a
// |compositor_task_runner_| as events might get out of order.
WidgetInputHandlerImpl* handler = new WidgetInputHandlerImpl( WidgetInputHandlerImpl* handler = new WidgetInputHandlerImpl(
this, main_thread_task_runner_, input_event_queue_, render_widget_); this, main_thread_task_runner_,
compositor_task_runner_ ? input_event_queue_ : nullptr, render_widget_);
handler->SetBinding(std::move(request)); handler->SetBinding(std::move(request));
} }
......
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