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

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

Issue 2620153004: [Bindings] Code cleanup: Early return if funtime enabled interface is false (Closed)
Patch Set: . Created 3 years, 11 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: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
index 4f5907cb56c3deb03322d19f113e300e502cb469..bbea073618ebe5992dc19695ea8723754ac795bd 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -405,6 +405,13 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
interfaceTemplate->SetLength({{interface_length}});
{% endif %}
{% endif %}{# is_partial #}
+
+ {% if runtime_enabled_feature_name %}
+ if (!{{runtime_enabled_feature_name | runtime_enabled_function}}) {
Yuki 2017/01/13 02:38:37 This is okay, but I guess you should be able to wr
Yuki 2017/01/13 02:38:37 If the feature is disabled, we shouldn't hit this
peria 2017/01/13 05:54:26 V8Type::domTemplate() calls it through V8DOMConfig
peria 2017/01/13 05:54:26 As a context of Jinja, I think it better to make t
+ return;
+ }
+ {% endif %}
+
v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
ALLOW_UNUSED_LOCAL(signature);
v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate();
@@ -427,7 +434,6 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% endif %}
// Register DOM constants, attributes and operations.
- {% filter runtime_enabled(runtime_enabled_feature_name) %}
{% if constants %}
{{install_constants() | indent(2)}}
{% endif %}
@@ -443,7 +449,6 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% if methods | has_method_configuration(is_partial) %}
V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY_LENGTH(%sMethods)' % v8_class}});
{% endif %}
- {% endfilter %}
{% if has_access_check_callbacks and not is_partial %}
// Cross-origin access check
@@ -454,9 +459,9 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
instanceTemplate->SetAccessCheckCallbackAndHandler({{cpp_class}}V8Internal::securityCheck, v8::NamedPropertyHandlerConfiguration({{cross_origin_named_getter}}, {{cross_origin_named_setter}}, nullptr, nullptr, {{cross_origin_named_enumerator}}), v8::IndexedPropertyHandlerConfiguration({{cross_origin_indexed_getter}}), v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
{% endif %}
- {% for group in runtime_enabled_attributes | groupby('runtime_enabled_feature_name') %}
- {% filter runtime_enabled(group.list[0].runtime_enabled_feature_name) %}
- {% for attribute in group.list | unique_by('name') | sort %}
+ {% for feature_name, attribute_list in runtime_enabled_attributes | groupby('runtime_enabled_feature_name') %}
+ {% filter runtime_enabled(feature_name) %}
+ {% for attribute in attribute_list | unique_by('name') | sort %}
{% if attribute.is_data_type_property %}
const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, prototypeTemplate, attribute{{attribute.name}}Configuration);

Powered by Google App Engine
This is Rietveld 408576698