From 108e139c8df5243608c205f137d842077827c785 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Mon, 27 Jul 2015 18:45:12 -0700 Subject: [PATCH] Bug 1186806 - Part 4: Replace nsBaseHashtable::EnumerateRead() with iterators in HTMLPropertiesCollection. r=khuey --- dom/html/HTMLPropertiesCollection.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/dom/html/HTMLPropertiesCollection.cpp b/dom/html/HTMLPropertiesCollection.cpp index 8a511534a2c1..19ecfa8ea7ea 100644 --- a/dom/html/HTMLPropertiesCollection.cpp +++ b/dom/html/HTMLPropertiesCollection.cpp @@ -73,14 +73,6 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLPropertiesCollection) NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLPropertiesCollection) - -static PLDHashOperator -SetPropertyListDocument(const nsAString& aKey, PropertyNodeList* aEntry, void* aData) -{ - aEntry->SetDocument(static_cast(aData)); - return PL_DHASH_NEXT; -} - void HTMLPropertiesCollection::SetDocument(nsIDocument* aDocument) { if (mDoc) { @@ -90,7 +82,9 @@ HTMLPropertiesCollection::SetDocument(nsIDocument* aDocument) { if (mDoc) { mDoc->AddMutationObserver(this); } - mNamedItemEntries.EnumerateRead(SetPropertyListDocument, aDocument); + for (auto iter = mNamedItemEntries.Iter(); !iter.Done(); iter.Next()) { + iter.UserData()->SetDocument(aDocument); + } mIsDirty = true; } @@ -191,13 +185,6 @@ HTMLPropertiesCollection::ContentRemoved(nsIDocument *aDocument, mIsDirty = true; } -static PLDHashOperator -MarkDirty(const nsAString& aKey, PropertyNodeList* aEntry, void* aData) -{ - aEntry->SetDirty(); - return PL_DHASH_NEXT; -} - void HTMLPropertiesCollection::EnsureFresh() { @@ -209,7 +196,9 @@ HTMLPropertiesCollection::EnsureFresh() mProperties.Clear(); mNames->Clear(); // We don't clear NamedItemEntries because the PropertyNodeLists must be live. - mNamedItemEntries.EnumerateRead(MarkDirty, nullptr); + for (auto iter = mNamedItemEntries.Iter(); !iter.Done(); iter.Next()) { + iter.UserData()->SetDirty(); + } if (!mRoot->HasAttr(kNameSpaceID_None, nsGkAtoms::itemscope)) { return; }