| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 {% for attribute in attributes if attribute.is_implemented_in_private_script %} | 452 {% for attribute in attributes if attribute.is_implemented_in_private_script %} |
| 431 {{attribute_getter_implemented_in_private_script(attribute)}} | 453 {{attribute_getter_implemented_in_private_script(attribute)}} |
| 432 {% if attribute.has_setter %} | 454 {% if attribute.has_setter %} |
| 433 {{attribute_setter_implemented_in_private_script(attribute)}} | 455 {{attribute_setter_implemented_in_private_script(attribute)}} |
| 434 {% endif %} | 456 {% endif %} |
| 435 {% endfor %} | 457 {% endfor %} |
| 436 {% block partial_interface %}{% endblock %} | 458 {% block partial_interface %}{% endblock %} |
| 437 } // namespace blink | 459 } // namespace blink |
| 438 | 460 |
| 439 {% endfilter %}{# format_blink_cpp_source_code #} | 461 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |