Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp |
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
index fd310cf596267ea785219f70be9055c58592e6b4..6a1dff399597bd22069eab2057a29d8e1076a2a5 100644 |
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp |
@@ -8,15 +8,17 @@ |
{% endfor %} |
namespace blink { |
-{% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class |
- if active_scriptwrappable else '0' %} |
+{% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_view else '0' %} |
{% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class |
if has_visit_dom_wrapper else '0' %} |
{% set parent_wrapper_type_info = '&V8%s::wrapperTypeInfo' % parent_interface |
if parent_interface else '0' %} |
{% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else |
'WrapperTypeObjectPrototype' %} |
-{% set dom_template = '%s::domTemplate' % v8_class if not is_array_buffer_or_view else '0' %} |
+{% set active_scriptwrappable_inheritance = |
+ 'InheritFromActiveScriptWrappable' |
+ if active_scriptwrappable else |
+ 'NotInheritFromActiveScriptWrappable' %} |
{% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} |
{% if not is_partial %} |
@@ -26,22 +28,42 @@ namespace blink { |
#pragma clang diagnostic push |
#pragma clang diagnostic ignored "-Wglobal-constructors" |
#endif |
-{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrappers, {{to_active_scriptwrappable}}, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeAndInterfaceObject,{% if has_conditional_attributes %} {{v8_class}}::installConditionallyEnabledProperties{% else %} nullptr{% endif %}, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; |
+{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::trace, {{v8_class}}::traceWrappers, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeAndInterfaceObject,{% if has_conditional_attributes %} {{v8_class}}::installConditionallyEnabledProperties{% else %} nullptr{% endif %}, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; |
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
#pragma clang diagnostic pop |
#endif |
-{% if not is_typed_array_type %} |
+{% if not is_typed_array_type %} |
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}}.h. |
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
// bindings/core/v8/ScriptWrappable.h. |
const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperTypeInfo; |
{% endif %} |
-{% if not active_scriptwrappable %} |
+{% if active_scriptwrappable %} |
+// [ActiveScriptWrappable] |
+static_assert( |
+ std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value, |
+ "{{cpp_class}} does not inherit from ActiveScriptWrappable, but specifying " |
+ "[ActiveScriptWrappable] extended attribute in the IDL file. " |
+ "Be consistent."); |
+static_assert( |
+ !std::is_same<decltype(&{{cpp_class}}::hasPendingActivity), |
+ decltype(&ScriptWrappable::hasPendingActivity)>::value, |
+ "{{cpp_class}} is not overriding hasPendingActivity(), but is specifying " |
+ "[ActiveScriptWrappable] extended attribute in the IDL file. " |
+ "Be consistent."); |
+{% else %} |
+// not [ActiveScriptWrappable] |
static_assert( |
!std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value, |
- "{{cpp_class}} inherits from ActiveScriptWrappable, but does not specify " |
+ "{{cpp_class}} inherits from ActiveScriptWrappable, but is not specifying " |
+ "[ActiveScriptWrappable] extended attribute in the IDL file. " |
+ "Be consistent."); |
+static_assert( |
+ std::is_same<decltype(&{{cpp_class}}::hasPendingActivity), |
+ decltype(&ScriptWrappable::hasPendingActivity)>::value, |
+ "{{cpp_class}} is overriding hasPendingActivity(), but is not specifying " |
"[ActiveScriptWrappable] extended attribute in the IDL file. " |
"Be consistent."); |
{% endif %} |
@@ -423,7 +445,6 @@ void {{v8_class_or_partial}}::install{{origin_trial_feature.name}}(ScriptState* |
{##############################################################################} |
{% block prepare_prototype_and_interface_object %}{% endblock %} |
{##############################################################################} |
-{% block to_active_scriptwrappable %}{% endblock %} |
{% for method in methods if method.is_implemented_in_private_script and method.visible %} |
{{method_implemented_in_private_script(method)}} |
{% endfor %} |