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

Unified Diff: third_party/WebKit/Source/bindings/templates/constants.cpp

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: third_party/WebKit/Source/bindings/templates/constants.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/constants.cpp b/third_party/WebKit/Source/bindings/templates/constants.cpp
index bac23ca38f6fa129543b54c134c7c6d3b8336fa0..e136729ffac8ac02187fe752043c8e1356b32064 100644
--- a/third_party/WebKit/Source/bindings/templates/constants.cpp
+++ b/third_party/WebKit/Source/bindings/templates/constants.cpp
@@ -34,13 +34,24 @@ const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = {
};
V8DOMConfiguration::installConstants(isolate, functionTemplate, prototypeTemplate, {{v8_class}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants));
{% endif %}
+ExecutionContext* ec = currentExecutionContext(isolate);
+ALLOW_UNUSED_LOCAL(ec);
+String constantsErrorMessage;
haraken 2015/12/16 02:16:41 What is the constantsErrorMessage for?
Daniel Nishi 2015/12/16 21:42:03 Removed.
+ALLOW_UNUSED_LOCAL(constantsErrorMessage);
{# Runtime-enabled constants #}
{% for constant_tuple in runtime_enabled_constants %}
{% filter runtime_enabled(constant_tuple[0]) %}
{% for constant in constant_tuple[1] %}
{% set constant_name = constant.name.title().replace('_', '') %}
+{% if constant.name in experimental_enabled_constants %}
+if (Experiments::isApiEnabled(ec, "{{experimental_enabled_constants.get(constant.name)}}", constantsErrorMessage)) {
+ const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configuration = {{constant_configuration(constant)}};
+ V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate, constant{{constant_name}}Configuration);
+}
+{% else %}
const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configuration = {{constant_configuration(constant)}};
V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate, constant{{constant_name}}Configuration);
+{% endif %}
{% endfor %}
{% endfilter %}
{% endfor %}
@@ -48,6 +59,13 @@ V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
{% for constant in special_getter_constants %}
V8DOMConfiguration::installConstantWithGetter(isolate, functionTemplate, prototypeTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}ConstantGetterCallback);
{% endfor %}
+{# Constants with [ExperimentEnabled] only #}
+{% for constant in experimental_only_constants %}
haraken 2015/12/16 02:16:42 Why do we need to distinguish experimental_only_co
Daniel Nishi 2015/12/16 21:42:03 Yes. This is being done so that they interact prop
+if (Experiments::isApiEnabled(ec, "{{constant['experimental_api_name']}}", constantsErrorMessage)) {
+ const V8DOMConfiguration::ConstantConfiguration constant{{constant.name}}Configuration = {{constant_configuration(constant)}};
+ V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate, constant{{constant.name}}Configuration);
+}
+{% endfor %}
{# Check constants #}
{% if not do_not_check_constants %}
{% for constant in constants %}

Powered by Google App Engine
This is Rietveld 408576698