Bug 1057928 (part 2) - In nsTHashtable, use |ops| instead of |entrySize| to indicate table liveness. r=dbaron.

--HG--
extra : rebase_source : eca0eb98fe01fe6fc1a6a36de9b04bab5c71781d
This commit is contained in:
Nicholas Nethercote 2014-08-25 00:32:24 -07:00
parent 01cd8c173d
commit b6b41f70af
2 changed files with 10 additions and 10 deletions

View File

@ -167,7 +167,7 @@ public:
*/
uint32_t EnumerateRead(EnumReadFunction aEnumFunc, void* aUserArg) const
{
NS_ASSERTION(this->mTable.entrySize,
NS_ASSERTION(this->mTable.ops,
"nsBaseHashtable was not initialized properly.");
s_EnumReadArgs enumData = { aEnumFunc, aUserArg };
@ -199,7 +199,7 @@ public:
*/
uint32_t Enumerate(EnumFunction aEnumFunc, void* aUserArg)
{
NS_ASSERTION(this->mTable.entrySize,
NS_ASSERTION(this->mTable.ops,
"nsBaseHashtable was not initialized properly.");
s_EnumArgs enumData = { aEnumFunc, aUserArg };

View File

@ -125,7 +125,7 @@ public:
*/
EntryType* GetEntry(KeyType aKey) const
{
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
EntryType* entry = reinterpret_cast<EntryType*>(
PL_DHashTableOperate(const_cast<PLDHashTable*>(&mTable),
@ -156,7 +156,7 @@ public:
}
EntryType* PutEntry(KeyType aKey, const fallible_t&) NS_WARN_UNUSED_RESULT {
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
return static_cast<EntryType*>(PL_DHashTableOperate(
&mTable, EntryType::KeyToPointer(aKey), PL_DHASH_ADD));
@ -168,7 +168,7 @@ public:
*/
void RemoveEntry(KeyType aKey)
{
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
PL_DHashTableOperate(&mTable,
EntryType::KeyToPointer(aKey),
@ -209,7 +209,7 @@ public:
*/
uint32_t EnumerateEntries(Enumerator aEnumFunc, void* aUserArg)
{
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
s_EnumArgs args = { aEnumFunc, aUserArg };
return PL_DHashTableEnumerate(&mTable, s_EnumStub, &args);
@ -220,7 +220,7 @@ public:
*/
void Clear()
{
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
PL_DHashTableEnumerate(&mTable, PL_DHashStubEnumRemove, nullptr);
}
@ -299,7 +299,7 @@ public:
*/
void MarkImmutable()
{
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
PL_DHashMarkTableImmutable(&mTable);
}
@ -392,13 +392,13 @@ nsTHashtable<EntryType>::nsTHashtable(nsTHashtable<EntryType>&& aOther)
// Indicate that aOther is not initialized. This will make its destructor a
// nop, which is what we want.
aOther.mTable.entrySize = 0;
aOther.mTable.ops = nullptr;
}
template<class EntryType>
nsTHashtable<EntryType>::~nsTHashtable()
{
if (mTable.entrySize) {
if (mTable.ops) {
PL_DHashTableFinish(&mTable);
}
}