Bug 1376498 part 2 - Use plain Remove(key) in some places instead of Lookup(key).Remove() for simplicity. r=froydnj
authorMats Palmgren <mats@mozilla.com>
Wed, 05 Jul 2017 02:01:44 +0200
changeset 367276 d46d1d8506ad2e87db24da457da24722810a3e1b
parent 367275 1ed4185c7b73685f8971e111cc5cdd02464cce9c
child 367277 29730c843219f7d2342bb1c5aa43be19c005eb94
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 2 - Use plain Remove(key) in some places instead of Lookup(key).Remove() for simplicity. r=froydnj MozReview-Commit-ID: 7GlCL1jyGAz
dom/console/Console.cpp
dom/ipc/ContentParent.cpp
gfx/thebes/gfxFontEntry.cpp
image/ProgressTracker.cpp
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsProperties.cpp
xpcom/io/nsDirectoryService.cpp
xpfe/components/windowds/nsWindowDataSource.cpp
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -2080,20 +2080,17 @@ Console::StopTimer(JSContext* aCx, const
   nsAutoJSString key;
   if (NS_WARN_IF(!key.init(aCx, jsString))) {
     return eTimerJSException;
   }
 
   aTimerLabel = key;
 
   DOMHighResTimeStamp value = 0;
-  if (auto entry = mTimerRegistry.Lookup(key)) {
-    value = entry.Data();
-    entry.Remove();
-  } else {
+  if (!mTimerRegistry.Remove(key, &value)) {
     NS_WARNING("mTimerRegistry entry not found");
     return eTimerDoesntExist;
   }
 
   *aTimerDuration = aTimestamp - value;
   return eTimerDone;
 }
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5097,18 +5097,17 @@ ContentParent::RecvDeleteGetFilesRequest
   mGetFilesPendingRequests.Remove(aUUID);
   return IPC_OK();
 }
 
 void
 ContentParent::SendGetFilesResponseAndForget(const nsID& aUUID,
                                              const GetFilesResponseResult& aResult)
 {
-  if (auto entry = mGetFilesPendingRequests.Lookup(aUUID)) {
-    entry.Remove();
+  if (mGetFilesPendingRequests.Remove(aUUID)) {
     Unused << SendGetFilesResponse(aUUID, aResult);
   }
 }
 
 void
 ContentParent::ForceTabPaint(TabParent* aTabParent, uint64_t aLayerObserverEpoch)
 {
   if (!mHangMonitorActor) {
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -693,19 +693,19 @@ gfxFontEntry::GrGetTable(const void *aAp
 }
 
 /*static*/ void
 gfxFontEntry::GrReleaseTable(const void *aAppFaceHandle,
                              const void *aTableBuffer)
 {
     gfxFontEntry *fontEntry =
         static_cast<gfxFontEntry*>(const_cast<void*>(aAppFaceHandle));
-    if (auto entry = fontEntry->mGrTableMap->Lookup(aTableBuffer)) {
-        hb_blob_destroy(static_cast<hb_blob_t*>(entry.Data()));
-        entry.Remove();
+    void* value;
+    if (fontEntry->mGrTableMap->Remove(aTableBuffer, &value)) {
+        hb_blob_destroy(static_cast<hb_blob_t*>(value));
     }
 }
 
 gr_face*
 gfxFontEntry::GetGrFace()
 {
     if (!mGrFaceInitialized) {
         gr_face_ops faceOps = {
--- a/image/ProgressTracker.cpp
+++ b/image/ProgressTracker.cpp
@@ -466,21 +466,17 @@ ProgressTracker::AddObserver(IProgressOb
 bool
 ProgressTracker::RemoveObserver(IProgressObserver* aObserver)
 {
   MOZ_ASSERT(NS_IsMainThread());
   RefPtr<IProgressObserver> observer = aObserver;
 
   // Remove the observer from the list.
   bool removed = mObservers.Write([=](ObserverTable* aTable) {
-    if (auto entry = aTable->Lookup(observer)) {
-      entry.Remove();
-      return true;
-    }
-    return false;
+    return aTable->Remove(observer);
   });
 
   // Observers can get confused if they don't get all the proper teardown
   // notifications. Part ways on good terms.
   if (removed && !aObserver->NotificationsDeferred()) {
     EmulateRequestFinished(aObserver);
   }
 
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -56,21 +56,17 @@ nsHashPropertyBagBase::SetProperty(const
   mPropertyHash.Put(aName, aValue);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBagBase::DeleteProperty(const nsAString& aName)
 {
-  if (auto entry = mPropertyHash.Lookup(aName)) {
-    entry.Remove();
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
+  return mPropertyHash.Remove(aName) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 
 //
 // nsSimpleProperty class and impl; used for GetEnumerator
 //
 
 class nsSimpleProperty final : public nsIProperty
--- a/xpcom/ds/nsProperties.cpp
+++ b/xpcom/ds/nsProperties.cpp
@@ -39,21 +39,17 @@ nsProperties::Set(const char* prop, nsIS
 
 NS_IMETHODIMP
 nsProperties::Undefine(const char* prop)
 {
   if (NS_WARN_IF(!prop)) {
     return NS_ERROR_INVALID_ARG;
   }
 
-  if (auto entry = nsProperties_HashBase::Lookup(prop)) {
-    entry.Remove();
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
+  return nsProperties_HashBase::Remove(prop) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsProperties::Has(const char* prop, bool* result)
 {
   if (NS_WARN_IF(!prop)) {
     return NS_ERROR_INVALID_ARG;
   }
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -266,21 +266,17 @@ NS_IMPL_ISUPPORTS(nsDirectoryService,
 NS_IMETHODIMP
 nsDirectoryService::Undefine(const char* aProp)
 {
   if (NS_WARN_IF(!aProp)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsDependentCString key(aProp);
-  if (auto entry = mHashtable.Lookup(key)) {
-    entry.Remove();
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
+  return mHashtable.Remove(key) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsDirectoryService::GetKeys(uint32_t* aCount, char*** aKeys)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/xpfe/components/windowds/nsWindowDataSource.cpp
+++ b/xpfe/components/windowds/nsWindowDataSource.cpp
@@ -178,22 +178,20 @@ nsWindowDataSource::OnOpenWindow(nsIXULW
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowDataSource::OnCloseWindow(nsIXULWindow *window)
 {
     nsresult rv;
-    auto entry = mWindowResources.Lookup(window);
-    if (!entry) {
+    nsCOMPtr<nsIRDFResource> resource;
+    if (!mWindowResources.Remove(window, getter_AddRefs(resource))) {
         return NS_ERROR_UNEXPECTED;
     }
-    nsCOMPtr<nsIRDFResource> resource(entry.Data().forget());
-    entry.Remove();
 
     // make sure we're not shutting down
     if (!mContainer) return NS_OK;
 
     nsCOMPtr<nsIRDFNode> oldKeyNode;
     nsCOMPtr<nsIRDFInt> oldKeyInt;
 
     // get the old keyIndex, if any