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

Unified Diff: Source/build/scripts/templates/ElementFactory.cpp.tmpl

Issue 330093002: Add support in generate scripts to handle Conditional (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Also add support for make_names.py script to handle Conditional Created 6 years, 6 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
Index: Source/build/scripts/templates/ElementFactory.cpp.tmpl
diff --git a/Source/build/scripts/templates/ElementFactory.cpp.tmpl b/Source/build/scripts/templates/ElementFactory.cpp.tmpl
index cc439824fd1d0850f123cabc54ab63f86afc47f8..722fe9be4dbd3d59532e8359927d1c7a9d12faca 100644
--- a/Source/build/scripts/templates/ElementFactory.cpp.tmpl
+++ b/Source/build/scripts/templates/ElementFactory.cpp.tmpl
@@ -35,6 +35,7 @@ typedef HashMap<AtomicString, ConstructorFunction> FunctionMap;
static FunctionMap* g_constructors = 0;
{% for tag in tags|sort if not tag.noConstructor %}
+{% filter enable_conditional(tag.Conditional) %}
static PassRefPtrWillBeRawPtr<{{namespace}}Element> {{tag|symbol}}Constructor(
Document& document,
{% if namespace == 'HTML' %}
@@ -57,6 +58,7 @@ static PassRefPtrWillBeRawPtr<{{namespace}}Element> {{tag|symbol}}Constructor(
{%- if tag.constructorNeedsCreatedByParser %}, createdByParser{% endif -%}
);
}
+{% endfilter %}
{% endfor %}
struct Create{{namespace}}FunctionMapData {
@@ -68,9 +70,13 @@ static void create{{namespace}}FunctionMap()
{
ASSERT(!g_constructors);
g_constructors = new FunctionMap;
+ // FIXME: Compilation on MSVC will fail if data[] is empty. Zero size arrays
Nils Barth (inactive) 2014/06/16 06:27:52 I wouldn't make this a FIXME; it's fine to just ha
+ // not allowed in MSVC. Make sure tags list is not empty.
static const Create{{namespace}}FunctionMapData data[] = {
{% for tag in tags|sort if not tag.noConstructor %}
+ {% filter enable_conditional(tag.Conditional) %}
{ {{tag|symbol}}Tag, {{tag|symbol}}Constructor },
+ {% endfilter %}
{% endfor %}
};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(data); i++)

Powered by Google App Engine
This is Rietveld 408576698