Commit 11f6ef48 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Immediately complete synthetic gestures in VR

In https://crrev.com/b37e23cbd52ba447ab89c6d18f4ea0ecdc3fa5c0 I landed
a change to force synthetic gestures to cause a full redraw and wait for
the resulting CompositorFrame to be presented before invoking the
completion callback.

This patch broke VR telemetry. We never receive the presentation
notification so synthetic gestures never complete and cause the tests to
hang and timeout.

This CL causes synthetic gestures to complete without causing the redraw
and waiting for frame presentation if we're in VR mode. This was the
behavior prior to my change and gets the waterfall back to a green state.
I'll investigate a correct long term fix in a followup.

Bug: 940063
Change-Id: I6f6b9e9a5b9e369a1ec010cba93a1d952d3d0a18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1525150Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641677}
parent cd76eecb
......@@ -399,14 +399,16 @@ static void WaitForInputProcessedFromMain(
// TODO(bokan): The synchronous compositor doesn't support the
// RequestPresentation API yet so just ACK the gesture immediately so it
// doesn't hang forever. https://crbug.com/938956.
bool sync_compositing = false;
bool ack_immediately = false;
#if defined(OS_ANDROID)
sync_compositing = GetContentClient()->UsingSynchronousCompositing();
bool sync_compositing = GetContentClient()->UsingSynchronousCompositing();
bool is_vr = render_widget->delegate()->ShouldAckSyntheticInputImmediately();
ack_immediately = sync_compositing || is_vr;
#endif
// If the RenderWidget is hidden, we won't produce compositor frames for it
// so just ACK the input to prevent blocking the browser indefinitely.
if (render_widget->is_hidden() || sync_compositing) {
if (render_widget->is_hidden() || ack_immediately) {
manager->InvokeInputProcessedCallback();
return;
}
......
......@@ -1103,6 +1103,15 @@ void RenderViewImpl::DidHandleGestureEventForWidget(
observer.DidHandleGestureEvent(event);
}
bool RenderViewImpl::ShouldAckSyntheticInputImmediately() {
// TODO(bokan): The RequestPresentation API appears not to function in VR. As
// a short term workaround for https://crbug.com/940063, ACK input
// immediately rather than using RequestPresentation.
if (webkit_preferences_.immersive_mode_enabled)
return true;
return false;
}
void RenderViewImpl::DidCloseWidget() {
// The webview_ is already destroyed by the time we get here, remove any
// references to it.
......
......@@ -397,6 +397,7 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
bool SupportsMultipleWindowsForWidget() override;
void DidHandleGestureEventForWidget(
const blink::WebGestureEvent& event) override;
bool ShouldAckSyntheticInputImmediately() override;
void DidCloseWidget() override;
void CancelPagePopupForWidget() override;
void ApplyNewDisplayModeForWidget(
......
......@@ -46,6 +46,10 @@ class CONTENT_EXPORT RenderWidgetDelegate {
virtual void DidHandleGestureEventForWidget(
const blink::WebGestureEvent& event) = 0;
// TODO(bokan): Temporary to unblock synthetic gesture events running under
// VR. https://crbug.com/940063
virtual bool ShouldAckSyntheticInputImmediately() = 0;
// ==================================
// These methods called during closing of a RenderWidget.
//
......
......@@ -526,6 +526,7 @@ class StubRenderWidgetDelegate : public RenderWidgetDelegate {
bool SupportsMultipleWindowsForWidget() override { return true; }
void DidHandleGestureEventForWidget(
const blink::WebGestureEvent& event) override {}
bool ShouldAckSyntheticInputImmediately() override { return true; }
void DidCloseWidget() override {}
void CancelPagePopupForWidget() override {}
void ApplyNewDisplayModeForWidget(
......
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