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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 {% set has_prepare_prototype_and_interface_object =
4 unscopeables or has_conditional_attributes_on_prototype or
5 methods | conditionally_exposed(is_partial) %}
6 {% set prepare_prototype_and_interface_object_func =
7 '%s::preparePrototypeAndInterfaceObject' % v8_class_or_partial
8 if has_prepare_prototype_and_interface_object
9 else 'nullptr' %}
10
3 11
4 {##############################################################################} 12 {##############################################################################}
5 {% block prepare_prototype_and_interface_object %} 13 {% block prepare_prototype_and_interface_object %}
6 {% from 'interface.cpp' import install_unscopeables with context %} 14 {% from 'interface.cpp' import install_unscopeables with context %}
7 {% from 'interface.cpp' import install_conditionally_enabled_attributes_on_proto type with context %} 15 {% from 'interface.cpp' import install_conditionally_enabled_attributes_on_proto type with context %}
8 {% from 'methods.cpp' import install_conditionally_enabled_methods 16 {% from 'methods.cpp' import install_conditionally_enabled_methods
9 with context %} 17 with context %}
18 {% if has_prepare_prototype_and_interface_object %}
10 void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::C ontext> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeOb ject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> i nterfaceTemplate) 19 void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Local<v8::C ontext> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeOb ject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> i nterfaceTemplate)
11 { 20 {
21 #error No one is currently using a partial interface with context-dependent prop erties. If you\'re planning to use it, please consult with the binding team: <b link-reviews-bindings@chromium.org>
12 {{v8_class}}::preparePrototypeAndInterfaceObject(context, world, prototypeOb ject, interfaceObject, interfaceTemplate); 22 {{v8_class}}::preparePrototypeAndInterfaceObject(context, world, prototypeOb ject, interfaceObject, interfaceTemplate);
13 {% if unscopeables or
14 has_conditional_attributes_on_prototype or
15 methods | conditionally_exposed(is_partial) %}
16 v8::Isolate* isolate = context->GetIsolate(); 23 v8::Isolate* isolate = context->GetIsolate();
17 {% endif %}
18 {% if unscopeables %} 24 {% if unscopeables %}
19 {{install_unscopeables() | indent}} 25 {{install_unscopeables() | indent}}
20 {% endif %} 26 {% endif %}
21 {% if has_conditional_attributes_on_prototype %} 27 {% if has_conditional_attributes_on_prototype %}
22 {{install_conditionally_enabled_attributes_on_prototype() | indent}} 28 {{install_conditionally_enabled_attributes_on_prototype() | indent}}
23 {% endif %} 29 {% endif %}
24 {% if methods | conditionally_exposed(is_partial) %} 30 {% if methods | conditionally_exposed(is_partial) %}
25 {{install_conditionally_enabled_methods() | indent}} 31 {{install_conditionally_enabled_methods() | indent}}
26 {% endif %} 32 {% endif %}
27 } 33 }
34 {% endif %}
28 35
29 {% endblock %} 36 {% endblock %}
30 37
31 38
32 {##############################################################################} 39 {##############################################################################}
33 {% block partial_interface %} 40 {% block partial_interface %}
34 void {{v8_class_or_partial}}::initialize() 41 void {{v8_class_or_partial}}::initialize()
35 { 42 {
36 // Should be invoked from ModulesInitializer. 43 // Should be invoked from ModulesInitializer.
37 {{v8_class}}::updateWrapperTypeInfo( 44 {{v8_class}}::updateWrapperTypeInfo(
38 &{{v8_class_or_partial}}::install{{v8_class}}Template, 45 &{{v8_class_or_partial}}::install{{v8_class}}Template,
39 &{{v8_class_or_partial}}::preparePrototypeAndInterfaceObject); 46 {{prepare_prototype_and_interface_object_func}});
40 {% for method in methods %} 47 {% for method in methods %}
41 {% if method.overloads and method.overloads.has_partial_overloads %} 48 {% if method.overloads and method.overloads.has_partial_overloads %}
42 {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInte rface(&{{cpp_class_or_partial}}V8Internal::{{method.name}}Method); 49 {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInte rface(&{{cpp_class_or_partial}}V8Internal::{{method.name}}Method);
43 {% endif %} 50 {% endif %}
44 {% endfor %} 51 {% endfor %}
45 } 52 }
46 53
47 {% endblock %} 54 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698