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

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

Issue 2279703002: Add a scoped context object for synchronous CE creation (Closed)
Patch Set: Clean up Created 4 years, 3 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 %}
11 #include "core/{{namespace|lower}}/{{fallback_interface}}.h" 11 #include "core/{{namespace|lower}}/{{fallback_interface}}.h"
12 {% endif %} 12 {% endif %}
13 {% if namespace == 'HTML' %} 13 {% if namespace == 'HTML' %}
14 #include "core/dom/custom/CustomElement.h" 14 #include "core/dom/custom/CustomElement.h"
15 #include "core/dom/custom/CustomElementCreationScope.h"
15 {% endif %} 16 {% endif %}
16 #include "core/dom/custom/V0CustomElement.h" 17 #include "core/dom/custom/V0CustomElement.h"
17 #include "core/dom/custom/V0CustomElementRegistrationContext.h" 18 #include "core/dom/custom/V0CustomElementRegistrationContext.h"
18 #include "core/dom/Document.h" 19 #include "core/dom/Document.h"
19 #include "core/frame/Settings.h" 20 #include "core/frame/Settings.h"
20 #include "platform/RuntimeEnabledFeatures.h" 21 #include "platform/RuntimeEnabledFeatures.h"
21 #include "wtf/HashMap.h" 22 #include "wtf/HashMap.h"
22 23
23 namespace blink { 24 namespace blink {
24 25
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!g_constructors) 88 if (!g_constructors)
88 create{{namespace}}FunctionMap(); 89 create{{namespace}}FunctionMap();
89 if (ConstructorFunction function = g_constructors->get(localName)) 90 if (ConstructorFunction function = g_constructors->get(localName))
90 return function(document, {% if namespace == 'HTML' %}formElement, {% en dif %}flags); 91 return function(document, {% if namespace == 'HTML' %}formElement, {% en dif %}flags);
91 92
92 {% if namespace == 'HTML' %} 93 {% if namespace == 'HTML' %}
93 if (CustomElement::shouldCreateCustomElement(localName)) { 94 if (CustomElement::shouldCreateCustomElement(localName)) {
94 QualifiedName tagName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI) ; 95 QualifiedName tagName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI) ;
95 if (flags & AsynchronousCustomElements) 96 if (flags & AsynchronousCustomElements)
96 return CustomElement::createCustomElementAsync(document, tagName); 97 return CustomElement::createCustomElementAsync(document, tagName);
98 CustomElementCreationScope scope(&document);
97 return CustomElement::createCustomElementSync(document, tagName); 99 return CustomElement::createCustomElementSync(document, tagName);
98 } 100 }
99 {% endif %} 101 {% endif %}
100 102
101 if (document.registrationContext() && V0CustomElement::isValidName(localName )) { 103 if (document.registrationContext() && V0CustomElement::isValidName(localName )) {
102 Element* element = document.registrationContext()->createCustomTagElemen t(document, QualifiedName(nullAtom, localName, {{namespace_prefix}}NamespaceURI) ); 104 Element* element = document.registrationContext()->createCustomTagElemen t(document, QualifiedName(nullAtom, localName, {{namespace_prefix}}NamespaceURI) );
103 ASSERT_WITH_SECURITY_IMPLICATION(element->is{{namespace}}Element()); 105 ASSERT_WITH_SECURITY_IMPLICATION(element->is{{namespace}}Element());
104 return to{{namespace}}Element(element); 106 return to{{namespace}}Element(element);
105 } 107 }
106 108
107 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{n amespace_prefix}}NamespaceURI), document); 109 return {{fallback_interface}}::create(QualifiedName(nullAtom, localName, {{n amespace_prefix}}NamespaceURI), document);
108 } 110 }
109 111
110 } // namespace blink 112 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/custom/V8HTMLElementCustom.cpp ('k') | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698