Bug 1288193 - Ensure that the content process receives the presentation status of a VRDisplay immediately after adding or removing layers r=gw280
authorkearwood
Fri, 02 Sep 2016 14:45:54 -0700
changeset 312880 89b9735661b9f19ece9b6a2bb54b1c50d0556b34
parent 312879 cf5ad16b4d9eeb347d44fab3e7f0d2066eb752e4
child 312881 60856a997b32a1866523c230e4a73509d78ea568
push id30663
push usercbook@mozilla.com
push dateWed, 07 Sep 2016 15:12:31 +0000
treeherdermozilla-central@3d0b41fdd93b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw280
bugs1288193
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288193 - Ensure that the content process receives the presentation status of a VRDisplay immediately after adding or removing layers r=gw280 - Corrects issues with the onvrdisplaypresentationchange events being delayed by up to 5 seconds. - Caused a delay to enter or exit WebVR presentation on many sites. MozReview-Commit-ID: 2LACZNwKIxW
gfx/vr/VRDisplayHost.cpp
--- a/gfx/vr/VRDisplayHost.cpp
+++ b/gfx/vr/VRDisplayHost.cpp
@@ -40,26 +40,34 @@ VRDisplayHost::~VRDisplayHost()
 void
 VRDisplayHost::AddLayer(VRLayerParent *aLayer)
 {
   mLayers.AppendElement(aLayer);
   if (mLayers.Length() == 1) {
     StartPresentation();
   }
   mDisplayInfo.mIsPresenting = mLayers.Length() > 0;
+
+  // Ensure that the content process receives the change immediately
+  VRManager* vm = VRManager::Get();
+  vm->RefreshVRDisplays();
 }
 
 void
 VRDisplayHost::RemoveLayer(VRLayerParent *aLayer)
 {
   mLayers.RemoveElement(aLayer);
   if (mLayers.Length() == 0) {
     StopPresentation();
   }
   mDisplayInfo.mIsPresenting = mLayers.Length() > 0;
+
+  // Ensure that the content process receives the change immediately
+  VRManager* vm = VRManager::Get();
+  vm->RefreshVRDisplays();
 }
 
 #if defined(XP_WIN)
 
 void
 VRDisplayHost::SubmitFrame(VRLayerParent* aLayer, const int32_t& aInputFrameID,
   PTextureParent* aTexture, const gfx::Rect& aLeftEyeRect,
   const gfx::Rect& aRightEyeRect)