[tbb-commits] [tor-browser] 32/76: Bug 1758776 - Replace the unused mVRDisplayID with a bool. r=jgilbert, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:00 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit 4b5839c0b8a48075bbb5a4497795da223a9ac7d4
Author: Andrew McCreight <continuation at gmail.com>
AuthorDate: Thu Mar 10 17:40:43 2022 +0000

    Bug 1758776 - Replace the unused mVRDisplayID with a bool. r=jgilbert, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D140699
---
 gfx/vr/ipc/VRLayerParent.cpp | 15 ++++++++-------
 gfx/vr/ipc/VRLayerParent.h   |  3 +--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gfx/vr/ipc/VRLayerParent.cpp b/gfx/vr/ipc/VRLayerParent.cpp
index e7a8b4bf41d9f..b75a151027b26 100644
--- a/gfx/vr/ipc/VRLayerParent.cpp
+++ b/gfx/vr/ipc/VRLayerParent.cpp
@@ -14,9 +14,12 @@ using namespace layers;
 namespace gfx {
 
 VRLayerParent::VRLayerParent(uint32_t aVRDisplayID, const uint32_t aGroup)
-    : mIPCOpen(true), mVRDisplayID(aVRDisplayID), mGroup(aGroup) {}
+    : mIPCOpen(true), mDestroyed(false), mGroup(aGroup) {}
 
-VRLayerParent::~VRLayerParent() { MOZ_COUNT_DTOR(VRLayerParent); }
+VRLayerParent::~VRLayerParent() {
+  Destroy();
+  MOZ_COUNT_DTOR(VRLayerParent);
+}
 
 mozilla::ipc::IPCResult VRLayerParent::RecvDestroy() {
   Destroy();
@@ -26,12 +29,10 @@ mozilla::ipc::IPCResult VRLayerParent::RecvDestroy() {
 void VRLayerParent::ActorDestroy(ActorDestroyReason aWhy) { mIPCOpen = false; }
 
 void VRLayerParent::Destroy() {
-  if (mVRDisplayID) {
+  if (!mDestroyed) {
     VRManager* vm = VRManager::Get();
     vm->RemoveLayer(this);
-    // 0 will never be a valid VRDisplayID; we can use it to indicate that
-    // we are destroyed and no longer associated with a display.
-    mVRDisplayID = 0;
+    mDestroyed = true;
   }
 
   if (mIPCOpen) {
@@ -42,7 +43,7 @@ void VRLayerParent::Destroy() {
 mozilla::ipc::IPCResult VRLayerParent::RecvSubmitFrame(
     const layers::SurfaceDescriptor& aTexture, const uint64_t& aFrameId,
     const gfx::Rect& aLeftEyeRect, const gfx::Rect& aRightEyeRect) {
-  if (mVRDisplayID) {
+  if (!mDestroyed) {
     VRManager* vm = VRManager::Get();
     vm->SubmitFrame(this, aTexture, aFrameId, aLeftEyeRect, aRightEyeRect);
   }
diff --git a/gfx/vr/ipc/VRLayerParent.h b/gfx/vr/ipc/VRLayerParent.h
index 9fc2f32c0d5c8..559ee1c7de779 100644
--- a/gfx/vr/ipc/VRLayerParent.h
+++ b/gfx/vr/ipc/VRLayerParent.h
@@ -23,7 +23,6 @@ class VRLayerParent : public PVRLayerParent {
       const layers::SurfaceDescriptor& aTexture, const uint64_t& aFrameId,
       const gfx::Rect& aLeftEyeRect, const gfx::Rect& aRightEyeRect) override;
   virtual mozilla::ipc::IPCResult RecvDestroy() override;
-  uint32_t GetDisplayID() const { return mVRDisplayID; }
   uint32_t GetGroup() const { return mGroup; }
 
  protected:
@@ -34,7 +33,7 @@ class VRLayerParent : public PVRLayerParent {
 
   bool mIPCOpen;
 
-  uint32_t mVRDisplayID;
+  bool mDestroyed;
   gfx::Rect mLeftEyeRect;
   gfx::Rect mRightEyeRect;
   uint32_t mGroup;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list