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

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

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: Implement Blur/Focus in MockVRServiceClient Created 4 years, 1 month 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
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();
dcheng 2016/11/04 05:24:46 Why do we want to suspend scheduled tasks? This wi
mthiesse 2016/11/04 17:20:36 I'll remove this in the next patchset. My thinking
+ 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;

Powered by Google App Engine
This is Rietveld 408576698