| 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 1480df6785b9b4e392e0ccdfd209e937ac9dddc1..32e4462f7e2bea19eecb27e92955cf896004bfdd 100644
|
| --- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
|
| +++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
|
| @@ -69,6 +69,7 @@ VRDisplay::VRDisplay(NavigatorVR* navigatorVR)
|
| m_depthNear(0.01),
|
| m_depthFar(10000.0),
|
| m_fullscreenCheckTimer(this, &VRDisplay::onFullscreenCheck),
|
| + m_contextGL(nullptr),
|
| m_animationCallbackRequested(false),
|
| m_inAnimationFrame(false) {}
|
|
|
| @@ -110,6 +111,9 @@ void VRDisplay::disconnected() {
|
| bool VRDisplay::getFrameData(VRFrameData* frameData) {
|
| updatePose();
|
|
|
| + if (!m_framePose)
|
| + return false;
|
| +
|
| if (!frameData)
|
| return false;
|
|
|
| @@ -132,6 +136,10 @@ VRPose* VRDisplay::getPose() {
|
| }
|
|
|
| void VRDisplay::updatePose() {
|
| + if (m_displayBlurred) {
|
| + m_framePose = nullptr;
|
| + return;
|
| + }
|
| if (m_canUpdateFramePose) {
|
| m_framePose = controller()->getPose(m_displayId);
|
| if (m_isPresenting)
|
| @@ -174,6 +182,26 @@ void VRDisplay::cancelAnimationFrame(int id) {
|
| m_scriptedAnimationController->cancelCallback(id);
|
| }
|
|
|
| +void VRDisplay::onDisplayBlur() {
|
| + Document* doc = m_navigatorVR->document();
|
| + if (!doc)
|
| + return;
|
| + m_displayBlurred = true;
|
| + doc->suspendScheduledTasks();
|
| + m_scriptedAnimationController->suspend();
|
| + m_navigatorVR->fireVrDisplayOnBlur(this);
|
| +}
|
| +
|
| +void VRDisplay::onDisplayFocus() {
|
| + Document* doc = m_navigatorVR->document();
|
| + if (!doc)
|
| + return;
|
| + m_displayBlurred = false;
|
| + m_scriptedAnimationController->resume();
|
| + doc->resumeScheduledTasks();
|
| + m_navigatorVR->fireVrDisplayOnFocus(this);
|
| +}
|
| +
|
| void VRDisplay::serviceScriptedAnimations(double monotonicAnimationStartTime) {
|
| if (!m_scriptedAnimationController)
|
| return;
|
|
|