Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2689563008: Fix WebVR does not properly stop presenting if requestPresent rejects. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index 0c6bc0ed5a89f78159ed2d4a30dfb87394962ac2..fd470f8926c4f414ce54352103eb2c3e4772cde3 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -251,7 +251,13 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState,
// A valid number of layers must be provided in order to present.
if (layers.size() == 0 || layers.size() > m_capabilities->maxLayers()) {
- forceExitPresent();
+ if (m_isPresenting) {
mthiesse 2017/02/13 15:33:34 You should fix VRDisplay::forceExitPresent(), rath
shaobo.yan 2017/02/14 06:12:35 Done.
+ if (m_display) {
+ m_display->ExitPresent();
+ } else {
+ forceExitPresent();
+ }
+ }
DOMException* exception =
DOMException::create(InvalidStateError, "Invalid number of layers.");
resolver->reject(exception);
@@ -262,7 +268,13 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState,
// If what we were given has an invalid source, need to exit fullscreen with
// previous, valid source, so delay m_layer reassignment
if (!layers[0].source()) {
- forceExitPresent();
+ if (m_isPresenting) {
+ if (m_display) {
+ m_display->ExitPresent();
+ } else {
+ forceExitPresent();
+ }
+ }
DOMException* exception =
DOMException::create(InvalidStateError, "Invalid layer source.");
resolver->reject(exception);
@@ -275,7 +287,13 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState,
m_layer.source()->renderingContext();
if (!renderingContext || !renderingContext->is3d()) {
- forceExitPresent();
+ if (m_isPresenting) {
+ if (m_display) {
+ m_display->ExitPresent();
+ } else {
+ forceExitPresent();
+ }
+ }
DOMException* exception = DOMException::create(
InvalidStateError, "Layer source must have a WebGLRenderingContext");
resolver->reject(exception);
@@ -291,7 +309,13 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState,
if ((m_layer.leftBounds().size() != 0 && m_layer.leftBounds().size() != 4) ||
(m_layer.rightBounds().size() != 0 &&
m_layer.rightBounds().size() != 4)) {
- forceExitPresent();
+ if (m_isPresenting) {
+ if (m_display) {
+ m_display->ExitPresent();
+ } else {
+ forceExitPresent();
+ }
+ }
DOMException* exception = DOMException::create(
InvalidStateError,
"Layer bounds must either be an empty array or have 4 values");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698