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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp

Issue 1372373002: bindings: Reduces the custom registration of methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "config.h" 2 #include "config.h"
3 {% filter conditional(conditional_string) %} 3 {% filter conditional(conditional_string) %}
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 to_active_dom_object = '%s::toActiveDOMObject' % v8_class 11 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
12 if is_active_dom_object else '0' %} 12 if is_active_dom_object else '0' %}
13 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 13 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
14 if has_visit_dom_wrapper else '0' %} 14 if has_visit_dom_wrapper else '0' %}
15 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface 15 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface
16 if parent_interface else '0' %} 16 if parent_interface else '0' %}
17 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else 17 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
18 'WrapperTypeObjectPrototype' %} 18 'WrapperTypeObjectPrototype' %}
19 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %} 19 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie w else '0' %}
20 20
21 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} 21 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %}
22 {% if not is_partial %} 22 {% if not is_partial %}
23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
24 // and does not depend on another global objects. 24 // and does not depend on another global objects.
25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
26 #pragma clang diagnostic push 26 #pragma clang diagnostic push
27 #pragma clang diagnostic ignored "-Wglobal-constructors" 27 #pragma clang diagnostic ignored "-Wglobal-constructors"
28 #endif 28 #endif
29 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::deref Object, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{ v8_class}}::preparePrototypeObject, {{v8_class}}::installConditionallyEnabledPro perties, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{ wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo ::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo:: {{gc_type}} }; 29 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin ::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::deref Object, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{ v8_class}}::preparePrototypeAndInterfaceObject, {{v8_class}}::installConditional lyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, Wrapper TypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, Wra pperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, Wrapp erTypeInfo::{{gc_type}} };
30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
31 #pragma clang diagnostic pop 31 #pragma clang diagnostic pop
32 #endif 32 #endif
33 33
34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 34 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 35 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
36 // bindings/core/v8/ScriptWrappable.h. 36 // bindings/core/v8/ScriptWrappable.h.
37 {% if not is_typed_array_type %} 37 {% if not is_typed_array_type %}
38 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; 38 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo;
39 {% endif %} 39 {% endif %}
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 {% if not is_override_builtins %} 420 {% if not is_override_builtins %}
421 flags |= static_cast<int>(v8::PropertyHandlerFlags::kNonMasking); 421 flags |= static_cast<int>(v8::PropertyHandlerFlags::kNonMasking);
422 {% endif %} 422 {% endif %}
423 v8::NamedPropertyHandlerConfiguration config({{named_property_getter_cal lback}}, {{named_property_setter_callback}}, {{named_property_query_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_callback}}, v8: :Handle<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(flags)); 423 v8::NamedPropertyHandlerConfiguration config({{named_property_getter_cal lback}}, {{named_property_setter_callback}}, {{named_property_query_callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_callback}}, v8: :Handle<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(flags));
424 functionTemplate->{{set_on_template}}()->SetHandler(config); 424 functionTemplate->{{set_on_template}}()->SetHandler(config);
425 } 425 }
426 {% endif %} 426 {% endif %}
427 {% if iterator_method %} 427 {% if iterator_method %}
428 {% filter exposed(iterator_method.exposed_test) %} 428 {% filter exposed(iterator_method.exposed_test) %}
429 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %} 429 {% filter runtime_enabled(iterator_method.runtime_enabled_function) %}
430 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i teratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfigur ation::OnPrototype }; 430 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator Configuration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::i teratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScript s, V8DOMConfiguration::OnPrototype };
431 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, v8::DontDelete, symbolKeyedIteratorConfiguration); 431 V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignatu re, symbolKeyedIteratorConfiguration);
432 {% endfilter %}{# runtime_enabled() #} 432 {% endfilter %}{# runtime_enabled() #}
433 {% endfilter %}{# exposed() #} 433 {% endfilter %}{# exposed() #}
434 {% endif %} 434 {% endif %}
435 {# End special operations #} 435 {# End special operations #}
436 {% if has_custom_legacy_call_as_function %} 436 {% if has_custom_legacy_call_as_function %}
437 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); 437 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom);
438 {% endif %} 438 {% endif %}
439 {% if interface_name == 'HTMLAllCollection' %} 439 {% if interface_name == 'HTMLAllCollection' %}
440 {# Needed for legacy support of document.all #} 440 {# Needed for legacy support of document.all #}
441 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); 441 functionTemplate->InstanceTemplate()->MarkAsUndetectable();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 {% endif %}{# not is_array_buffer_or_view #} 480 {% endif %}{# not is_array_buffer_or_view #}
481 {% endblock %} 481 {% endblock %}
482 {##############################################################################} 482 {##############################################################################}
483 {% block get_dom_template %}{% endblock %} 483 {% block get_dom_template %}{% endblock %}
484 {% block has_instance %}{% endblock %} 484 {% block has_instance %}{% endblock %}
485 {% block to_impl %}{% endblock %} 485 {% block to_impl %}{% endblock %}
486 {% block to_impl_with_type_check %}{% endblock %} 486 {% block to_impl_with_type_check %}{% endblock %}
487 {% block install_conditional_attributes %}{% endblock %} 487 {% block install_conditional_attributes %}{% endblock %}
488 {##############################################################################} 488 {##############################################################################}
489 {% block prepare_prototype_object %}{% endblock %} 489 {% block prepare_prototype_and_interface_object %}{% endblock %}
490 {##############################################################################} 490 {##############################################################################}
491 {% block to_active_dom_object %}{% endblock %} 491 {% block to_active_dom_object %}{% endblock %}
492 {% block ref_object_and_deref_object %}{% endblock %} 492 {% block ref_object_and_deref_object %}{% endblock %}
493 {% for method in methods if method.is_implemented_in_private_script and method.v isible %} 493 {% for method in methods if method.is_implemented_in_private_script and method.v isible %}
494 {{method_implemented_in_private_script(method)}} 494 {{method_implemented_in_private_script(method)}}
495 {% endfor %} 495 {% endfor %}
496 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 496 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
497 {{attribute_getter_implemented_in_private_script(attribute)}} 497 {{attribute_getter_implemented_in_private_script(attribute)}}
498 {% if attribute.has_setter %} 498 {% if attribute.has_setter %}
499 {{attribute_setter_implemented_in_private_script(attribute)}} 499 {{attribute_setter_implemented_in_private_script(attribute)}}
500 {% endif %} 500 {% endif %}
501 {% endfor %} 501 {% endfor %}
502 {% block partial_interface %}{% endblock %} 502 {% block partial_interface %}{% endblock %}
503 } // namespace blink 503 } // namespace blink
504 {% endfilter %} 504 {% endfilter %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698