OLD | NEW |
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 to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class | 11 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie
w else '0' %} |
12 if active_scriptwrappable else '0' %} | |
13 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class | 12 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class |
14 if has_visit_dom_wrapper else '0' %} | 13 if has_visit_dom_wrapper else '0' %} |
15 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface | 14 {% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface |
16 if parent_interface else '0' %} | 15 if parent_interface else '0' %} |
17 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception
else | 16 {% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception
else |
18 'WrapperTypeObjectPrototype' %} | 17 'WrapperTypeObjectPrototype' %} |
19 {% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_vie
w else '0' %} | 18 {% set active_scriptwrappable_inheritance = |
| 19 'InheritFromActiveScriptWrappable' |
| 20 if active_scriptwrappable else |
| 21 'NotInheritFromActiveScriptWrappable' %} |
20 | 22 |
21 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} | 23 {% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} |
22 {% if not is_partial %} | 24 {% if not is_partial %} |
23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial | 25 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
24 // and does not depend on another global objects. | 26 // and does not depend on another global objects. |
25 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 27 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
26 #pragma clang diagnostic push | 28 #pragma clang diagnostic push |
27 #pragma clang diagnostic ignored "-Wglobal-constructors" | 29 #pragma clang diagnostic ignored "-Wglobal-constructors" |
28 #endif | 30 #endif |
29 {{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin
::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrap
pers, {{to_active_scriptwrappable}}, {{visit_dom_wrapper}}, {{v8_class}}::prepar
ePrototypeAndInterfaceObject,{% if has_conditional_attributes %} {{v8_class}}::i
nstallConditionallyEnabledProperties{% else %} nullptr{% endif %}, "{{interface_
name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype
}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inher
itance}}, WrapperTypeInfo::{{lifetime}} }; | 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}} }; |
30 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 32 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
31 #pragma clang diagnostic pop | 33 #pragma clang diagnostic pop |
32 #endif | 34 #endif |
| 35 |
33 {% if not is_typed_array_type %} | 36 {% if not is_typed_array_type %} |
34 | |
35 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}
}.h. | 37 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}
}.h. |
36 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | 38 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
37 // bindings/core/v8/ScriptWrappable.h. | 39 // bindings/core/v8/ScriptWrappable.h. |
38 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT
ypeInfo; | 40 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT
ypeInfo; |
39 {% endif %} | 41 {% endif %} |
40 {% if not active_scriptwrappable %} | |
41 | 42 |
| 43 {% if active_scriptwrappable %} |
| 44 // [ActiveScriptWrappable] |
| 45 static_assert( |
| 46 std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value, |
| 47 "{{cpp_class}} does not inherit from ActiveScriptWrappable, but specifying " |
| 48 "[ActiveScriptWrappable] extended attribute in the IDL file. " |
| 49 "Be consistent."); |
| 50 static_assert( |
| 51 !std::is_same<decltype(&{{cpp_class}}::hasPendingActivity), |
| 52 decltype(&ScriptWrappable::hasPendingActivity)>::value, |
| 53 "{{cpp_class}} is not overriding hasPendingActivity(), but is specifying " |
| 54 "[ActiveScriptWrappable] extended attribute in the IDL file. " |
| 55 "Be consistent."); |
| 56 {% else %} |
| 57 // not [ActiveScriptWrappable] |
42 static_assert( | 58 static_assert( |
43 !std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value, | 59 !std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value, |
44 "{{cpp_class}} inherits from ActiveScriptWrappable, but does not specify " | 60 "{{cpp_class}} inherits from ActiveScriptWrappable, but is not specifying " |
| 61 "[ActiveScriptWrappable] extended attribute in the IDL file. " |
| 62 "Be consistent."); |
| 63 static_assert( |
| 64 std::is_same<decltype(&{{cpp_class}}::hasPendingActivity), |
| 65 decltype(&ScriptWrappable::hasPendingActivity)>::value, |
| 66 "{{cpp_class}} is overriding hasPendingActivity(), but is not specifying " |
45 "[ActiveScriptWrappable] extended attribute in the IDL file. " | 67 "[ActiveScriptWrappable] extended attribute in the IDL file. " |
46 "Be consistent."); | 68 "Be consistent."); |
47 {% endif %} | 69 {% endif %} |
48 | 70 |
49 {% endif %}{# not is_partial #} | 71 {% endif %}{# not is_partial #} |
50 {% if not is_array_buffer_or_view %} | 72 {% if not is_array_buffer_or_view %} |
51 namespace {{cpp_class_or_partial}}V8Internal { | 73 namespace {{cpp_class_or_partial}}V8Internal { |
52 {% if has_partial_interface %} | 74 {% if has_partial_interface %} |
53 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 75 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
54 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba
ckInfo<v8::Value>&) = 0; | 76 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba
ckInfo<v8::Value>&) = 0; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 {##############################################################################} | 438 {##############################################################################} |
417 {% block get_dom_template %}{% endblock %} | 439 {% block get_dom_template %}{% endblock %} |
418 {% block get_dom_template_for_named_properties_object %}{% endblock %} | 440 {% block get_dom_template_for_named_properties_object %}{% endblock %} |
419 {% block has_instance %}{% endblock %} | 441 {% block has_instance %}{% endblock %} |
420 {% block to_impl %}{% endblock %} | 442 {% block to_impl %}{% endblock %} |
421 {% block to_impl_with_type_check %}{% endblock %} | 443 {% block to_impl_with_type_check %}{% endblock %} |
422 {% block install_conditional_attributes %}{% endblock %} | 444 {% block install_conditional_attributes %}{% endblock %} |
423 {##############################################################################} | 445 {##############################################################################} |
424 {% block prepare_prototype_and_interface_object %}{% endblock %} | 446 {% block prepare_prototype_and_interface_object %}{% endblock %} |
425 {##############################################################################} | 447 {##############################################################################} |
426 {% block to_active_scriptwrappable %}{% endblock %} | |
427 {% for method in methods if method.is_implemented_in_private_script and method.v
isible %} | 448 {% for method in methods if method.is_implemented_in_private_script and method.v
isible %} |
428 {{method_implemented_in_private_script(method)}} | 449 {{method_implemented_in_private_script(method)}} |
429 {% endfor %} | 450 {% endfor %} |
430 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 451 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
431 {{attribute_getter_implemented_in_private_script(attribute)}} | 452 {{attribute_getter_implemented_in_private_script(attribute)}} |
432 {% if attribute.has_setter %} | 453 {% if attribute.has_setter %} |
433 {{attribute_setter_implemented_in_private_script(attribute)}} | 454 {{attribute_setter_implemented_in_private_script(attribute)}} |
434 {% endif %} | 455 {% endif %} |
435 {% endfor %} | 456 {% endfor %} |
436 {% block partial_interface %}{% endblock %} | 457 {% block partial_interface %}{% endblock %} |
437 } // namespace blink | 458 } // namespace blink |
438 | 459 |
439 {% endfilter %}{# format_blink_cpp_source_code #} | 460 {% endfilter %}{# format_blink_cpp_source_code #} |
OLD | NEW |