зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
c2f21aa076
Коммит
5a9589bf20
|
@ -167,7 +167,7 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t EnumerateRead(EnumReadFunction aEnumFunc, void* aUserArg) const
|
uint32_t EnumerateRead(EnumReadFunction aEnumFunc, void* aUserArg) const
|
||||||
{
|
{
|
||||||
NS_ASSERTION(this->mTable.entrySize,
|
NS_ASSERTION(this->mTable.ops,
|
||||||
"nsBaseHashtable was not initialized properly.");
|
"nsBaseHashtable was not initialized properly.");
|
||||||
|
|
||||||
s_EnumReadArgs enumData = { aEnumFunc, aUserArg };
|
s_EnumReadArgs enumData = { aEnumFunc, aUserArg };
|
||||||
|
@ -199,7 +199,7 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t Enumerate(EnumFunction aEnumFunc, void* aUserArg)
|
uint32_t Enumerate(EnumFunction aEnumFunc, void* aUserArg)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(this->mTable.entrySize,
|
NS_ASSERTION(this->mTable.ops,
|
||||||
"nsBaseHashtable was not initialized properly.");
|
"nsBaseHashtable was not initialized properly.");
|
||||||
|
|
||||||
s_EnumArgs enumData = { aEnumFunc, aUserArg };
|
s_EnumArgs enumData = { aEnumFunc, aUserArg };
|
||||||
|
|
|
@ -125,7 +125,7 @@ public:
|
||||||
*/
|
*/
|
||||||
EntryType* GetEntry(KeyType aKey) const
|
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*>(
|
EntryType* entry = reinterpret_cast<EntryType*>(
|
||||||
PL_DHashTableOperate(const_cast<PLDHashTable*>(&mTable),
|
PL_DHashTableOperate(const_cast<PLDHashTable*>(&mTable),
|
||||||
|
@ -156,7 +156,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
EntryType* PutEntry(KeyType aKey, const fallible_t&) NS_WARN_UNUSED_RESULT {
|
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(
|
return static_cast<EntryType*>(PL_DHashTableOperate(
|
||||||
&mTable, EntryType::KeyToPointer(aKey), PL_DHASH_ADD));
|
&mTable, EntryType::KeyToPointer(aKey), PL_DHASH_ADD));
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void RemoveEntry(KeyType aKey)
|
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,
|
PL_DHashTableOperate(&mTable,
|
||||||
EntryType::KeyToPointer(aKey),
|
EntryType::KeyToPointer(aKey),
|
||||||
|
@ -209,7 +209,7 @@ public:
|
||||||
*/
|
*/
|
||||||
uint32_t EnumerateEntries(Enumerator aEnumFunc, void* aUserArg)
|
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 };
|
s_EnumArgs args = { aEnumFunc, aUserArg };
|
||||||
return PL_DHashTableEnumerate(&mTable, s_EnumStub, &args);
|
return PL_DHashTableEnumerate(&mTable, s_EnumStub, &args);
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void Clear()
|
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);
|
PL_DHashTableEnumerate(&mTable, PL_DHashStubEnumRemove, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void MarkImmutable()
|
void MarkImmutable()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mTable.entrySize, "nsTHashtable was not initialized properly.");
|
NS_ASSERTION(mTable.ops, "nsTHashtable was not initialized properly.");
|
||||||
|
|
||||||
PL_DHashMarkTableImmutable(&mTable);
|
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
|
// Indicate that aOther is not initialized. This will make its destructor a
|
||||||
// nop, which is what we want.
|
// nop, which is what we want.
|
||||||
aOther.mTable.entrySize = 0;
|
aOther.mTable.ops = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class EntryType>
|
template<class EntryType>
|
||||||
nsTHashtable<EntryType>::~nsTHashtable()
|
nsTHashtable<EntryType>::~nsTHashtable()
|
||||||
{
|
{
|
||||||
if (mTable.entrySize) {
|
if (mTable.ops) {
|
||||||
PL_DHashTableFinish(&mTable);
|
PL_DHashTableFinish(&mTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче