[webkit-reviews] review granted: [Bug 73784] Use HashMap<OwnPtr> in CollectionCache : [Attachment 117812] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Dec 4 18:35:29 PST 2011

Andreas Kling <kling at webkit.org> has granted Darin Adler <darin at apple.com>'s
request for review:
Bug 73784: Use HashMap<OwnPtr> in CollectionCache

Attachment 117812: Patch

------- Additional Comments from Andreas Kling <kling at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=117812&action=review

> Source/WebCore/html/HTMLCollection.cpp:344
> +	       OwnPtr<Vector<Element*> >& nameVector =
m_info->nameCache.add(nameAttrVal.impl(), nullptr).first->second;
> +	       if (!nameVector)
> +		   nameVector = adoptPtr(new Vector<Element*>);

Given how much this pattern repeats, it seems like we could factor them into
functions, e.g ensureNameCache() and ensureIdCache().
That would also make the "// add to foo cache" comments even more redundant.

More information about the webkit-reviews mailing list