Bug 1478879 - Remove Range/Enum use in XPConnect. r=mccr8

--HG--
extra : rebase_source : 2117904e70e05e318e2b13a5653f029dfdbed851
This commit is contained in:
Nicholas Nethercote 2018-07-31 10:31:00 +10:00
Родитель 93bbf0be8b
Коммит 6f95417fb4
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -49,8 +49,8 @@ JSObject2WrappedJSMap::UpdateWeakPointersAfterGC()
// moved. Release any wrappers whose weakly held JSObject has died.
nsTArray<RefPtr<nsXPCWrappedJS>> dying;
for (Map::Enum e(mTable); !e.empty(); e.popFront()) {
nsXPCWrappedJS* wrapper = e.front().value();
for (auto iter = mTable.modIter(); !iter.done(); iter.next()) {
nsXPCWrappedJS* wrapper = iter.get().value();
MOZ_ASSERT(wrapper, "found a null JS wrapper!");
// Walk the wrapper chain and update all JSObjects.
@ -64,20 +64,20 @@ JSObject2WrappedJSMap::UpdateWeakPointersAfterGC()
}
// Remove or update the JSObject key in the table if necessary.
JSObject* obj = e.front().key().unbarrieredGet();
JSObject* obj = iter.get().key().unbarrieredGet();
JS_UpdateWeakPointerAfterGCUnbarriered(&obj);
if (!obj)
e.removeFront();
iter.remove();
else
e.front().mutableKey() = obj;
iter.get().mutableKey() = obj;
}
}
void
JSObject2WrappedJSMap::ShutdownMarker()
{
for (Map::Range r = mTable.all(); !r.empty(); r.popFront()) {
nsXPCWrappedJS* wrapper = r.front().value();
for (auto iter = mTable.iter(); !iter.done(); iter.next()) {
nsXPCWrappedJS* wrapper = iter.get().value();
MOZ_ASSERT(wrapper, "found a null JS wrapper!");
MOZ_ASSERT(wrapper->IsValid(), "found an invalid JS wrapper!");
wrapper->SystemIsBeingShutDown();
@ -96,8 +96,8 @@ size_t
JSObject2WrappedJSMap::SizeOfWrappedJS(mozilla::MallocSizeOf mallocSizeOf) const
{
size_t n = 0;
for (Map::Range r = mTable.all(); !r.empty(); r.popFront())
n += r.front().value()->SizeOfIncludingThis(mallocSizeOf);
for (auto iter = mTable.iter(); !iter.done(); iter.next())
n += iter.get().value()->SizeOfIncludingThis(mallocSizeOf);
return n;
}

Просмотреть файл

@ -52,8 +52,8 @@ public:
#ifdef DEBUG
inline bool HasWrapper(nsXPCWrappedJS* wrapper) {
for (auto r = mTable.all(); !r.empty(); r.popFront()) {
if (r.front().value() == wrapper)
for (auto iter = mTable.iter(); !iter.done(); iter.next()) {
if (iter.get().value() == wrapper)
return true;
}
return false;
@ -79,8 +79,8 @@ public:
inline uint32_t Count() {return mTable.count();}
inline void Dump(int16_t depth) {
for (Map::Range r = mTable.all(); !r.empty(); r.popFront())
r.front().value()->DebugDump(depth);
for (auto iter = mTable.iter(); !iter.done(); iter.next())
iter.get().value()->DebugDump(depth);
}
void UpdateWeakPointersAfterGC();