Bug 1346923 - Remove PVRManager::GetDisplays sync IPC draft
authorKearwood Gilbert <kgilbert@mozilla.com>
Wed, 15 Mar 2017 16:40:57 -0700
changeset 499560 08672037ca58504b3a3fce9cb4b46559fd704305
parent 499337 8c89d1991786625a64d868798281610872a2bc26
child 549393 cfc66c0338e1af5694322015da1857957e9617ec
push id49452
push userbmo:kgilbert@mozilla.com
push dateWed, 15 Mar 2017 23:56:18 +0000
bugs1346923
milestone55.0a1
Bug 1346923 - Remove PVRManager::GetDisplays sync IPC - PVRManager::GetDisplays was a sync IPC that was part of an optimization for a use case that has been eliminated by changes to the WebVR spec. - This was an optimization for Navigator.activeVRDisplays that would allow enumeration of displays active in any content process without powering on any additional VR hardware. This will no longer be necessary as the activeVRDisplays has been restricted to returning only the displays active in the current javascript context. MozReview-Commit-ID: F6sOtM9nups
gfx/vr/ipc/PVRManager.ipdl
gfx/vr/ipc/VRManagerChild.cpp
gfx/vr/ipc/VRManagerParent.cpp
gfx/vr/ipc/VRManagerParent.h
ipc/ipdl/sync-messages.ini
--- a/gfx/vr/ipc/PVRManager.ipdl
+++ b/gfx/vr/ipc/PVRManager.ipdl
@@ -40,20 +40,16 @@ parent:
                  TextureFlags aTextureFlags, uint64_t aSerial);
 
   async PVRLayer(uint32_t aDisplayID, float aLeftEyeX, float aLeftEyeY, float aLeftEyeWidth, float aLeftEyeHeight, float aRightEyeX, float aRightEyeY, float aRightEyeWidth, float aRightEyeHeight);
 
   // (Re)Enumerate VR Displays.  An updated list of VR displays will be returned
   // asynchronously to children via UpdateDisplayInfo.
   async RefreshDisplays();
 
-  // GetDisplays synchronously returns the VR displays that have already been
-  // enumerated by RefreshDisplays() but does not enumerate new ones.
-  sync GetDisplays() returns(VRDisplayInfo[] aDisplayInfo);
-
   // Reset the sensor of the display identified by aDisplayID so that the current
   // sensor state is the "Zero" position.
   async ResetSensor(uint32_t aDisplayID);
 
   sync GetSensorState(uint32_t aDisplayID) returns(VRHMDSensorState aState);
   sync SetHaveEventListener(bool aHaveEventListener);
 
   async ControllerListenerAdded();
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -287,26 +287,16 @@ VRManagerChild::RecvUpdateDisplayInfo(ns
   }
   mNavigatorCallbacks.Clear();
   return IPC_OK();
 }
 
 bool
 VRManagerChild::GetVRDisplays(nsTArray<RefPtr<VRDisplayClient>>& aDisplays)
 {
-  if (!mDisplaysInitialized) {
-    /**
-     * If we haven't received any asynchronous callback after requesting
-     * display enumeration with RefreshDisplays, get the existing displays
-     * that have already been enumerated by other VRManagerChild instances.
-     */
-    nsTArray<VRDisplayInfo> displays;
-    Unused << SendGetDisplays(&displays);
-    UpdateDisplayInfo(displays);
-  }
   aDisplays = mDisplays;
   return true;
 }
 
 bool
 VRManagerChild::RefreshVRDisplaysWithCallback(uint64_t aWindowId)
 {
   bool success = SendRefreshDisplays();
--- a/gfx/vr/ipc/VRManagerParent.cpp
+++ b/gfx/vr/ipc/VRManagerParent.cpp
@@ -237,24 +237,16 @@ VRManagerParent::RecvRefreshDisplays()
   // can resolve even if there are no changes to the VR Displays.
   VRManager* vm = VRManager::Get();
   vm->RefreshVRDisplays(true);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-VRManagerParent::RecvGetDisplays(nsTArray<VRDisplayInfo> *aDisplays)
-{
-  VRManager* vm = VRManager::Get();
-  vm->GetVRDisplayInfo(*aDisplays);
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 VRManagerParent::RecvResetSensor(const uint32_t& aDisplayID)
 {
   VRManager* vm = VRManager::Get();
   RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
   if (display != nullptr) {
     display->ZeroSensor();
   }
 
--- a/gfx/vr/ipc/VRManagerParent.h
+++ b/gfx/vr/ipc/VRManagerParent.h
@@ -81,17 +81,16 @@ protected:
                                               const float& aRightEyeWidth,
                                               const float& aRightEyeHeight) override;
   virtual bool DeallocPVRLayerParent(PVRLayerParent* actor) override;
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
   void OnChannelConnected(int32_t pid) override;
 
   virtual mozilla::ipc::IPCResult RecvRefreshDisplays() override;
-  virtual mozilla::ipc::IPCResult RecvGetDisplays(nsTArray<VRDisplayInfo> *aDisplays) override;
   virtual mozilla::ipc::IPCResult RecvResetSensor(const uint32_t& aDisplayID) override;
   virtual mozilla::ipc::IPCResult RecvGetSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState) override;
   virtual mozilla::ipc::IPCResult RecvSetHaveEventListener(const bool& aHaveEventListener) override;
   virtual mozilla::ipc::IPCResult RecvControllerListenerAdded() override;
   virtual mozilla::ipc::IPCResult RecvControllerListenerRemoved() override;
   virtual mozilla::ipc::IPCResult RecvCreateVRTestSystem() override;
   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestDisplay(const nsCString& aID, const uint32_t& aPromiseID) override;
   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestController(const nsCString& aID, const uint32_t& aPromiseID) override;
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -944,18 +944,16 @@ description =
 [PWebRenderBridge::UpdateImage]
 description =
 [PWebRenderBridge::DeleteImage]
 description =
 [PWebRenderBridge::DPSyncEnd]
 description =
 [PWebRenderBridge::DPGetSnapshot]
 description =
-[PVRManager::GetDisplays]
-description =
 [PVRManager::GetSensorState]
 description =
 [PVRManager::SetHaveEventListener]
 description =
 [PHal::GetCurrentBatteryInformation]
 description =
 [PHal::GetCurrentNetworkInformation]
 description =