Bug 1376498 part 4 - Make all nsClassHashtable::RemoveAndForget() consumers use Remove() instead. r=froydnj
authorMats Palmgren <mats@mozilla.com>
Wed, 05 Jul 2017 02:01:45 +0200
changeset 367278 512c69e35fc0c7b3414a7644f825be1eb4ee1beb
parent 367277 29730c843219f7d2342bb1c5aa43be19c005eb94
child 367279 a4a27ab70450302d6c599be8160d0f4860b4c29e
push id92181
push usermpalmgren@mozilla.com
push dateWed, 05 Jul 2017 00:01:54 +0000
treeherdermozilla-inbound@4ccb89990d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1376498
milestone56.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 1376498 part 4 - Make all nsClassHashtable::RemoveAndForget() consumers use Remove() instead. r=froydnj MozReview-Commit-ID: G64YQLlgm6r
dom/base/CustomElementRegistry.cpp
dom/ipc/ContentChild.cpp
dom/media/gmp/GMPService.cpp
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
dom/webbrowserpersist/nsWebBrowserPersist.cpp
dom/workers/ServiceWorkerManager.cpp
dom/xbl/nsXBLDocumentInfo.cpp
layout/base/RestyleTracker.cpp
layout/base/nsFrameManager.cpp
layout/style/ImageLoader.cpp
modules/libpref/nsPrefBranch.cpp
netwerk/cache2/CacheStorageService.cpp
security/manager/ssl/CertBlocklist.cpp
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -482,20 +482,18 @@ CustomElementRegistry::UpgradeCandidates
 {
   DocGroup* docGroup = mWindow->GetDocGroup();
   if (!docGroup) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
 
   nsAutoPtr<nsTArray<nsWeakPtr>> candidates;
-  mCandidatesMap.RemoveAndForget(aKey, candidates);
-  if (candidates) {
-
-
+  if (mCandidatesMap.Remove(aKey, &candidates)) {
+    MOZ_ASSERT(candidates);
     CustomElementReactionsStack* reactionsStack =
       docGroup->CustomElementReactionsStack();
     for (size_t i = 0; i < candidates->Length(); ++i) {
       nsCOMPtr<Element> elem = do_QueryReferent(candidates->ElementAt(i));
       if (!elem) {
         continue;
       }
 
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -3459,17 +3459,17 @@ ContentChild::RecvParentActivated(PBrows
   return tab->RecvParentActivated(aActivated);
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvProvideAnonymousTemporaryFile(const uint64_t& aID,
                                                 const FileDescOrError& aFDOrError)
 {
   nsAutoPtr<AnonymousTemporaryFileCallback> callback;
-  mPendingAnonymousTemporaryFiles.RemoveAndForget(aID, callback);
+  mPendingAnonymousTemporaryFiles.Remove(aID, &callback);
   MOZ_ASSERT(callback);
 
   PRFileDesc* prfile = nullptr;
   if (aFDOrError.type() == FileDescOrError::Tnsresult) {
     DebugOnly<nsresult> rv = aFDOrError.get_nsresult();
     MOZ_ASSERT(NS_FAILED(rv));
   } else {
     auto rawFD = aFDOrError.get_FileDescriptor().ClonePlatformHandle();
--- a/dom/media/gmp/GMPService.cpp
+++ b/dom/media/gmp/GMPService.cpp
@@ -173,17 +173,17 @@ GeckoMediaPluginService::RunPluginCrashC
                                                  const nsACString& aPluginName)
 {
   MOZ_ASSERT(NS_IsMainThread());
   LOGD(("%s::%s(%i)", __CLASS__, __FUNCTION__, aPluginId));
 
   nsAutoPtr<nsTArray<RefPtr<GMPCrashHelper>>> helpers;
   {
     MutexAutoLock lock(mMutex);
-    mPluginCrashHelpers.RemoveAndForget(aPluginId, helpers);
+    mPluginCrashHelpers.Remove(aPluginId, &helpers);
   }
   if (!helpers) {
     LOGD(("%s::%s(%i) No crash helpers, not handling crash.", __CLASS__, __FUNCTION__, aPluginId));
     return NS_OK;
   }
 
   for (const auto& helper : *helpers) {
     nsCOMPtr<nsPIDOMWindowInner> window = helper->GetPluginCrashedEventTarget();
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -108,17 +108,17 @@ public:
   }
 
   void Decrypted(const DecryptResult& aDecrypted)
   {
     MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
     MOZ_ASSERT(aDecrypted.mSample);
 
     nsAutoPtr<DecryptPromiseRequestHolder> holder;
-    mDecrypts.RemoveAndForget(aDecrypted.mSample, holder);
+    mDecrypts.Remove(aDecrypted.mSample, &holder);
     if (holder) {
       holder->Complete();
     } else {
       // Decryption is not in the list of decrypt operations waiting
       // for a result. It must have been flushed or drained. Ignore result.
       return;
     }
 
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -2196,17 +2196,17 @@ PluginInstanceParent::SubclassPluginWind
 void
 PluginInstanceParent::UnsubclassPluginWindow()
 {
     if (XRE_IsContentProcess()) {
         if (mPluginHWND) {
             // Remove 'this' from the plugin list safely
             nsAutoPtr<PluginInstanceParent> tmp;
             MOZ_ASSERT(sPluginInstanceList);
-            sPluginInstanceList->RemoveAndForget((void*)mPluginHWND, tmp);
+            sPluginInstanceList->Remove((void*)mPluginHWND, &tmp);
             tmp.forget();
             if (!sPluginInstanceList->Count()) {
                 delete sPluginInstanceList;
                 sPluginInstanceList = nullptr;
             }
         }
         mPluginHWND = nullptr;
         return;
--- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -2411,17 +2411,17 @@ nsWebBrowserPersist::FixRedirectedChanne
             break;
         }
     }
 
     if (matchingKey) {
         // If a match was found, remove the data entry with the old channel
         // key and re-add it with the new channel key.
         nsAutoPtr<OutputData> outputData;
-        mOutputMap.RemoveAndForget(matchingKey, outputData);
+        mOutputMap.Remove(matchingKey, &outputData);
         NS_ENSURE_TRUE(outputData, NS_ERROR_FAILURE);
 
         // Store data again with new channel unless told to ignore redirects.
         if (!(mPersistFlags & PERSIST_FLAGS_IGNORE_REDIRECTED_DATA)) {
             nsCOMPtr<nsISupports> keyPtr = do_QueryInterface(aNewChannel);
             mOutputMap.Put(keyPtr, outputData.forget());
         }
     }
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -1789,18 +1789,17 @@ ServiceWorkerManager::ReportToAllClients
                                                   aLine,
                                                   aLineNumber,
                                                   aColumnNumber,
                                                   nsContentUtils::eOMIT_LOCATION);
     }
 
     if (regList->IsEmpty()) {
       regList = nullptr;
-      nsAutoPtr<WeakDocumentList> doomed;
-      mRegisteringDocuments.RemoveAndForget(aScope, doomed);
+      mRegisteringDocuments.Remove(aScope);
     }
   }
 
   InterceptionList* intList = mNavigationInterceptions.Get(aScope);
   if (intList) {
     nsIConsoleService* consoleService = nullptr;
     for (uint32_t i = 0; i < intList->Length(); ++i) {
       nsCOMPtr<nsIInterceptedChannel> channel = intList->ElementAt(i);
@@ -1945,18 +1944,17 @@ ServiceWorkerManager::FlushReportsToAllC
       windows.AppendElement(innerWindowId);
 
       aReporter->FlushReportsToConsole(
         innerWindowId, nsIConsoleReportCollector::ReportAction::Save);
     }
 
     if (regList->IsEmpty()) {
       regList = nullptr;
-      nsAutoPtr<WeakDocumentList> doomed;
-      mRegisteringDocuments.RemoveAndForget(aScope, doomed);
+      mRegisteringDocuments.Remove(aScope);
     }
   }
 
   nsresult rv;
   InterceptionList* intList = mNavigationInterceptions.Get(aScope);
   if (intList) {
     for (uint32_t i = 0; i < intList->Length(); ++i) {
       nsCOMPtr<nsIInterceptedChannel> channel = intList->ElementAt(i);
@@ -3886,18 +3884,17 @@ ServiceWorkerManager::ShouldReportToWind
       if (win && winId == win->WindowID()) {
         *aResult = true;
         return NS_OK;
       }
     }
 
     if (list->IsEmpty()) {
       list = nullptr;
-      nsAutoPtr<WeakDocumentList> doomed;
-      mRegisteringDocuments.RemoveAndForget(aScope, doomed);
+      mRegisteringDocuments.Remove(aScope);
     }
   }
 
   // Examine any windows performing a navigation that we are currently
   // intercepting.
   InterceptionList* intList = mNavigationInterceptions.Get(aScope);
   if (intList) {
     for (uint32_t i = 0; i < intList->Length(); ++i) {
@@ -4166,18 +4163,17 @@ ServiceWorkerManager::RemoveNavigationIn
   MOZ_ASSERT(aChannel);
   InterceptionList* list =
     mNavigationInterceptions.Get(aScope);
   if (list) {
     MOZ_ALWAYS_TRUE(list->RemoveElement(aChannel));
     MOZ_ASSERT(!list->Contains(aChannel));
     if (list->IsEmpty()) {
       list = nullptr;
-      nsAutoPtr<InterceptionList> doomed;
-      mNavigationInterceptions.RemoveAndForget(aScope, doomed);
+      mNavigationInterceptions.Remove(aScope);
     }
   }
 }
 
 class UpdateTimerCallback final : public nsITimerCallback
 {
   nsCOMPtr<nsIPrincipal> mPrincipal;
   const nsCString mScope;
--- a/dom/xbl/nsXBLDocumentInfo.cpp
+++ b/dom/xbl/nsXBLDocumentInfo.cpp
@@ -170,17 +170,17 @@ nsXBLDocumentInfo::SetPrototypeBinding(c
   return NS_OK;
 }
 
 void
 nsXBLDocumentInfo::RemovePrototypeBinding(const nsACString& aRef)
 {
   if (mBindingTable) {
     nsAutoPtr<nsXBLPrototypeBinding> bindingToRemove;
-    mBindingTable->RemoveAndForget(aRef, bindingToRemove);
+    mBindingTable->Remove(aRef, &bindingToRemove);
 
     // We do not want to destroy the binding, so just forget it.
     bindingToRemove.forget();
   }
 }
 
 // static
 nsresult
--- a/layout/base/RestyleTracker.cpp
+++ b/layout/base/RestyleTracker.cpp
@@ -396,17 +396,17 @@ RestyleTracker::GetRestyleData(Element* 
   NS_PRECONDITION(aElement->GetComposedDoc() == Document(),
                   "Unexpected document; this will lead to incorrect behavior!");
 
   if (!aElement->HasFlag(RestyleBit())) {
     NS_ASSERTION(!aElement->HasFlag(RootBit()), "Bogus root bit?");
     return false;
   }
 
-  mPendingRestyles.RemoveAndForget(aElement, aData);
+  mPendingRestyles.Remove(aElement, &aData);
   NS_ASSERTION(aData.get(), "Must have data if restyle bit is set");
 
   if (aData->mRestyleHint & eRestyle_LaterSiblings) {
     // Someone readded the eRestyle_LaterSiblings hint for this
     // element.  Leave it around for now, but remove the other restyle
     // hints and the change hint for it.  Also unset its root bit,
     // since it's no longer a root with the new restyle data.
 
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -685,17 +685,17 @@ nsFrameManagerBase::UndisplayedMap::Remo
   delete aNode;
 }
 
 
 nsAutoPtr<LinkedList<UndisplayedNode>>
 nsFrameManagerBase::UndisplayedMap::UnlinkNodesFor(nsIContent* aParentContent)
 {
   nsAutoPtr<LinkedList<UndisplayedNode>> list;
-  RemoveAndForget(GetApplicableParent(aParentContent), list);
+  Remove(GetApplicableParent(aParentContent), &list);
   return list;
 }
 
 void
 nsFrameManagerBase::UndisplayedMap::RemoveNodesFor(nsIContent* aParentContent)
 {
   nsAutoPtr<LinkedList<UndisplayedNode>> list = UnlinkNodesFor(aParentContent);
   if (list) {
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -185,17 +185,17 @@ ImageLoader::DisassociateRequestFromFram
   RemoveFrameToRequestMapping(aRequest, aFrame);
 }
 
 void
 ImageLoader::DropRequestsForFrame(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame->HasImageRequest(), "why call me?");
   nsAutoPtr<RequestSet> requestSet;
-  mFrameToRequestMap.RemoveAndForget(aFrame, requestSet);
+  mFrameToRequestMap.Remove(aFrame, &requestSet);
   aFrame->SetHasImageRequest(false);
   if (MOZ_UNLIKELY(!requestSet)) {
     MOZ_ASSERT_UNREACHABLE("HasImageRequest was lying");
     return;
   }
   for (imgIRequest* request : *requestSet) {
     RemoveRequestToFrameMapping(request, aFrame);
   }
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -759,17 +759,17 @@ NS_IMETHODIMP nsPrefBranch::RemoveObserv
   if (mFreeingObserverList)
     return NS_OK;
 
   // Remove the relevant PrefCallback from mObservers and get an owning
   // pointer to it.  Unregister the callback first, and then let the owning
   // pointer go out of scope and destroy the callback.
   PrefCallback key(aDomain, aObserver, this);
   nsAutoPtr<PrefCallback> pCallback;
-  mObservers.RemoveAndForget(&key, pCallback);
+  mObservers.Remove(&key, &pCallback);
   if (pCallback) {
     // aDomain == nullptr is the only possible failure, trapped above
     const PrefName& pref = getPrefName(aDomain);
     rv = PREF_UnregisterCallback(pref.get(), NotifyObserver, pCallback);
   }
 
   return rv;
 }
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -1905,17 +1905,17 @@ CacheStorageService::DoomStorageEntries(
   } else {
     LOG(("  dooming memory-only storage of %s", aContextKey.BeginReading()));
 
     // Remove the memory entries table from the global tables.
     // Since we store memory entries also in the disk entries table
     // we need to remove the memory entries from the disk table one
     // by one manually.
     nsAutoPtr<CacheEntryTable> memoryEntries;
-    sGlobalEntryTables->RemoveAndForget(memoryStorageID, memoryEntries);
+    sGlobalEntryTables->Remove(memoryStorageID, &memoryEntries);
 
     CacheEntryTable* diskEntries;
     if (memoryEntries && sGlobalEntryTables->Get(aContextKey, &diskEntries)) {
       for (auto iter = memoryEntries->Iter(); !iter.Done(); iter.Next()) {
         auto entry = iter.Data();
         RemoveExactEntry(diskEntries, iter.Key(), entry, false);
       }
     }
--- a/security/manager/ssl/CertBlocklist.cpp
+++ b/security/manager/ssl/CertBlocklist.cpp
@@ -490,17 +490,17 @@ CertBlocklist::SaveEntries()
       issuerTable.Put(encDN, issuerSet);
     }
     issuerSet->PutEntry(encOther);
   }
 
   for (auto iter = issuers.Iter(); !iter.Done(); iter.Next()) {
     nsCStringHashKey* hashKey = iter.Get();
     nsAutoPtr<BlocklistStringSet> issuerSet;
-    issuerTable.RemoveAndForget(hashKey->GetKey(), issuerSet);
+    issuerTable.Remove(hashKey->GetKey(), &issuerSet);
 
     nsresult rv = WriteLine(outputStream, hashKey->GetKey());
     if (NS_FAILED(rv)) {
       break;
     }
 
     // Write serial data to the output stream
     for (auto iter = issuerSet->Iter(); !iter.Done(); iter.Next()) {