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

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

Issue 2622153002: [Bindings] Implement installRuntimeEnabledFeatures method on some classes (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
« no previous file with comments | « third_party/WebKit/Source/bindings/templates/interface.h.tmpl ('k') | no next file » | 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.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 9c1cabcdbbbad4a3ead0c527c9ad38837484ca00..18eb61d27fc6160787ab161787a0c93e090426d8 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -527,6 +527,62 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% endif %}{# not is_array_buffer_or_view #}
{% endblock %}
{##############################################################################}
+{% block install_runtime_enabled %}
+{% if v8_class_or_partial in ['V8Window', 'V8HTMLDocument', 'V8Document', 'V8Node', 'V8EventTarget'] %}
Yuki 2017/01/11 07:06:52 v8_class_or_partial can be V8WindowPartial, right?
peria 2017/01/11 10:20:53 Done. Moved the logic into v8_interface.py.
+{% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
+{% from 'methods.cpp.tmpl' import install_custom_signature with context %}
+void {{v8_class_or_partial}}::installRuntimeEnabledFeatures(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface) {
+ v8::Local<v8::FunctionTemplate> interfaceTemplate = {{v8_class}}::wrapperTypeInfo.domTemplate(isolate, world);
Yuki 2017/01/11 07:06:52 You may want to take interfaceTemplate as an argum
peria 2017/01/11 10:20:52 Done.
+ v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
+ ALLOW_UNUSED_LOCAL(signature);
+
Yuki 2017/01/11 07:06:52 Why don't you care about constants?
peria 2017/01/11 10:20:53 It needs updates in V8DOMConfigurations, while we
+ {% for feature_name, attrs in runtime_enabled_attributes | groupby('runtime_enabled_feature_name') %}
+ {% filter runtime_enabled(feature_name) %}
+ {% for attribute in attrs | unique_by('name') | sort %}
+ {% if attribute.is_data_type_property %}
+ const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attribute{{attribute.name}}Configuration);
+ {% else %}
+ const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
+ {% endif %}
+ {% endfor %}
+ {% endfilter %}
+ {% endfor %}
+
+ {% if iterator_method and iterator_method.runtime_enabled_feature_name %}
+ {% filter exposed(iterator_method.exposed_test) %}
+ {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
+ // Runtime enabled iterator (@@iterator)
+ NOTREACHED();
+ {% endfilter %}
+ {% endfilter %}
+ {% endif %}
+
+ {% if methods | custom_registration(is_partial) %}
+ {% for method in methods | custom_registration(is_partial) %}
+ {% filter exposed(method.overloads.exposed_test_all
+ if method.overloads else method.exposed_test) %}
+ {% set feature_name = (method.overloads.runtime_enabled_all
+ if method.overloads else method.runtime_enabled_feature_name) %}
+ {% if feature_name %}
+ {% filter runtime_enabled(feature_name) %}
+ {% if method.is_cross_origin %}
+ // Runtime enabled cross origin methods
+ NOTREACHED();
+ {% else %}
+ {{install_custom_signature(method, 'instance', 'prototype', 'interface', 'signature') | indent(2)}}
+ {% endif %}
+ {% endfilter %}
+ {% endif %}
+ {% endfilter %}
+ {% endfor %}
+ {% endif %}
+}
+
+{% endif %}{# v8_class_or_partial #}
+{% endblock %}
+{##############################################################################}
{% block origin_trials %}
{% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
{% from 'constants.cpp.tmpl' import constant_configuration with context %}
« no previous file with comments | « third_party/WebKit/Source/bindings/templates/interface.h.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698