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; ...@@ -52,8 +52,10 @@ class MomentumScrollJankTracker;
// This class is a proxy between the blink web input events for a WebWidget and // This class is a proxy between the blink web input events for a WebWidget and
// the compositor's input handling logic. InputHandlerProxy instances live // the compositor's input handling logic. InputHandlerProxy instances live
// entirely on the compositor thread. Each InputHandler instance handles input // entirely on the compositor thread if one exists; however, it can exist on
// events intended for a specific WebWidget. // 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 class BLINK_PLATFORM_EXPORT InputHandlerProxy
: public cc::InputHandlerClient, : public cc::InputHandlerClient,
public SynchronousInputHandlerProxy, public SynchronousInputHandlerProxy,
......
...@@ -397,15 +397,17 @@ void WidgetInputHandlerManager::DispatchScrollGestureToCompositor( ...@@ -397,15 +397,17 @@ void WidgetInputHandlerManager::DispatchScrollGestureToCompositor(
std::unique_ptr<WebCoalescedInputEvent> web_scoped_gesture_event = std::unique_ptr<WebCoalescedInputEvent> web_scoped_gesture_event =
std::make_unique<WebCoalescedInputEvent>(std::move(event), std::make_unique<WebCoalescedInputEvent>(std::move(event),
ui::LatencyInfo()); ui::LatencyInfo());
DCHECK(compositor_task_runner_); // input thread task runner is |main_thread_task_runner_| only in tests
compositor_task_runner_->PostTask( InputThreadTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&WidgetInputHandlerManager:: FROM_HERE,
HandleInputEventWithLatencyInfoOnCompositor, base::BindOnce(&WidgetInputHandlerManager::
this, std::move(web_scoped_gesture_event))); HandleInputEventWithLatencyOnInputHandlingThread,
this, std::move(web_scoped_gesture_event)));
} }
void WidgetInputHandlerManager::HandleInputEventWithLatencyInfoOnCompositor( void WidgetInputHandlerManager::
std::unique_ptr<WebCoalescedInputEvent> event) { HandleInputEventWithLatencyOnInputHandlingThread(
std::unique_ptr<WebCoalescedInputEvent> event) {
DCHECK(base::FeatureList::IsEnabled(features::kScrollUnification)); DCHECK(base::FeatureList::IsEnabled(features::kScrollUnification));
DCHECK(input_handler_proxy_); DCHECK(input_handler_proxy_);
input_handler_proxy_->HandleInputEventWithLatencyInfo(std::move(event), input_handler_proxy_->HandleInputEventWithLatencyInfo(std::move(event),
......
...@@ -227,7 +227,7 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final ...@@ -227,7 +227,7 @@ class PLATFORM_EXPORT WidgetInputHandlerManager final
const WebGestureEvent& gesture_event, const WebGestureEvent& gesture_event,
const cc::InputHandlerScrollResult& scroll_result); const cc::InputHandlerScrollResult& scroll_result);
void HandleInputEventWithLatencyInfoOnCompositor( void HandleInputEventWithLatencyOnInputHandlingThread(
std::unique_ptr<WebCoalescedInputEvent>); std::unique_ptr<WebCoalescedInputEvent>);
// Returns the task runner for the thread that receives input. i.e. the // 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