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

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

Issue 2250063002: binding: Adds a check that ActiveScriptWrappable specifies [ActiveScriptWrappable]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 "{{v8_class_or_partial}}.h" 2 #include "{{v8_class_or_partial}}.h"
3 3
4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
5 #include "{{filename}}" 5 #include "{{filename}}"
6 {% endfor %} 6 {% endfor %}
7 7
8 namespace blink { 8 namespace blink {
9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class 9 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class
10 if active_scriptwrappable else '0' %} 10 if active_scriptwrappable else '0' %}
(...skipping 10 matching lines...) Expand all
21 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 21 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
22 // and does not depend on another global objects. 22 // and does not depend on another global objects.
23 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 23 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
24 #pragma clang diagnostic push 24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wglobal-constructors" 25 #pragma clang diagnostic ignored "-Wglobal-constructors"
26 #endif 26 #endif
27 {{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}} }; 27 {{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}} };
28 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 28 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
29 #pragma clang diagnostic pop 29 #pragma clang diagnostic pop
30 #endif 30 #endif
31 {% if not is_typed_array_type %}
31 32
32 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h. 33 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class} }.h.
33 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 34 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
34 // bindings/core/v8/ScriptWrappable.h. 35 // bindings/core/v8/ScriptWrappable.h.
35 {% if not is_typed_array_type %}
36 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo; 36 const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperT ypeInfo;
37 {% endif %} 37 {% endif %}
38 {% if not active_scriptwrappable %}
38 39
40 static_assert(
41 !std::is_base_of<ActiveScriptWrappable, {{cpp_class}}>::value,
42 "{{cpp_class}} inherits from ActiveScriptWrappable, but does not specify "
43 "[ActiveScriptWrappable] extended attribute in the IDL file. "
44 "Be consistent.");
peria 2016/08/16 07:24:43 Don't we need to care the inverted situation? I me
Yuki 2016/08/16 08:43:27 In that case, a compile error is already happening
Yuki 2016/08/16 08:44:36 Just FYI, it's the same that T* does not inherit f
39 {% endif %} 45 {% endif %}
46
47 {% endif %}{# not is_partial #}
40 {% if not is_array_buffer_or_view %} 48 {% if not is_array_buffer_or_view %}
41 namespace {{cpp_class_or_partial}}V8Internal { 49 namespace {{cpp_class_or_partial}}V8Internal {
42 {% if has_partial_interface %} 50 {% if has_partial_interface %}
43 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 51 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
44 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba ckInfo<v8::Value>&) = 0; 52 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba ckInfo<v8::Value>&) = 0;
45 {% endfor %} 53 {% endfor %}
46 {% endif %} 54 {% endif %}
47 55
48 {# Constants #} 56 {# Constants #}
49 {% from 'constants.cpp' import constant_getter_callback 57 {% from 'constants.cpp' import constant_getter_callback
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 {{method_implemented_in_private_script(method)}} 438 {{method_implemented_in_private_script(method)}}
431 {% endfor %} 439 {% endfor %}
432 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 440 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
433 {{attribute_getter_implemented_in_private_script(attribute)}} 441 {{attribute_getter_implemented_in_private_script(attribute)}}
434 {% if attribute.has_setter %} 442 {% if attribute.has_setter %}
435 {{attribute_setter_implemented_in_private_script(attribute)}} 443 {{attribute_setter_implemented_in_private_script(attribute)}}
436 {% endif %} 444 {% endif %}
437 {% endfor %} 445 {% endfor %}
438 {% block partial_interface %}{% endblock %} 446 {% block partial_interface %}{% endblock %}
439 } // namespace blink 447 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698