Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 137783012: MakeQualifiedNames should generate lazily created arrays for attributes and tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/build/scripts/templates/MakeQualifiedNames.h.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLTreeBuilder.cpp
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index 0de41b84e4c01c101df58d29fa4bab45cf9a933d..9ca8531bdc0c740947121d297236338bf0d652dd 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -569,8 +569,8 @@ static void adjustSVGTagNameCase(AtomicHTMLToken* token)
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
caseMap = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* svgTags = SVGNames::getSVGTags();
- mapLoweredLocalNameToName(caseMap, svgTags, SVGNames::SVGTagsCount);
+ OwnPtr<const QualifiedName*[]> svgTags = SVGNames::getSVGTags();
+ mapLoweredLocalNameToName(caseMap, svgTags.get(), SVGNames::SVGTagsCount);
}
const QualifiedName& casedName = caseMap->get(token->name());
@@ -579,14 +579,14 @@ static void adjustSVGTagNameCase(AtomicHTMLToken* token)
token->setName(casedName.localName());
}
-template<const QualifiedName* const* getAttrs(), unsigned length>
+template<PassOwnPtr<const QualifiedName*[]> getAttrs(), unsigned length>
static void adjustAttributes(AtomicHTMLToken* token)
{
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
caseMap = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* attrs = getAttrs();
- mapLoweredLocalNameToName(caseMap, attrs, length);
+ OwnPtr<const QualifiedName*[]> attrs = getAttrs();
+ mapLoweredLocalNameToName(caseMap, attrs.get(), length);
}
for (unsigned i = 0; i < token->attributes().size(); ++i) {
@@ -624,11 +624,11 @@ static void adjustForeignAttributes(AtomicHTMLToken* token)
if (!map) {
map = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* attrs = XLinkNames::getXLinkAttrs();
- addNamesWithPrefix(map, xlinkAtom, attrs, XLinkNames::XLinkAttrsCount);
+ OwnPtr<const QualifiedName*[]> attrs = XLinkNames::getXLinkAttrs();
+ addNamesWithPrefix(map, xlinkAtom, attrs.get(), XLinkNames::XLinkAttrsCount);
- attrs = XMLNames::getXMLAttrs();
- addNamesWithPrefix(map, xmlAtom, attrs, XMLNames::XMLAttrsCount);
+ OwnPtr<const QualifiedName*[]> xmlAttrs = XMLNames::getXMLAttrs();
+ addNamesWithPrefix(map, xmlAtom, xmlAttrs.get(), XMLNames::XMLAttrsCount);
map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr);
map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::xmlnsNamespaceURI));
« no previous file with comments | « Source/build/scripts/templates/MakeQualifiedNames.h.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698