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

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

Issue 1453073002: [bindings] Club attribute & accessor config for a runtime enabled feature in single |if| block (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c8a993adf597410c03a5a95af5c2632724305266..0e365a690c19ae3d3641b66f37cb178d53af0f04 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -352,22 +352,34 @@ static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate> function
{% endif %}
{% endfilter %}{# runtime_enabled() #}
{% endif %}
+ {% set runtime_enabled_features = dict() %}
{% for attribute in attributes
if attribute.runtime_enabled_function and
not attribute.exposed_test %}
- {% filter conditional(attribute.conditional_string) %}
- if ({{attribute.runtime_enabled_function}}()) {
+ {% if attribute.runtime_enabled_function not in runtime_enabled_features %}
+ {% set unused = runtime_enabled_features.update({attribute.runtime_enabled_function: []}) %}
+ {% endif %}
+ {% set unused = runtime_enabled_features.get(attribute.runtime_enabled_function).append(attribute) %}
+ {% endfor %}
+ {% for runtime_enabled_feature in runtime_enabled_features | sort %}
+ 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) %}
{% if attribute.is_data_type_property %}
- const V8DOMConfiguration::AttributeConfiguration attributeConfiguration = \
+ const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTemplate, attributeConfiguration);
+ V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTemplate, attribute{{attribute.name}}Configuration);
{% else %}
- const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = \
+ const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = \
{{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessorConfiguration);
+ V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessor{{attribute.name}}Configuration);
{% endif %}
+ {% endfilter %}
+ {% endfor %}
}
- {% endfilter %}
{% endfor %}
{% if constants %}
{{install_constants() | indent}}
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698