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 90ca85893a1dba6d395f01e30cc1e8939fda4794..f21d3df6c99764e4c87e105e2a68ffe40606e921 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp |
@@ -168,10 +168,44 @@ ScriptPromise VRDisplay::requestPresent(ScriptState* scriptState, const HeapVect |
// Check to see if the canvas is still the current fullscreen |
// element once per second. |
m_fullscreenCheckTimer.startRepeating(1.0, BLINK_FROM_HERE); |
+ |
+ controller()->requestPresent(m_displayId); |
} else { |
DOMException* exception = DOMException::create(InvalidStateError, "VR Presentation not implemented for this VRDisplay"); |
resolver->reject(exception); |
} |
+ |
+ // Set up the texture bounds for the provided layer |
+ device::blink::VRLayerBoundsPtr leftBounds = device::blink::VRLayerBounds::New(); |
+ device::blink::VRLayerBoundsPtr rightBounds = device::blink::VRLayerBounds::New(); |
+ |
+ if (m_layer.hasLeftBounds()) { |
+ leftBounds->left = m_layer.leftBounds()[0]; |
+ leftBounds->top = m_layer.leftBounds()[1]; |
+ leftBounds->width = m_layer.leftBounds()[2]; |
+ leftBounds->height = m_layer.leftBounds()[3]; |
+ } else { |
+ // Left eye defaults |
+ leftBounds->left = 0.0f; |
+ leftBounds->top = 0.0f; |
+ leftBounds->width = 0.5f; |
+ leftBounds->height = 1.0f; |
+ } |
+ |
+ if (m_layer.hasRightBounds()) { |
+ rightBounds->left = m_layer.rightBounds()[0]; |
+ rightBounds->top = m_layer.rightBounds()[1]; |
+ rightBounds->width = m_layer.rightBounds()[2]; |
+ rightBounds->height = m_layer.rightBounds()[3]; |
+ } else { |
+ // Right eye defaults |
+ rightBounds->left = 0.5f; |
+ rightBounds->top = 0.0f; |
+ rightBounds->width = 0.5f; |
+ rightBounds->height = 1.0f; |
+ } |
+ |
+ controller()->updateLayerBounds(m_displayId, std::move(leftBounds), std::move(rightBounds)); |
} else { |
DOMException* exception = DOMException::create(InvalidStateError, "Invalid layer source"); |
resolver->reject(exception); |
@@ -195,6 +229,7 @@ ScriptPromise VRDisplay::exitPresent(ScriptState* scriptState) |
if (!m_capabilities->hasExternalDisplay()) { |
Fullscreen::fullyExitFullscreen(m_layer.source()->document()); |
m_fullscreenCheckTimer.stop(); |
+ controller()->exitPresent(m_displayId); |
} else { |
// Can't get into this presentation mode, so nothing to do here. |
} |
@@ -222,6 +257,7 @@ HeapVector<VRLayer> VRDisplay::getLayers() |
void VRDisplay::submitFrame(VRPose* pose) |
{ |
+ controller()->submitFrame(m_displayId); |
} |
void VRDisplay::didProcessTask() |
@@ -244,6 +280,7 @@ void VRDisplay::onFullscreenCheck(TimerBase*) |
m_isPresenting = false; |
m_navigatorVR->fireVRDisplayPresentChange(this); |
m_fullscreenCheckTimer.stop(); |
+ controller()->exitPresent(m_displayId); |
} |
} |