Bug 1121760 (part 4) - Remove PL_DHashTableRawRemove(). r=poiru.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 14 Sep 2015 14:23:26 -0700
changeset 295309 f957524fc6248406f1029dac87869ea3e77fd75d
parent 295308 108f4bf0585b22a5d5d44c280a8e1c463ae329ef
child 295310 50772808876106e59a15b8300eeb311a3a3b10d7
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspoiru
bugs1121760
milestone43.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 1121760 (part 4) - Remove PL_DHashTableRawRemove(). r=poiru.
dom/base/nsContentUtils.cpp
dom/plugins/base/nsJSNPRuntime.cpp
rdf/base/nsInMemoryDataSource.cpp
xpcom/glue/nsTHashtable.h
xpcom/glue/pldhash.cpp
xpcom/glue/pldhash.h
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -4187,17 +4187,17 @@ nsContentUtils::RemoveListenerManager(ns
   if (sEventListenerManagersHash) {
     auto entry = static_cast<EventListenerManagerMapEntry*>
                             (sEventListenerManagersHash->Search(aNode));
     if (entry) {
       nsRefPtr<EventListenerManager> listenerManager;
       listenerManager.swap(entry->mListenerManager);
       // Remove the entry and *then* do operations that could cause further
       // modification of sEventListenerManagersHash.  See bug 334177.
-      PL_DHashTableRawRemove(sEventListenerManagersHash, entry);
+      sEventListenerManagersHash->RawRemove(entry);
       if (listenerManager) {
         listenerManager->Disconnect();
       }
     }
   }
 }
 
 /* static */
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1840,17 +1840,17 @@ nsNPObjWrapper::OnDestroy(NPObject *npob
 
   if (entry && entry->mJSObj) {
     // Found a live NPObject wrapper, null out its JSObjects' private
     // data.
 
     ::JS_SetPrivate(entry->mJSObj, nullptr);
 
     // Remove the npobj from the hash now that it went away.
-    PL_DHashTableRawRemove(sNPObjWrappers, entry);
+    sNPObjWrappers->RawRemove(entry);
 
     // The finalize hook will call OnWrapperDestroyed().
   }
 }
 
 // Look up or create a JSObject that wraps the NPObject npobj.
 
 // static
@@ -1921,17 +1921,17 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JS
 
       NS_ASSERTION(sNPObjWrappers->Search(npobj),
                    "Hashtable didn't find what we just added?");
   }
 
   if (!obj) {
     // OOM? Remove the stale entry from the hash.
 
-    PL_DHashTableRawRemove(sNPObjWrappers, entry);
+    sNPObjWrappers->RawRemove(entry);
 
     return nullptr;
   }
 
   OnWrapperCreated();
 
   entry->mJSObj = obj;
 
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -1218,17 +1218,17 @@ InMemoryDataSource::LockedUnassert(nsIRD
         }
         // We don't even have the assertion, so just bail.
         if (!next)
             return NS_OK;
 
         as = next;
 
         if (first) {
-            PL_DHashTableRawRemove(root->u.hash.mPropertyHash, hdr);
+            root->u.hash.mPropertyHash->RawRemove(hdr);
 
             if (next && next->mNext) {
                 PLDHashEntryHdr* hdr =
                     root->u.hash.mPropertyHash->Add(aProperty,
                                                     mozilla::fallible);
                 if (hdr) {
                     Entry* entry = static_cast<Entry*>(hdr);
                     entry->mNode = aProperty;
@@ -1853,17 +1853,17 @@ InMemoryDataSource::SweepForwardArcsEntr
                         break;
                     }
                     rprev = ras;
                     ras = ras->u.as.mInvNext;
                 }
 
                 // Wow, it was the _only_ one. Unhash it.
                 if (! rentry->mAssertions) {
-                    PL_DHashTableRawRemove(aInfo->mReverseArcs, hdr);
+                    aInfo->mReverseArcs->RawRemove(hdr);
                 }
 
                 // add to the list of assertions to unassert
                 as->mNext = aInfo->mUnassertList;
                 aInfo->mUnassertList = as;
 
                 // Advance to the next assertion
                 as = next;
--- a/xpcom/glue/nsTHashtable.h
+++ b/xpcom/glue/nsTHashtable.h
@@ -168,17 +168,17 @@ public:
    * This is a low-level method, and is not recommended unless you know what
    * you're doing and you need the extra performance. This method can be used
    * during enumeration, while RemoveEntry() cannot.
    * @param aEntry   the entry-pointer to remove (obtained from GetEntry or
    *                 the enumerator
    */
   void RawRemoveEntry(EntryType* aEntry)
   {
-    PL_DHashTableRawRemove(&mTable, aEntry);
+    mTable.RawRemove(aEntry);
   }
 
   // This is an iterator that also allows entry removal. Example usage:
   //
   //   for (auto iter = table.Iter(); !iter.Done(); iter.Next()) {
   //     Entry* entry = iter.Get();
   //     // ... do stuff with |entry| ...
   //     // ... possibly call iter.Remove() once ...
--- a/xpcom/glue/pldhash.cpp
+++ b/xpcom/glue/pldhash.cpp
@@ -673,17 +673,17 @@ PLDHashTable::RemoveEntry(PLDHashEntryHd
 #ifdef DEBUG
   AutoWriteOp op(mChecker);
 #endif
 
   RawRemove(aEntry);
   ShrinkIfAppropriate();
 }
 
-MOZ_ALWAYS_INLINE void
+void
 PLDHashTable::RawRemove(PLDHashEntryHdr* aEntry)
 {
   // Unfortunately, we can only do weak checking here. That's because
   // RawRemove() can be called legitimately while an Enumerate() call is
   // active, which doesn't fit well into how Checker's mState variable works.
   MOZ_ASSERT(mChecker.IsWritable());
 
   MOZ_ASSERT(mEntryStore.Get());
@@ -697,22 +697,16 @@ PLDHashTable::RawRemove(PLDHashEntryHdr*
     MarkEntryRemoved(aEntry);
     mRemovedCount++;
   } else {
     MarkEntryFree(aEntry);
   }
   mEntryCount--;
 }
 
-void
-PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
-{
-  aTable->RawRemove(aEntry);
-}
-
 // Shrink or compress if a quarter or more of all entries are removed, or if the
 // table is underloaded according to the minimum alpha, and is not minimal-size
 // already.
 void
 PLDHashTable::ShrinkIfAppropriate()
 {
   uint32_t capacity = Capacity();
   if (mRemovedCount >= capacity >> 2 ||
--- a/xpcom/glue/pldhash.h
+++ b/xpcom/glue/pldhash.h
@@ -615,17 +615,14 @@ void
 PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
 
 // If you use PLDHashEntryStub or a subclass of it as your entry struct, and
 // if your entries move via memcpy and clear via memset(0), you can use these
 // stub operations.
 const PLDHashTableOps*
 PL_DHashGetStubOps(void);
 
-void
-PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
-
 #ifdef DEBUG
 void
 PL_DHashMarkTableImmutable(PLDHashTable* aTable);
 #endif
 
 #endif /* pldhash_h___ */