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

Unified Diff: Source/core/page/RuntimeEnabledFeatures.h.tmpl

Issue 14905002: Use jinja2 templating engine for Python code generators (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 8 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/core/page/RuntimeEnabledFeatures.h.tmpl
diff --git a/Source/core/page/RuntimeEnabledFeatures.h.tmpl b/Source/core/page/RuntimeEnabledFeatures.h.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..9dc847df1b2c355d2d272430767c753ddc8b2ffe
--- /dev/null
+++ b/Source/core/page/RuntimeEnabledFeatures.h.tmpl
@@ -0,0 +1,44 @@
+{% from "macros.tmpl" import wrap_with_condition -%}
+
+{{ license }}
+#ifndef RuntimeEnabledFeatures_h
+#define RuntimeEnabledFeatures_h
+
+namespace WebCore {
+
+// A class that stores static enablers for all experimental features.
+
+class RuntimeEnabledFeatures {
+public:
+{%- for feature in features %}
+{%- if feature.custom %}
+ static bool {{feature.first_lowered_name}}Enabled();
+{%- else %}
+{%- if feature.condition %}
+#if ENABLE({{feature.condition}})
+{%- endif %}
+ static void set{{feature.name}}Enabled(bool isEnabled) { is{{feature.name}}Enabled = isEnabled; }
+ static bool {{feature.first_lowered_name}}Enabled() { return {{feature.enabled_condition}}; }
+{%- if feature.condition %}
+#else
+ static void set{{feature.name}}Enabled(bool) { }
+ static bool {{feature.first_lowered_name}}Enabled() { return false; }
+#endif
+{%- endif %}
+{%- endif %}
+{% endfor %}
+
+private:
+ RuntimeEnabledFeatures() { }
+
+{% for feature in features if not feature.custom %}
+{%- call wrap_with_condition(feature.condition) %}
+ static bool is{{feature.name}}Enabled;
+{%- endcall %}
+{%- endfor %}
+};
+
+} // namespace WebCore
+
+#endif // RuntimeEnabledFeatures_h
+

Powered by Google App Engine
This is Rietveld 408576698