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

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

Issue 2296573003: binding: Reduces the binary size of binding's generated code. (Closed)
Patch Set: Created 4 years, 4 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/partial_interface.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/partial_interface.cpp b/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
index 37b4741ca976103832716b5d1b6813fce2324f89..6fcfcec14d98c539359df7d2cfb12634ea3442b2 100644
--- a/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
+++ b/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
@@ -1,5 +1,13 @@
{% extends 'interface_base.cpp' %}
+{% set has_prepare_prototype_and_interface_object =
+ unscopeables or has_conditional_attributes_on_prototype or
+ methods | conditionally_exposed(is_partial) %}
+{% set prepare_prototype_and_interface_object_func =
+ '%s::preparePrototypeAndInterfaceObject' % v8_class_or_partial
+ if has_prepare_prototype_and_interface_object
+ else 'nullptr' %}
+
{##############################################################################}
{% block prepare_prototype_and_interface_object %}
@@ -7,14 +15,12 @@
{% from 'interface.cpp' import install_conditionally_enabled_attributes_on_prototype with context %}
{% from 'methods.cpp' 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)
{
+#error No one is currently using a partial interface with context-dependent properties. If you\'re planning to use it, please consult with the binding team: <blink-reviews-bindings@chromium.org>
{{v8_class}}::preparePrototypeAndInterfaceObject(context, world, prototypeObject, interfaceObject, interfaceTemplate);
-{% if unscopeables or
- has_conditional_attributes_on_prototype or
- methods | conditionally_exposed(is_partial) %}
v8::Isolate* isolate = context->GetIsolate();
-{% endif %}
{% if unscopeables %}
{{install_unscopeables() | indent}}
{% endif %}
@@ -25,6 +31,7 @@ void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::C
{{install_conditionally_enabled_methods() | indent}}
{% endif %}
}
+{% endif %}
{% endblock %}
@@ -36,7 +43,7 @@ void {{v8_class_or_partial}}::initialize()
// Should be invoked from ModulesInitializer.
{{v8_class}}::updateWrapperTypeInfo(
&{{v8_class_or_partial}}::install{{v8_class}}Template,
- &{{v8_class_or_partial}}::preparePrototypeAndInterfaceObject);
+ {{prepare_prototype_and_interface_object_func}});
{% for method in methods %}
{% if method.overloads and method.overloads.has_partial_overloads %}
{{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(&{{cpp_class_or_partial}}V8Internal::{{method.name}}Method);

Powered by Google App Engine
This is Rietveld 408576698