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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/ElementFactory.cpp.tmpl

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 {% from "macros.tmpl" import license %} 1 {% from "macros.tmpl" import license %}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "{{namespace}}ElementFactory.h" 4 #include "{{namespace}}ElementFactory.h"
5 5
6 #include "{{namespace}}Names.h" 6 #include "{{namespace}}Names.h"
7 {% for tag in tags|groupby('interface') %} 7 {% for tag in tags|groupby('interface') %}
8 #include "core/{{namespace|lower}}/{{tag[0]}}.h" 8 #include "core/{{namespace|lower}}/{{tag[0]}}.h"
9 {% endfor %} 9 {% endfor %}
10 {% if fallback_interface %} 10 {% if fallback_interface %}
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 for (size_t i = 0; i < WTF_ARRAY_LENGTH(data); i++) 66 for (size_t i = 0; i < WTF_ARRAY_LENGTH(data); i++)
67 g_constructors->set(data[i].tag.localName(), data[i].func); 67 g_constructors->set(data[i].tag.localName(), data[i].func);
68 } 68 }
69 69
70 {{namespace}}Element* {{namespace}}ElementFactory::create{{namespace}}Element( 70 {{namespace}}Element* {{namespace}}ElementFactory::create{{namespace}}Element(
71 const AtomicString& localName, 71 const AtomicString& localName,
72 Document& document, 72 Document& document,
73 CreateElementFlags flags) { 73 CreateElementFlags flags) {
74 if (!g_constructors) 74 if (!g_constructors)
75 create{{namespace}}FunctionMap(); 75 create{{namespace}}FunctionMap();
76 if (ConstructorFunction function = g_constructors->get(localName)) 76 if (ConstructorFunction function = g_constructors->at(localName))
77 return function(document, flags); 77 return function(document, flags);
78 78
79 {% if namespace == 'HTML' %} 79 {% if namespace == 'HTML' %}
80 // createElement handles custom element creation itself in order to 80 // createElement handles custom element creation itself in order to
81 // transmit exceptions. 81 // transmit exceptions.
82 // TODO(dominicc): When the HTML parser can pass an error 82 // TODO(dominicc): When the HTML parser can pass an error
83 // reporting ExceptionState, and "v0" custom elements have been 83 // reporting ExceptionState, and "v0" custom elements have been
84 // removed, consolidate custom element creation into one place. 84 // removed, consolidate custom element creation into one place.
85 if (flags != CreatedByCreateElement && CustomElement::shouldCreateCustomElemen t(localName)) { 85 if (flags != CreatedByCreateElement && CustomElement::shouldCreateCustomElemen t(localName)) {
86 QualifiedName tagName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI); 86 QualifiedName tagName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
87 if (flags & AsynchronousCustomElements) 87 if (flags & AsynchronousCustomElements)
88 return CustomElement::createCustomElementAsync(document, tagName); 88 return CustomElement::createCustomElementAsync(document, tagName);
89 return CustomElement::createCustomElementSync(document, tagName); 89 return CustomElement::createCustomElementSync(document, tagName);
90 } 90 }
91 {% endif %} 91 {% endif %}
92 92
93 if (document.registrationContext() && 93 if (document.registrationContext() &&
94 V0CustomElement::isValidName(localName)) { 94 V0CustomElement::isValidName(localName)) {
95 Element* element = document.registrationContext()->createCustomTagElement( 95 Element* element = document.registrationContext()->createCustomTagElement(
96 document, QualifiedName(nullAtom, localName, {{namespace_prefix}}Namespa ceURI)); 96 document, QualifiedName(nullAtom, localName, {{namespace_prefix}}Namespa ceURI));
97 SECURITY_DCHECK(element->is{{namespace}}Element()); 97 SECURITY_DCHECK(element->is{{namespace}}Element());
98 return to{{namespace}}Element(element); 98 return to{{namespace}}Element(element);
99 } 99 }
100 100
101 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{nam espace_prefix}}NamespaceURI), document); 101 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{nam espace_prefix}}NamespaceURI), document);
102 } 102 }
103 103
104 } // namespace blink 104 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698