mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1161377 (part 2) - Remove PL_NewDHashTable() and PL_DHashTableDestroy(). r=froydnj.
They're not needed now that there is an initializing constructor and a destructor.
This commit is contained in:
parent
9978627ce0
commit
7b2a571fc7
@ -1719,11 +1719,8 @@ nsDocument::~nsDocument()
|
||||
|
||||
// Kill the subdocument map, doing this will release its strong
|
||||
// references, if any.
|
||||
if (mSubDocuments) {
|
||||
PL_DHashTableDestroy(mSubDocuments);
|
||||
|
||||
mSubDocuments = nullptr;
|
||||
}
|
||||
delete mSubDocuments;
|
||||
mSubDocuments = nullptr;
|
||||
|
||||
// Destroy link map now so we don't waste time removing
|
||||
// links one by one
|
||||
@ -2127,10 +2124,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
|
||||
tmp->mStyleSheetSetList = nullptr;
|
||||
}
|
||||
|
||||
if (tmp->mSubDocuments) {
|
||||
PL_DHashTableDestroy(tmp->mSubDocuments);
|
||||
tmp->mSubDocuments = nullptr;
|
||||
}
|
||||
delete tmp->mSubDocuments;
|
||||
tmp->mSubDocuments = nullptr;
|
||||
|
||||
tmp->mFrameRequestCallbacks.Clear();
|
||||
|
||||
@ -2328,11 +2323,8 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
|
||||
|
||||
// Delete references to sub-documents and kill the subdocument map,
|
||||
// if any. It holds strong references
|
||||
if (mSubDocuments) {
|
||||
PL_DHashTableDestroy(mSubDocuments);
|
||||
|
||||
mSubDocuments = nullptr;
|
||||
}
|
||||
delete mSubDocuments;
|
||||
mSubDocuments = nullptr;
|
||||
|
||||
// Destroy link map now so we don't waste time removing
|
||||
// links one by one
|
||||
@ -4039,7 +4031,7 @@ nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
|
||||
SubDocInitEntry
|
||||
};
|
||||
|
||||
mSubDocuments = PL_NewDHashTable(&hash_table_ops, sizeof(SubDocMapEntry));
|
||||
mSubDocuments = new PLDHashTable(&hash_table_ops, sizeof(SubDocMapEntry));
|
||||
}
|
||||
|
||||
// Add a mapping to the hash table
|
||||
|
@ -217,9 +217,7 @@ XULDocument::~XULDocument()
|
||||
mPersistenceIds.Clear();
|
||||
|
||||
// Destroy our broadcaster map.
|
||||
if (mBroadcasterMap) {
|
||||
PL_DHashTableDestroy(mBroadcasterMap);
|
||||
}
|
||||
delete mBroadcasterMap;
|
||||
|
||||
delete mTemplateBuilderTable;
|
||||
|
||||
@ -771,7 +769,7 @@ XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
||||
};
|
||||
|
||||
if (! mBroadcasterMap) {
|
||||
mBroadcasterMap = PL_NewDHashTable(&gOps, sizeof(BroadcasterMapEntry));
|
||||
mBroadcasterMap = new PLDHashTable(&gOps, sizeof(BroadcasterMapEntry));
|
||||
}
|
||||
|
||||
BroadcasterMapEntry* entry =
|
||||
|
@ -182,13 +182,12 @@ Native2WrappedNativeMap::newMap(int length)
|
||||
|
||||
Native2WrappedNativeMap::Native2WrappedNativeMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
Native2WrappedNativeMap::~Native2WrappedNativeMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -231,13 +230,12 @@ IID2WrappedJSClassMap::newMap(int length)
|
||||
|
||||
IID2WrappedJSClassMap::IID2WrappedJSClassMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2WrappedJSClassMap::~IID2WrappedJSClassMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
|
||||
@ -265,13 +263,12 @@ IID2NativeInterfaceMap::newMap(int length)
|
||||
|
||||
IID2NativeInterfaceMap::IID2NativeInterfaceMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2NativeInterfaceMap::~IID2NativeInterfaceMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -307,13 +304,12 @@ ClassInfo2NativeSetMap::newMap(int length)
|
||||
|
||||
ClassInfo2NativeSetMap::ClassInfo2NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2NativeSetMap::~ClassInfo2NativeSetMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -346,13 +342,12 @@ ClassInfo2WrappedNativeProtoMap::newMap(int length)
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::ClassInfo2WrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(PL_DHashGetStubOps(), sizeof(Entry), length);
|
||||
}
|
||||
|
||||
ClassInfo2WrappedNativeProtoMap::~ClassInfo2WrappedNativeProtoMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -467,13 +462,12 @@ NativeSetMap::newMap(int length)
|
||||
|
||||
NativeSetMap::NativeSetMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
NativeSetMap::~NativeSetMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -531,13 +525,12 @@ IID2ThisTranslatorMap::newMap(int length)
|
||||
|
||||
IID2ThisTranslatorMap::IID2ThisTranslatorMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
IID2ThisTranslatorMap::~IID2ThisTranslatorMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -608,13 +601,12 @@ XPCNativeScriptableSharedMap::newMap(int length)
|
||||
|
||||
XPCNativeScriptableSharedMap::XPCNativeScriptableSharedMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
mTable = new PLDHashTable(&Entry::sOps, sizeof(Entry), length);
|
||||
}
|
||||
|
||||
XPCNativeScriptableSharedMap::~XPCNativeScriptableSharedMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -660,14 +652,13 @@ XPCWrappedNativeProtoMap::newMap(int length)
|
||||
|
||||
XPCWrappedNativeProtoMap::XPCWrappedNativeProtoMap(int length)
|
||||
{
|
||||
mTable = PL_NewDHashTable(PL_DHashGetStubOps(),
|
||||
mTable = new PLDHashTable(PL_DHashGetStubOps(),
|
||||
sizeof(PLDHashEntryStub), length);
|
||||
}
|
||||
|
||||
XPCWrappedNativeProtoMap::~XPCWrappedNativeProtoMap()
|
||||
{
|
||||
if (mTable)
|
||||
PL_DHashTableDestroy(mTable);
|
||||
delete mTable;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -1431,7 +1431,7 @@ nsRuleNode::DestroyInternal(nsRuleNode ***aDestroyQueueTail)
|
||||
PL_DHashTableEnumerate(children, EnqueueRuleNodeChildren,
|
||||
&destroyQueueTail);
|
||||
*destroyQueueTail = nullptr; // ensure null-termination
|
||||
PL_DHashTableDestroy(children);
|
||||
delete children;
|
||||
} else if (HaveChildren()) {
|
||||
*destroyQueueTail = ChildrenList();
|
||||
do {
|
||||
@ -1614,7 +1614,7 @@ nsRuleNode::ConvertChildrenToHash(int32_t aNumKids)
|
||||
{
|
||||
NS_ASSERTION(!ChildrenAreHashed() && HaveChildren(),
|
||||
"must have a non-empty list of children");
|
||||
PLDHashTable *hash = PL_NewDHashTable(&ChildrenHashOps,
|
||||
PLDHashTable *hash = new PLDHashTable(&ChildrenHashOps,
|
||||
sizeof(ChildrenHashEntry),
|
||||
aNumKids);
|
||||
for (nsRuleNode* curr = ChildrenList(); curr; curr = curr->mNextSibling) {
|
||||
@ -9372,7 +9372,7 @@ nsRuleNode::SweepChildren(nsTArray<nsRuleNode*>& aSweepQueue)
|
||||
PL_DHashTableEnumerate(children, SweepHashEntry, &survivorsWithChildren);
|
||||
childrenDestroyed = oldChildCount - children->EntryCount();
|
||||
if (childrenDestroyed == oldChildCount) {
|
||||
PL_DHashTableDestroy(children);
|
||||
delete children;
|
||||
mChildren.asVoid = nullptr;
|
||||
}
|
||||
} else {
|
||||
|
@ -163,7 +163,7 @@ Assertion::Assertion(nsIRDFResource* aSource)
|
||||
NS_ADDREF(mSource);
|
||||
|
||||
u.hash.mPropertyHash =
|
||||
PL_NewDHashTable(PL_DHashGetStubOps(), sizeof(Entry));
|
||||
new PLDHashTable(PL_DHashGetStubOps(), sizeof(Entry));
|
||||
}
|
||||
|
||||
Assertion::Assertion(nsIRDFResource* aSource,
|
||||
@ -194,7 +194,7 @@ Assertion::~Assertion()
|
||||
if (mHashEntry && u.hash.mPropertyHash) {
|
||||
PL_DHashTableEnumerate(u.hash.mPropertyHash, DeletePropertyHashEntry,
|
||||
nullptr);
|
||||
PL_DHashTableDestroy(u.hash.mPropertyHash);
|
||||
delete u.hash.mPropertyHash;
|
||||
u.hash.mPropertyHash = nullptr;
|
||||
}
|
||||
|
||||
|
@ -169,22 +169,6 @@ SizeOfEntryStore(uint32_t aCapacity, uint32_t aEntrySize, uint32_t* aNbytes)
|
||||
return uint64_t(*aNbytes) == nbytes64; // returns false on overflow
|
||||
}
|
||||
|
||||
PLDHashTable*
|
||||
PL_NewDHashTable(const PLDHashTableOps* aOps, uint32_t aEntrySize,
|
||||
uint32_t aLength)
|
||||
{
|
||||
PLDHashTable* table = new PLDHashTable();
|
||||
PL_DHashTableInit(table, aOps, aEntrySize, aLength);
|
||||
return table;
|
||||
}
|
||||
|
||||
void
|
||||
PL_DHashTableDestroy(PLDHashTable* aTable)
|
||||
{
|
||||
PL_DHashTableFinish(aTable);
|
||||
delete aTable;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute max and min load numbers (entry counts). We have a secondary max
|
||||
* that allows us to overload a table reasonably if it cannot be grown further
|
||||
|
@ -476,21 +476,6 @@ void PL_DHashFreeStringKey(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
|
||||
*/
|
||||
const PLDHashTableOps* PL_DHashGetStubOps(void);
|
||||
|
||||
/*
|
||||
* Dynamically allocate a new PLDHashTable, initialize it using
|
||||
* PL_DHashTableInit, and return its address. Never returns null.
|
||||
*/
|
||||
PLDHashTable* PL_NewDHashTable(
|
||||
const PLDHashTableOps* aOps, uint32_t aEntrySize,
|
||||
uint32_t aLength = PL_DHASH_DEFAULT_INITIAL_LENGTH);
|
||||
|
||||
/*
|
||||
* Free |aTable|'s entry storage and |aTable| itself (both via
|
||||
* aTable->mOps->freeTable). Use this function to destroy a PLDHashTable that
|
||||
* was allocated on the heap via PL_NewDHashTable().
|
||||
*/
|
||||
void PL_DHashTableDestroy(PLDHashTable* aTable);
|
||||
|
||||
/*
|
||||
* This function works similarly to the multi-arg constructor.
|
||||
*
|
||||
|
@ -186,11 +186,11 @@ static bool test_pldhash_grow_to_max_capacity()
|
||||
};
|
||||
|
||||
// This is infallible.
|
||||
PLDHashTable* t = PL_NewDHashTable(&ops, sizeof(PLDHashEntryStub), 128);
|
||||
PLDHashTable* t = new PLDHashTable(&ops, sizeof(PLDHashEntryStub), 128);
|
||||
|
||||
// Check that New() sets |t->ops|.
|
||||
if (!t->IsInitialized()) {
|
||||
PL_DHashTableDestroy(t);
|
||||
delete t;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ static bool test_pldhash_grow_to_max_capacity()
|
||||
return false;
|
||||
}
|
||||
|
||||
PL_DHashTableDestroy(t);
|
||||
delete t;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user