Bug 1187781 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in dom/xbl/ with iterators. r=mrbkap.

--HG--
extra : rebase_source : bc7849aa54f110afedb3dcff6ef1bb9197eacbdb
This commit is contained in:
Nicholas Nethercote 2015-11-15 14:52:57 -08:00
Родитель 5ab167c3b0
Коммит d6100413c6
1 изменённых файлов: 9 добавлений и 27 удалений

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

@ -80,13 +80,6 @@ UnmarkXBLJSObject(JS::GCCellPtr aPtr, const char* aName, void* aClosure)
JS::ExposeObjectToActiveJS(&aPtr.as<JSObject>());
}
static PLDHashOperator
UnmarkProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
aProto->Trace(TraceCallbackFunc(UnmarkXBLJSObject), nullptr);
return PL_DHASH_NEXT;
}
void
nsXBLDocumentInfo::MarkInCCGeneration(uint32_t aGeneration)
{
@ -95,7 +88,9 @@ nsXBLDocumentInfo::MarkInCCGeneration(uint32_t aGeneration)
}
// Unmark any JS we hold
if (mBindingTable) {
mBindingTable->EnumerateRead(UnmarkProtos, nullptr);
for (auto iter = mBindingTable->Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->Trace(TraceCallbackFunc(UnmarkXBLJSObject), nullptr);
}
}
}
@ -190,16 +185,6 @@ nsXBLDocumentInfo::RemovePrototypeBinding(const nsACString& aRef)
}
}
// Callback to enumerate over the bindings from this document and write them
// out to the cache.
static PLDHashOperator
WriteBinding(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
aProto->Write((nsIObjectOutputStream*)aClosure);
return PL_DHASH_NEXT;
}
// static
nsresult
nsXBLDocumentInfo::ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo)
@ -292,7 +277,9 @@ nsXBLDocumentInfo::WritePrototypeBindings()
NS_ENSURE_SUCCESS(rv, rv);
if (mBindingTable) {
mBindingTable->EnumerateRead(WriteBinding, stream);
for (auto iter = mBindingTable->Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->Write(stream);
}
}
// write a end marker at the end
@ -316,18 +303,13 @@ nsXBLDocumentInfo::SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding)
mFirstBinding = aBinding;
}
static PLDHashOperator
FlushScopedSkinSheets(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
aProto->FlushSkinSheets();
return PL_DHASH_NEXT;
}
void
nsXBLDocumentInfo::FlushSkinStylesheets()
{
if (mBindingTable) {
mBindingTable->EnumerateRead(FlushScopedSkinSheets, nullptr);
for (auto iter = mBindingTable->Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->FlushSkinSheets();
}
}
}