Bug 1370593 - avoid redundant lookups in nsRefPtrHashtable::Remove; r=mats
authorNathan Froyd <froydnj@mozilla.com>
Tue, 06 Jun 2017 21:06:17 -0400
changeset 410738 f7be035185f689f5ba02e530fb4acba34798db18
parent 410737 d378d237f1c3e77386614e0fda667bca79d71f23
child 410739 b81d51cb596b6ae3e29fc466a567dd8bb2cc727a
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1370593
milestone55.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 1370593 - avoid redundant lookups in nsRefPtrHashtable::Remove; r=mats We already have a handle to the entry in the hashtable, we can remove that directly, rather than implicitly looking up the entry to remove in Remove().
xpcom/ds/nsRefPtrHashtable.h
--- a/xpcom/ds/nsRefPtrHashtable.h
+++ b/xpcom/ds/nsRefPtrHashtable.h
@@ -173,17 +173,17 @@ bool
 nsRefPtrHashtable<KeyClass, PtrType>::Remove(KeyType aKey,
                                              UserDataType* aRefPtr)
 {
   MOZ_ASSERT(aRefPtr);
   typename base_type::EntryType* ent = this->GetEntry(aKey);
 
   if (ent) {
     ent->mData.forget(aRefPtr);
-    this->Remove(aKey);
+    this->RemoveEntry(ent);
     return true;
   }
 
   // If the key doesn't exist, set *aRefPtr to null
   // so that it is a valid XPCOM getter.
   *aRefPtr = nullptr;
   return false;
 }