Commit e12a2416 authored by Liviu Tinta's avatar Liviu Tinta Committed by Commit Bot

If there is no compositor_task_runner queue Scroll Event to main thread

In web tests there is no compositor_task_runner. In this case we need to
use the main_thread_task_runner.

Bug: 1047198
Change-Id: I23cf2f46543eff84d11e694e81b2ce2e74b96b03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451324Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Liviu Tinta <liviutinta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815389}
parent 3f41afcd
......@@ -52,8 +52,10 @@ class MomentumScrollJankTracker;
// This class is a proxy between the blink web input events for a WebWidget and
// the compositor's input handling logic. InputHandlerProxy instances live
// entirely on the compositor thread. Each InputHandler instance handles input
// events intended for a specific WebWidget.
// entirely on the compositor thread if one exists; however, it can exist on
// the main thread in web tests where only a single thread is used.
// Each InputHandler instance handles input events intended for a specific
// WebWidget.
class BLINK_PLATFORM_EXPORT InputHandlerProxy
: public cc::InputHandlerClient,
public SynchronousInputHandlerProxy,
......
......@@ -397,14 +397,16 @@ void WidgetInputHandlerManager::DispatchScrollGestureToCompositor(
std::unique_ptr<WebCoalescedInputEvent> web_scoped_gesture_event =
std::make_unique<WebCoalescedInputEvent>(std::move(event),
ui::LatencyInfo());
DCHECK(compositor_task_runner_);
compositor_task_runner_->PostTask(
FROM_HERE, base::BindOnce(&WidgetInputHandlerManager::
HandleInputEventWithLatencyInfoOnCompositor,
// input thread task runner is |main_thread_task_runner_| only in tests
InputThreadTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&WidgetInputHandlerManager::
HandleInputEventWithLatencyOnInputHandlingThread,
this, std::move(web_scoped_gesture_event)));
}
void WidgetInputHandlerManager::HandleInputEventWithLatencyInfoOnCompositor(
void WidgetInputHandlerManager::
HandleInputEventWithLatencyOnInputHandlingThread(
std::unique_ptr<WebCoalescedInputEvent> event) {
DCHECK(base::FeatureList::IsEnabled(features::kScrollUnification));
DCHECK(input_handler_proxy_);
......
......@@ -227,7 +227,7 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final
const WebGestureEvent& gesture_event,
const cc::InputHandlerScrollResult& scroll_result);
void HandleInputEventWithLatencyInfoOnCompositor(
void HandleInputEventWithLatencyOnInputHandlingThread(
std::unique_ptr<WebCoalescedInputEvent>);
// Returns the task runner for the thread that receives input. i.e. the
......
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