Bug 1288193 - Ensure that the content process receives the presentation status of a VRDisplay immediately after adding or removing layers
- 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
--- 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)