Bug 1430040 - Part 3: Closing Shmem only when VR process is shutdown. r=kip
authorDaosheng Mu <daoshengmu@gmail.com>
Fri, 28 Dec 2018 22:38:14 +0000
changeset 509581 2f31f4f0cad3e652f8fa9b9f14016f8bd59fa48d
parent 509580 b9639fb9f845380e41deeda4b8b14805b0aaa183
child 509582 ec8667678f3a7fa4d6259b070a35a4c4a5c14209
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskip
bugs1430040
milestone66.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 1430040 - Part 3: Closing Shmem only when VR process is shutdown. r=kip Differential Revision: https://phabricator.services.mozilla.com/D15418
gfx/vr/gfxVRExternal.cpp
gfx/vr/service/OpenVRSession.cpp
--- a/gfx/vr/gfxVRExternal.cpp
+++ b/gfx/vr/gfxVRExternal.cpp
@@ -434,20 +434,16 @@ VRSystemManagerExternal::VRSystemManager
   mShmemFD = 0;
 #elif defined(XP_WIN)
   mShmemFile = NULL;
 #elif defined(MOZ_WIDGET_ANDROID)
   mExternalStructFailed = false;
   mEnumerationCompleted = false;
 #endif
   mDoShutdown = false;
-
-  if (!aAPIShmem) {
-    OpenShmem();
-  }
 }
 
 VRSystemManagerExternal::~VRSystemManagerExternal() { CloseShmem(); }
 
 void VRSystemManagerExternal::OpenShmem() {
   if (mExternalShmem) {
     return;
 #if defined(MOZ_WIDGET_ANDROID)
--- a/gfx/vr/service/OpenVRSession.cpp
+++ b/gfx/vr/service/OpenVRSession.cpp
@@ -1814,17 +1814,20 @@ void OpenVRSession::ProcessEvents(mozill
         break;
       case ::vr::EVREventType::VREvent_TrackedDeviceDeactivated:
         if (event.trackedDeviceIndex == ::vr::k_unTrackedDeviceIndex_Hmd) {
           aSystemState.displayState.mIsConnected = false;
         }
         break;
       case ::vr::EVREventType::VREvent_DriverRequestedQuit:
       case ::vr::EVREventType::VREvent_Quit:
-      case ::vr::EVREventType::VREvent_ProcessQuit:
+      // When SteamVR runtime haven't been launched before viewing VR,
+      // SteamVR will send a VREvent_ProcessQuit event. It will tell the parent
+      // process to shutdown the VR process, and we need to avoid it.
+      // case ::vr::EVREventType::VREvent_ProcessQuit:
       case ::vr::EVREventType::VREvent_QuitAcknowledged:
       case ::vr::EVREventType::VREvent_QuitAborted_UserPrompt:
         mShouldQuit = true;
         break;
       default:
         // ignore
         break;
     }