From 681b4117d938db1bf794d8862ad4bcc9fd010eb7 Mon Sep 17 00:00:00 2001 From: Daosheng Mu Date: Thu, 31 Oct 2019 22:10:43 +0000 Subject: [PATCH] Bug 1592713 - Avoid to update VR HMD sensor states when pages are not in the presenting mode. r=kip Differential Revision: https://phabricator.services.mozilla.com/D51288 --HG-- extra : moz-landing-system : lando --- dom/vr/VRDisplay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/vr/VRDisplay.cpp b/dom/vr/VRDisplay.cpp index 779e8f2a1e9f..c1de63e10e9d 100644 --- a/dom/vr/VRDisplay.cpp +++ b/dom/vr/VRDisplay.cpp @@ -393,7 +393,10 @@ void VRDisplay::UpdateFrameInfo() { * If we are not presenting WebVR content, the frame will never end and we * should return the latest frame data always. */ - if (mFrameInfo.IsDirty() || !mPresentation) { + mFrameInfo.Clear(); + + if ( (mFrameInfo.IsDirty() && IsPresenting()) || + mClient->GetDisplayInfo().GetPresentingGroups() == 0) { const gfx::VRHMDSensorState& state = mClient->GetSensorState(); const gfx::VRDisplayInfo& info = mClient->GetDisplayInfo(); mFrameInfo.Update(info, state, mDepthNear, mDepthFar);