Index: third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js |
diff --git a/third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js b/third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js |
index 53806a08cc9c733285ea14094fd57ceddf4a2625..2846e8d5b10834e100cc46bb5130446d8d39d2cc 100644 |
--- a/third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js |
+++ b/third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js |
@@ -24,10 +24,26 @@ let mockVRService = loadMojoModules( |
} |
} |
- requestPresent(secureOrigin) { |
+ requestPresent(secureOrigin, submitFrameClient) { |
+ this.submitFrameClient_ = submitFrameClient; |
return Promise.resolve({success: true}); |
} |
+ submitFrame(frameId, mailboxHolder) { |
+ // Trigger the submit completion callbacks here. WARNING: The |
+ // Javascript-based mojo mocks are *not* re-entrant. In the current |
+ // default implementation, Javascript calls display.submitFrame, and the |
+ // corresponding C++ code uses a reentrant mojo call that waits for |
+ // onSubmitFrameTransferred to indicate completion. This never finishes |
+ // when using the mocks since the incoming calls are queued until the |
+ // current execution context finishes. As a workaround, use the alternate |
+ // "WebVRExperimentalRendering" mode which works without reentrant calls, |
+ // the code only checks for completion on the *next* frame, see the |
+ // corresponding option setting in RuntimeEnabledFeatures.json5. |
+ this.submitFrameClient_.onSubmitFrameTransferred(); |
+ this.submitFrameClient_.onSubmitFrameRendered(); |
+ } |
+ |
setPose(pose) { |
if (pose == null) { |
this.vsync_provider_.pose_ = null; |
@@ -37,7 +53,9 @@ let mockVRService = loadMojoModules( |
} |
} |
- getVRVSyncProvider(request) { this.vsync_provider_.bind(request); } |
+ getVRVSyncProvider(request) { |
+ this.vsync_provider_.bind(request); |
+ } |
forceActivate(reason) { |
this.displayClient_.onActivate(reason); |