Bug 1415645 - Part 2: Make CleanupCachedXBLHandlers a instance method, r=smaug
authorNika Layzell <nika@thelayzells.com>
Wed, 08 Nov 2017 11:18:12 -0500
changeset 391938 4a6c2c5490f454e53d3b962ea0ce9dd29c9da298
parent 391937 8fdfee217a97f07574a600f2868b06646debaf48
child 391939 9a766cc68671449c2c624816dff943d597a992a6
push id97372
push usernika@thelayzells.com
push dateWed, 15 Nov 2017 16:24:09 +0000
treeherdermozilla-inbound@c56352d90f67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1415645
milestone59.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 1415645 - Part 2: Make CleanupCachedXBLHandlers a instance method, r=smaug This will make the split easier, as this method is used by both nsGlobalWindowInner and nsGlobalWindowOuter. MozReview-Commit-ID: FsjK4y6x7NE
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1863,21 +1863,21 @@ nsGlobalWindow::ShutDown()
   delete nsGlobalWindowInner::sInnerWindowsById;
   nsGlobalWindowInner::sInnerWindowsById = nullptr;
   delete nsGlobalWindowOuter::sOuterWindowsById;
   nsGlobalWindowOuter::sOuterWindowsById = nullptr;
 }
 
 // static
 void
-nsGlobalWindow::CleanupCachedXBLHandlers(nsGlobalWindow* aWindow)
-{
-  if (aWindow->mCachedXBLPrototypeHandlers &&
-      aWindow->mCachedXBLPrototypeHandlers->Count() > 0) {
-    aWindow->mCachedXBLPrototypeHandlers->Clear();
+nsGlobalWindow::CleanupCachedXBLHandlers()
+{
+  if (mCachedXBLPrototypeHandlers &&
+      mCachedXBLPrototypeHandlers->Count() > 0) {
+    mCachedXBLPrototypeHandlers->Clear();
   }
 }
 
 void
 nsGlobalWindow::MaybeForgiveSpamCount()
 {
   if (IsOuterWindow() &&
       IsPopupSpamWindow()) {
@@ -2016,17 +2016,17 @@ nsGlobalWindow::CleanUp()
     if (mChromeFields.mMessageManager) {
       static_cast<nsFrameMessageManager*>(
         mChromeFields.mMessageManager.get())->Disconnect();
     }
   }
 
   mArguments = nullptr;
 
-  CleanupCachedXBLHandlers(this);
+  CleanupCachedXBLHandlers();
 
   for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
     mAudioContexts[i]->Shutdown();
   }
   mAudioContexts.Clear();
 
   if (mIdleTimer) {
     mIdleTimer->Cancel();
@@ -2133,17 +2133,17 @@ nsGlobalWindow::FreeInnerObjects()
   }
 
   mIndexedDB = nullptr;
 
   UnlinkHostObjectURIs();
 
   NotifyWindowIDDestroyed("inner-window-destroyed");
 
-  CleanupCachedXBLHandlers(this);
+  CleanupCachedXBLHandlers();
 
   for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
     mAudioContexts[i]->Shutdown();
   }
   mAudioContexts.Clear();
 
   DisableGamepadUpdates();
   mHasGamepad = false;
@@ -2335,17 +2335,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
 
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mBrowserDOMWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mGroupMessageManagers)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mOpenerForInitialContentBrowser)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
-  nsGlobalWindow::CleanupCachedXBLHandlers(tmp);
+  tmp->CleanupCachedXBLHandlers();
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mReturnValue)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -559,19 +559,20 @@ public:
                                   const char16_t* aStorageType,
                                   bool aPrivateBrowsing);
 
   // Outer windows only.
   void UnblockScriptedClosing();
 
   static void Init();
   static void ShutDown();
-  static void CleanupCachedXBLHandlers(nsGlobalWindow* aWindow);
   static bool IsCallerChrome();
 
+  void CleanupCachedXBLHandlers();
+
   friend class WindowStateHolder;
 
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
                                                                    nsIDOMEventTarget)
 
 #ifdef DEBUG
   // Call Unlink on this window. This may cause bad things to happen, so use
   // with caution.