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

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

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More sharing. 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/interface_base.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
index 22102d8796868d8ad8c07e5265562e0feb5022a6..3707051fbc7307d3eaa6aef9db28152489abad62 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -298,7 +298,7 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
'V8%s::domTemplate(isolate)' % parent_interface
if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
{% if runtime_enabled_function %}
- if (!{{runtime_enabled_function}}())
+ if (!({{runtime_enabled_function}}))
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0);
else
{% endif %}
@@ -326,7 +326,7 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
{{attributes_name}}, {{attributes_length}},
{{accessors_name}}, {{accessors_length}},
{{methods_name}}, {{methods_length}});
- {% endfilter %}
+ {% endfilter %}{# runtime_enabled_indent #}
{% if constructors or has_custom_constructor or has_event_constructor %}
functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
@@ -344,7 +344,7 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCheck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
{% endif %}
{% if has_array_iterator %}
- {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnabled') %}
+ {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnabled()') %}
{% if is_global %}
instanceTemplate->SetIntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values, v8::DontEnum);
{% else %}
@@ -354,20 +354,21 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
{% endif %}
{% set runtime_enabled_features = dict() %}
{% for attribute in attributes
- if attribute.runtime_enabled_function and
+ if attribute.runtime_enabled_function_only and
not attribute.exposed_test %}
- {% if attribute.runtime_enabled_function not in runtime_enabled_features %}
- {% set unused = runtime_enabled_features.update({attribute.runtime_enabled_function: []}) %}
+ {% if attribute.runtime_enabled_function_only not in runtime_enabled_features %}
+ {% set unused = runtime_enabled_features.update({attribute.runtime_enabled_function_only: []}) %}
{% endif %}
- {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_function).append(attribute) %}
+ {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_function_only).append(attribute) %}
{% endfor %}
{% for runtime_enabled_feature in runtime_enabled_features | sort %}
- if ({{runtime_enabled_feature}}()) {
+ if ({{runtime_enabled_feature}}) {
{% set distinct_attributes = [] %}
{% for attribute in runtime_enabled_features.get(runtime_enabled_feature) | sort
if attribute.name not in distinct_attributes %}
{% set unused = distinct_attributes.append(attribute.name) %}
{% filter conditional(attribute.conditional_string) %}
+ {% filter experimental_framework_runtime_enabled(attribute.api_experiment_name) %}
{% if attribute.is_data_type_property %}
const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
@@ -378,9 +379,28 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessor{{attribute.name}}Configuration);
{% endif %}
{% endfilter %}
+ {% endfilter %}
{% endfor %}
}
{% endfor %}
+ {% for attribute in attributes
Daniel Nishi 2015/12/21 21:20:04 This catches the case of APIExperimentEnabled, but
+ if not attribute.runtime_enabled_function_only and
+ not attribute.exposed_test and
+ attribute.api_experiment_name %}
+ {% filter conditional(attribute.conditional_string) %}
+ {% filter experimental_framework_runtime_enabled(attribute.api_experiment_name) %}
+ {% if attribute.is_data_type_property %}
+ const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTemplate, attribute{{attribute.name}}Configuration);
+ {% else %}
+ const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessor{{attribute.name}}Configuration);
+ {% endif %}
+ {% endfilter %}
+ {% endfilter %}
+ {% endfor %}
{% if constants %}
{{install_constants() | indent}}
{% endif %}
@@ -413,9 +433,9 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
{% filter exposed(method.overloads.exposed_test_all
if method.overloads else
method.exposed_test) %}
- {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
- if method.overloads else
- method.runtime_enabled_function) %}
+ {% set runtime_enabled_function, api_experiment_name = (method.overloads.runtime_enabled_function_all, method.overloads.api_experiment_name_all) if method.overloads
+ else (method.runtime_enabled_function, method.api_experiment_name) %}
+ {% filter runtime_enabled(runtime_enabled_function) %}
{% if method.is_do_not_check_security %}
{{install_do_not_check_security_method(method, '', 'instanceTemplate', 'prototypeTemplate') | indent}}
{% else %}{# is_do_not_check_security #}

Powered by Google App Engine
This is Rietveld 408576698