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/interface_base.cpp.tmpl

Issue 2692343005: [Bindings] Unify a template block 'prepare_prototype_and_interface_object' (Closed)
Patch Set: Created 3 years, 10 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 2c4019d63e1ab2a01d0bfd7417e361bf34e4600f..57ab4ac3dc3096a1afac1f3e30ef961dda890305 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -706,7 +706,40 @@ void {{v8_class_or_partial}}::install{{feature.name}}(ScriptState* scriptState)
{% block to_impl %}{% endblock %}
{% block to_impl_with_type_check %}{% endblock %}
{##############################################################################}
-{% block prepare_prototype_and_interface_object %}{% endblock %}
+{% block prepare_prototype_and_interface_object %}
Yuki 2017/02/16 08:38:07 nit: This is just fine as is, but technically you
peria 2017/02/16 08:41:58 Acknowledged.
+{% from 'attributes.cpp.tmpl' import install_conditionally_enabled_attributes_on_prototype with context %}
+{% from 'methods.cpp.tmpl' import install_conditionally_enabled_methods with context %}
+{% if has_prepare_prototype_and_interface_object %}
+void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
+ {% if is_partial %}
+ {{v8_class}}::preparePrototypeAndInterfaceObject(context, world, prototypeObject, interfaceObject, interfaceTemplate);
+ {% endif %}
+ v8::Isolate* isolate = context->GetIsolate();
+
+{% if unscopables %}
+ v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
+ v8::Local<v8::Object> unscopables;
+ if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol)))
+ unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
+ else
+ unscopables = v8::Object::New(isolate);
+ {% for name, runtime_enabled_feature_name in unscopables %}
+ {% filter runtime_enabled(runtime_enabled_feature_name) %}
+ unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8::True(isolate)).FromJust();
+ {% endfilter %}
+ {% endfor %}
+ prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).FromJust();
+{% endif %}{# unscopables #}
+{% if has_conditional_attributes_on_prototype %}
+ {{install_conditionally_enabled_attributes_on_prototype() | indent(2)}}
+{% endif %}
+{% if methods | conditionally_exposed(is_partial) %}
+ {{install_conditionally_enabled_methods() | indent(2)}}
+{% endif %}
+}
+{% endif %}
+
+{% endblock %}
{##############################################################################}
{% block partial_interface %}{% endblock %}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698