Bug 1647436 - Fix leaked nsGlobalWindowInner instance in WebXR CC r=kip,daoshengmu
authorImanol Fernandez <mortimergoro@gmail.com>
Mon, 22 Jun 2020 20:26:56 +0000
changeset 536644 b32a0c476731a5cae6d7d69bb26e956ab0ed34cb
parent 536643 f97fcfd4a045519d4bea0be975f86a6ed9caa043
child 536645 506615a2d55dfe39ad12e746a39c2a89ff7b8855
push id37531
push usernbeleuzu@mozilla.com
push dateTue, 23 Jun 2020 03:44:39 +0000
treeherdermozilla-central@b1146cce5053 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskip, daoshengmu
bugs1647436
milestone79.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 1647436 - Fix leaked nsGlobalWindowInner instance in WebXR CC r=kip,daoshengmu Differential Revision: https://phabricator.services.mozilla.com/D80527
dom/vr/XRInputSource.cpp
dom/vr/XRSession.cpp
--- a/dom/vr/XRInputSource.cpp
+++ b/dom/vr/XRInputSource.cpp
@@ -11,17 +11,18 @@
 #include "XRInputSpace.h"
 
 #include "mozilla/dom/Gamepad.h"
 #include "mozilla/dom/GamepadManager.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(XRInputSource, mParent)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(XRInputSource, mParent, mTargetRaySpace,
+                                      mGripSpace, mGamepad)
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(XRInputSource, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(XRInputSource, Release)
 
 // Follow the controller profile ids from
 // https://github.com/immersive-web/webxr-input-profiles.
 nsTArray<nsString> GetInputSourceProfile(VRControllerType aType) {
   nsTArray<nsString> profile;
   nsString id;
--- a/dom/vr/XRSession.cpp
+++ b/dom/vr/XRSession.cpp
@@ -405,16 +405,19 @@ void XRSession::CancelAnimationFrame(int
 
 void XRSession::Shutdown() {
   mShutdown = true;
   ExitPresentInternal();
   mViewerPosePool.Clear();
   mViewerPosePoolIndex = 0;
   mFramePool.Clear();
   mFramePoolIndex = 0;
+  mActiveRenderState = nullptr;
+  mPendingRenderState = nullptr;
+  mFrameRequestCallbacks.Clear();
 
   // Unregister from nsRefreshObserver
   if (mRefreshDriver) {
     mRefreshDriver->RemoveRefreshObserver(this, FlushType::Display);
     mRefreshDriver = nullptr;
   }
 }