Bug 1121760 (part 3) - Remove PL_DHashTableRemove(). r=poiru.

--HG--
extra : rebase_source : c34d693de4aca45f2ea05c2767c8b1007c89df29
This commit is contained in:
Nicholas Nethercote 2015-09-14 14:23:24 -07:00
parent 479244f7c9
commit 59683492e5
24 changed files with 39 additions and 51 deletions

View File

@ -971,7 +971,7 @@ nsContentList::RemoveFromHashtable()
if (!gContentListHashTable)
return;
PL_DHashTableRemove(gContentListHashTable, &key);
gContentListHashTable->Remove(&key);
if (gContentListHashTable->EntryCount() == 0) {
delete gContentListHashTable;
@ -1012,7 +1012,7 @@ nsCacheableFuncStringContentList::RemoveFromFuncStringHashtable()
}
nsFuncStringCacheKey key(mRootNode, mFunc, mString);
PL_DHashTableRemove(gFuncStringContentListHashTable, &key);
gFuncStringContentListHashTable->Remove(&key);
if (gFuncStringContentListHashTable->EntryCount() == 0) {
delete gFuncStringContentListHashTable;

View File

@ -3948,7 +3948,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
// aSubDoc is nullptr, remove the mapping
if (mSubDocuments) {
PL_DHashTableRemove(mSubDocuments, aElement);
mSubDocuments->Remove(aElement);
}
} else {
if (!mSubDocuments) {

View File

@ -148,7 +148,7 @@ void
nsScriptNameSpaceManager::RemoveFromHash(PLDHashTable *aTable,
const nsAString *aKey)
{
PL_DHashTableRemove(aTable, aKey);
aTable->Remove(aKey);
}
nsGlobalNameStruct*

View File

@ -1755,7 +1755,7 @@ NPObjWrapper_Finalize(js::FreeOp *fop, JSObject *obj)
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
if (npobj) {
if (sNPObjWrappers) {
PL_DHashTableRemove(sNPObjWrappers, npobj);
sNPObjWrappers->Remove(npobj);
}
}

View File

@ -11,7 +11,7 @@ nsContentSupportMap::Remove(nsIContent* aElement)
{
nsIContent* child = aElement;
do {
PL_DHashTableRemove(&mMap, child);
mMap.Remove(child);
child = child->GetNextNode(aElement);
} while(child);
}

View File

@ -37,7 +37,7 @@ public:
void
Remove(nsIContent* aContent) {
PL_DHashTableRemove(&mTable, aContent);
mTable.Remove(aContent);
for (nsIContent* child = aContent->GetFirstChild();
child;

View File

@ -200,7 +200,7 @@ nsCommandParams::SetISupportsValue(const char* aName, nsISupports* aValue)
NS_IMETHODIMP
nsCommandParams::RemoveValue(const char* aName)
{
PL_DHashTableRemove(&mValuesHash, (void*)aName);
mValuesHash.Remove((void*)aName);
return NS_OK;
}

View File

@ -143,7 +143,7 @@ public:
"nsISupports identity! This will most likely cause serious "
"problems!");
#endif
PL_DHashTableRemove(mTable, wrapper->GetIdentityObject());
mTable->Remove(wrapper->GetIdentityObject());
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -198,7 +198,7 @@ public:
inline void Remove(nsXPCWrappedJSClass* clazz)
{
NS_PRECONDITION(clazz,"bad param");
PL_DHashTableRemove(mTable, &clazz->GetIID());
mTable->Remove(&clazz->GetIID());
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -251,7 +251,7 @@ public:
inline void Remove(XPCNativeInterface* iface)
{
NS_PRECONDITION(iface,"bad param");
PL_DHashTableRemove(mTable, iface->GetIID());
mTable->Remove(iface->GetIID());
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -304,7 +304,7 @@ public:
inline void Remove(nsIClassInfo* info)
{
NS_PRECONDITION(info,"bad param");
PL_DHashTableRemove(mTable, info);
mTable->Remove(info);
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -360,7 +360,7 @@ public:
inline void Remove(nsIClassInfo* info)
{
NS_PRECONDITION(info,"bad param");
PL_DHashTableRemove(mTable, info);
mTable->Remove(info);
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -428,7 +428,7 @@ public:
NS_PRECONDITION(set,"bad param");
XPCNativeSetKey key(set, nullptr, 0);
PL_DHashTableRemove(mTable, &key);
mTable->Remove(&key);
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -489,7 +489,7 @@ public:
inline void Remove(REFNSIID iid)
{
PL_DHashTableRemove(mTable, &iid);
mTable->Remove(&iid);
}
inline uint32_t Count() { return mTable->EntryCount(); }
@ -563,7 +563,7 @@ public:
inline void Remove(XPCWrappedNativeProto* proto)
{
NS_PRECONDITION(proto,"bad param");
PL_DHashTableRemove(mTable, proto);
mTable->Remove(proto);
}
inline uint32_t Count() { return mTable->EntryCount(); }

View File

@ -197,8 +197,7 @@ nsFrameManager::UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame
NS_PRECONDITION(nsGkAtoms::placeholderFrame == aPlaceholderFrame->GetType(),
"unexpected frame type");
PL_DHashTableRemove(&mPlaceholderMap,
aPlaceholderFrame->GetOutOfFlowFrame());
mPlaceholderMap.Remove(aPlaceholderFrame->GetOutOfFlowFrame());
}
void

View File

@ -492,7 +492,7 @@ nsHTMLStyleSheet::DropMappedAttributes(nsMappedAttributes* aMapped)
uint32_t entryCount = mMappedAttrTable.EntryCount() - 1;
#endif
PL_DHashTableRemove(&mMappedAttrTable, aMapped);
mMappedAttrTable.Remove(aMapped);
NS_ASSERTION(entryCount == mMappedAttrTable.EntryCount(), "not removed");
}

View File

@ -528,7 +528,7 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt)
// the damage...
//
PL_DHashTableRemove(&mRequests, request);
mRequests.Remove(request);
rv = NS_OK;

View File

@ -459,7 +459,7 @@ nsCacheEntryHashTable::RemoveEntry( nsCacheEntry *cacheEntry)
nsCacheEntry *check = GetEntry(&(cacheEntry->mKey));
NS_ASSERTION(check == cacheEntry, "### Attempting to remove unknown cache entry!!!");
#endif
PL_DHashTableRemove(&table, &(cacheEntry->mKey));
table.Remove(&(cacheEntry->mKey));
}
PLDHashTable::Iterator

View File

@ -301,8 +301,7 @@ nsDiskCacheBindery::RemoveBinding(nsDiskCacheBinding * binding)
if (binding == hashEntry->mBinding) {
if (PR_CLIST_IS_EMPTY(binding)) {
// remove this hash entry
PL_DHashTableRemove(&table,
(void*)(uintptr_t) binding->mRecord.HashNumber());
table.Remove((void*)(uintptr_t) binding->mRecord.HashNumber());
return;
} else {

View File

@ -619,7 +619,7 @@ nsHostResolver::FlushCache()
nsHostRecord *rec = static_cast<nsHostRecord *>(node);
node = node->next;
PR_REMOVE_AND_INIT_LINK(rec);
PL_DHashTableRemove(&mDB, (nsHostKey *) rec);
mDB.Remove((nsHostKey *) rec);
NS_RELEASE(rec);
}
}
@ -1266,7 +1266,7 @@ nsHostResolver::OnLookupComplete(nsHostRecord* rec, nsresult status, AddrInfo* r
nsHostRecord *head =
static_cast<nsHostRecord *>(PR_LIST_HEAD(&mEvictionQ));
PR_REMOVE_AND_INIT_LINK(head);
PL_DHashTableRemove(&mDB, (nsHostKey *) head);
mDB.Remove((nsHostKey *) head);
if (!head->negative) {
// record the age of the entry upon eviction.
@ -1342,7 +1342,7 @@ nsHostResolver::CancelAsyncRequest(const char *host,
// If there are no more callbacks, remove the hash table entry
if (recPtr && PR_CLIST_IS_EMPTY(&recPtr->callbacks)) {
PL_DHashTableRemove(&mDB, (nsHostKey *)recPtr);
mDB.Remove((nsHostKey *)recPtr);
// If record is on a Queue, remove it and then deref it
if (recPtr->next != recPtr) {
PR_REMOVE_LINK(recPtr);

View File

@ -323,7 +323,7 @@ public:
}
}
else {
PL_DHashTableRemove(&mForwardArcs, u);
mForwardArcs.Remove(u);
}
}
@ -338,7 +338,7 @@ public:
}
}
else {
PL_DHashTableRemove(&mReverseArcs, v);
mReverseArcs.Remove(v);
}
}

View File

@ -1186,7 +1186,7 @@ RDFServiceImpl::UnregisterResource(nsIRDFResource* aResource)
NS_WARNING("resource was never registered");
#endif
PL_DHashTableRemove(&mResources, uri);
mResources.Remove(uri);
return NS_OK;
}
@ -1405,7 +1405,7 @@ RDFServiceImpl::UnregisterLiteral(nsIRDFLiteral* aLiteral)
NS_ASSERTION(mLiterals.Search(value), "literal was never registered");
PL_DHashTableRemove(&mLiterals, value);
mLiterals.Remove(value);
// N.B. that we _don't_ release the literal: we only held a weak
// reference to it in the hashtable.
@ -1455,7 +1455,7 @@ RDFServiceImpl::UnregisterInt(nsIRDFInt* aInt)
NS_ASSERTION(mInts.Search(&value), "int was never registered");
PL_DHashTableRemove(&mInts, &value);
mInts.Remove(&value);
// N.B. that we _don't_ release the literal: we only held a weak
// reference to it in the hashtable.
@ -1505,7 +1505,7 @@ RDFServiceImpl::UnregisterDate(nsIRDFDate* aDate)
NS_ASSERTION(mDates.Search(&value), "date was never registered");
PL_DHashTableRemove(&mDates, &value);
mDates.Remove(&value);
// N.B. that we _don't_ release the literal: we only held a weak
// reference to it in the hashtable.
@ -1545,7 +1545,7 @@ RDFServiceImpl::UnregisterBlob(BlobImpl *aBlob)
{
NS_ASSERTION(mBlobs.Search(&aBlob->mData), "blob was never registered");
PL_DHashTableRemove(&mBlobs, &aBlob->mData);
mBlobs.Remove(&aBlob->mData);
// N.B. that we _don't_ release the literal: we only held a weak
// reference to it in the hashtable.

View File

@ -193,7 +193,7 @@ nsCertTree::getCacheEntry(void *cache, void *aCert)
void nsCertTree::RemoveCacheEntry(void *key)
{
PL_DHashTableRemove(&mCompareCache, key);
mCompareCache.Remove(key);
}
// CountOrganizations

View File

@ -69,7 +69,7 @@ void nsNSSShutDownList::forget(nsNSSShutDownObject *o)
PR_ASSERT(o);
MutexAutoLock lock(singleton->mListLock);
PL_DHashTableRemove(&singleton->mObjects, o);
singleton->mObjects.Remove(o);
}
void nsNSSShutDownList::remember(nsOnPK11LogoutCancelObject *o)
@ -89,7 +89,7 @@ void nsNSSShutDownList::forget(nsOnPK11LogoutCancelObject *o)
PR_ASSERT(o);
MutexAutoLock lock(singleton->mListLock);
PL_DHashTableRemove(&singleton->mPK11LogoutCancelObjects, o);
singleton->mPK11LogoutCancelObjects.Remove(o);
}
void nsNSSShutDownList::trackSSLSocketCreate()

