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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
11 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %} 11 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %}
12 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 12 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
13 if has_visit_dom_wrapper else '0' %} 13 if has_visit_dom_wrapper else '0' %}
14 {% set has_prepare_prototype_and_interface_object =
15 unscopeables or has_conditional_attributes_on_prototype or
16 methods | conditionally_exposed(is_partial) %}
17 {% set prepare_prototype_and_interface_object_func =
18 '%s::preparePrototypeAndInterfaceObject' % v8_class
19 if has_prepare_prototype_and_interface_object
20 else 'nullptr' %}
14 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 21 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
15 if parent_interface else '0' %} 22 if parent_interface else '0' %}
16 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 23 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
17 'WrapperTypeObjectPrototype' %} 24 'WrapperTypeObjectPrototype' %}
18 {% set active_scriptwrappable_inheritance = 25 {% set active_scriptwrappable_inheritance =
19 'InheritFromActiveScriptWrappable' 26 'InheritFromActiveScriptWrappable'
20 if active_scriptwrappable else 27 if active_scriptwrappable else
21 'NotInheritFromActiveScriptWrappable' %} 28 'NotInheritFromActiveScriptWrappable' %}
22 29
23 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} 30 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %}
24 {% if not is_partial %} 31 {% if not is_partial %}
25 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 32 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
26 // and does not depend on another global objects. 33 // and does not depend on another global objects.
27 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 34 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
28 #pragma clang diagnostic push 35 #pragma clang diagnostic push
29 #pragma clang diagnostic ignored "-Wglobal-constructors" 36 #pragma clang diagnostic ignored "-Wglobal-constructors"
30 #endif 37 #endif
31 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrap pers, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeAndInterfaceObject,{% if has_conditional_attributes %} {{v8_class}}::installConditionallyEnabledPrope rties{% else %} nullptr{% endif %}, "{{interface_name}}", {{parent_wrapper_type_ info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_ class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperType Info::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; 38 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrap pers, {{visit_dom_wrapper}}, {{prepare_prototype_and_interface_object_func}}, "{ {interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_typ e_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_ scriptwrappable_inheritance}}, WrapperTypeInfo::{{event_target_inheritance}}, Wr apperTypeInfo::{{lifetime}} };
32 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 39 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
33 #pragma clang diagnostic pop 40 #pragma clang diagnostic pop
34 #endif 41 #endif
35 42
36 {% if not is_typed_array_type %} 43 {% if not is_typed_array_type %}
37 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 44 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
38 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 45 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
39 // bindings/core/v8/ScriptWrappable.h. 46 // bindings/core/v8/ScriptWrappable.h.
40 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; 47 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo;
41 {% endif %} 48 {% endif %}
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 441 }
435 {% endif %} 442 {% endif %}
436 {% endfor %} 443 {% endfor %}
437 {% endblock %} 444 {% endblock %}
438 {##############################################################################} 445 {##############################################################################}
439 {% block get_dom_template %}{% endblock %} 446 {% block get_dom_template %}{% endblock %}
440 {% block get_dom_template_for_named_properties_object %}{% endblock %} 447 {% block get_dom_template_for_named_properties_object %}{% endblock %}
441 {% block has_instance %}{% endblock %} 448 {% block has_instance %}{% endblock %}
442 {% block to_impl %}{% endblock %} 449 {% block to_impl %}{% endblock %}
443 {% block to_impl_with_type_check %}{% endblock %} 450 {% block to_impl_with_type_check %}{% endblock %}
444 {% block install_conditional_attributes %}{% endblock %}
445 {##############################################################################} 451 {##############################################################################}
446 {% block prepare_prototype_and_interface_object %}{% endblock %} 452 {% block prepare_prototype_and_interface_object %}{% endblock %}
447 {##############################################################################} 453 {##############################################################################}
448 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} 454 {% for method in methods if method.is_implemented_in_private_script and method.v isible %}
449 {{method_implemented_in_private_script(method)}} 455 {{method_implemented_in_private_script(method)}}
450 {% endfor %} 456 {% endfor %}
451 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 457 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
452 {{attribute_getter_implemented_in_private_script(attribute)}} 458 {{attribute_getter_implemented_in_private_script(attribute)}}
453 {% if attribute.has_setter %} 459 {% if attribute.has_setter %}
454 {{attribute_setter_implemented_in_private_script(attribute)}} 460 {{attribute_setter_implemented_in_private_script(attribute)}}
455 {% endif %} 461 {% endif %}
456 {% endfor %} 462 {% endfor %}
457 {% block partial_interface %}{% endblock %} 463 {% block partial_interface %}{% endblock %}
458 } // namespace blink 464 } // namespace blink
459 465
460 {% endfilter %}{# format_blink_cpp_source_code #} 466 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698