Chromium Code Reviews

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: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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..6e1375b96e4c1de41f10ba290b23340f770b54e8 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -569,7 +569,8 @@ static void adjustSVGTagNameCase(AtomicHTMLToken* token)
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
caseMap = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* svgTags = SVGNames::getSVGTags();
+ QualifiedName* svgTags[SVGNames::SVGTagsCount];
+ SVGNames::getSVGTags(svgTags, SVGNames::SVGTagsCount);
mapLoweredLocalNameToName(caseMap, svgTags, SVGNames::SVGTagsCount);
}
@@ -579,13 +580,14 @@ static void adjustSVGTagNameCase(AtomicHTMLToken* token)
token->setName(casedName.localName());
}
-template<const QualifiedName* const* getAttrs(), unsigned length>
+template<void getAttrs(WebCore::QualifiedName*[], unsigned), unsigned length>
static void adjustAttributes(AtomicHTMLToken* token)
{
static PrefixedNameToQualifiedNameMap* caseMap = 0;
if (!caseMap) {
caseMap = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* attrs = getAttrs();
+ WebCore::QualifiedName* attrs[length];
Inactive 2014/01/15 19:27:02 You probably don't need the WebCore:: here
+ getAttrs(attrs, length);
mapLoweredLocalNameToName(caseMap, attrs, length);
}
@@ -624,11 +626,13 @@ static void adjustForeignAttributes(AtomicHTMLToken* token)
if (!map) {
map = new PrefixedNameToQualifiedNameMap;
- const QualifiedName* const* attrs = XLinkNames::getXLinkAttrs();
+ WebCore::QualifiedName* attrs[XLinkNames::XLinkAttrsCount];
Inactive 2014/01/15 19:27:02 Ditto.
+ XLinkNames::getXLinkAttrs(attrs, XLinkNames::XLinkAttrsCount);
addNamesWithPrefix(map, xlinkAtom, attrs, XLinkNames::XLinkAttrsCount);
- attrs = XMLNames::getXMLAttrs();
- addNamesWithPrefix(map, xmlAtom, attrs, XMLNames::XMLAttrsCount);
+ WebCore::QualifiedName* xmlAttrs[XMLNames::XMLAttrsCount];
Inactive 2014/01/15 19:27:02 Ditto.
+ XMLNames::getXMLAttrs(xmlAttrs, XMLNames::XMLAttrsCount);
+ addNamesWithPrefix(map, xmlAtom, xmlAttrs, XMLNames::XMLAttrsCount);
map->add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr);
map->add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::xmlnsNamespaceURI));

Powered by Google App Engine