Bug 1587366 - Fix VRManagerParent::GetVRActiveStatus race condition: Notify VRActiveStatus after a the VREventObserver is created. r=rbarker,daoshengmu

Notify VRActiveStatus after a the VREventObserver is created to prevent the VRManagerParent::GetVRActiveStatus race condition.
Call VRManager::Shutdown() when the app goes to background instead of calling it in the foreground event due to the inactivity timer.

Differential Revision: https://phabricator.services.mozilla.com/D48678

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Imanol Fernandez 2019-10-11 15:58:39 +00:00
Родитель 8e222cab72
Коммит 2d92d3cf9a
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -4070,6 +4070,10 @@ void nsGlobalWindowInner::DisableGamepadUpdates() {
void nsGlobalWindowInner::EnableVRUpdates() { void nsGlobalWindowInner::EnableVRUpdates() {
if (mHasVREvents && !mVREventObserver) { if (mHasVREvents && !mVREventObserver) {
mVREventObserver = new VREventObserver(this); mVREventObserver = new VREventObserver(this);
nsPIDOMWindowOuter* outer = GetOuterWindow();
if (outer && !outer->IsBackground()) {
mVREventObserver->StartActivity();
}
} }
} }

Просмотреть файл

@ -305,8 +305,9 @@ void VRManager::TaskTimerCallback(nsITimer* aTimer, void* aClosure) {
if (self->mAppPaused) { if (self->mAppPaused) {
// When the apps goes the background (e.g. Android) we should stop the // When the apps goes the background (e.g. Android) we should stop the
// tasks. // tasks and shutdown.
self->StopTasks(); self->StopTasks();
self->Shutdown();
} }
} }