View File

@ -1334,7 +1334,7 @@ nsresult nsDocLoader::AddRequestInfo(nsIRequest *aRequest)
void nsDocLoader::RemoveRequestInfo(nsIRequest *aRequest)
{
PL_DHashTableRemove(&mRequestInfoHash, aRequest);
mRequestInfoHash.Remove(aRequest);
}
nsDocLoader::nsRequestInfo* nsDocLoader::GetRequestInfo(nsIRequest* aRequest)

View File

@ -397,7 +397,7 @@ AtomImpl::~AtomImpl()
// |AtomTableClearEntry|.
if (!IsPermanentInDestructor()) {
AtomTableKey key(mString, mLength, mHash);
PL_DHashTableRemove(gAtomTable, &key);
gAtomTable->Remove(&key);
if (gAtomTable->EntryCount() == 0) {
delete gAtomTable;
gAtomTable = nullptr;

View File

@ -160,8 +160,7 @@ public:
*/
void RemoveEntry(KeyType aKey)
{
PL_DHashTableRemove(&mTable,
EntryType::KeyToPointer(aKey));
mTable.Remove(EntryType::KeyToPointer(aKey));
}
/**

View File

@ -650,7 +650,7 @@ PLDHashTable::Add(const void* aKey)
return entry;
}
MOZ_ALWAYS_INLINE void
void
PLDHashTable::Remove(const void* aKey)
{
#ifdef DEBUG
@ -678,12 +678,6 @@ PLDHashTable::RemoveEntry(PLDHashEntryHdr* aEntry)
ShrinkIfAppropriate();
}
void PL_DHASH_FASTCALL
PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey)
{
aTable->Remove(aKey);
}
MOZ_ALWAYS_INLINE void
PLDHashTable::RawRemove(PLDHashEntryHdr* aEntry)
{

View File

@ -620,9 +620,6 @@ PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
const PLDHashTableOps*
PL_DHashGetStubOps(void);
void PL_DHASH_FASTCALL
PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey);
void
PL_DHashTableRawRemove(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);

View File

@ -131,7 +131,7 @@ TEST(PLDHashTableTest, LazyStorage)
ASSERT_TRUE(!t.Search((const void*)1));
// No result to check here, but call it to make sure it doesn't crash.
PL_DHashTableRemove(&t, (const void*)2);
t.Remove((const void*)2);
for (auto iter = t.Iter(); !iter.Done(); iter.Next()) {
ASSERT_TRUE(false); // shouldn't hit this on an empty table