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 #ifndef {{v8_class}}_h | 4 #ifndef {{v8_class}}_h |
5 #define {{v8_class}}_h | 5 #define {{v8_class}}_h |
6 | 6 |
7 {% for filename in header_includes %} | 7 {% for filename in header_includes %} |
8 #include "{{filename}}" | 8 #include "{{filename}}" |
9 {% endfor %} | 9 {% endfor %} |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 {% if is_legacy %} | |
14 {# TODO(tkent): Merge two class declaration templates. | |
15 Even if this is a legacy callback interface, we should generate a class | |
16 to call a v8::Function or a method of a v8::Object. We don't do so now due | |
17 to crbug.com/630986. | |
18 #} | |
19 class {{v8_class}} { | |
Yuki
2017/04/27 12:18:29
nit: final?
tkent
2017/04/28 06:13:36
Done.
| |
20 STATIC_ONLY({{v8_class}}); | |
21 public: | |
22 static v8::Local<v8::FunctionTemplate> DomTemplate(v8::Isolate*, const DOMWrap perWorld&); | |
Yuki
2017/04/27 12:18:29
nit: {{exported}}
due to the snapshot project.
peria
2017/04/27 13:14:49
It is OK to keep callback interfaces' DomTemplate(
| |
23 static const WrapperTypeInfo wrapperTypeInfo; | |
Yuki
2017/04/27 12:18:29
nit: {{exported}}
due to the snapshot project.
peria
2017/04/27 13:14:49
Yes, please put it.
tkent
2017/04/28 06:13:37
Done.
| |
24 static const int internalFieldCount = kV8DefaultWrapperInternalFieldCount; | |
25 }; | |
26 | |
27 {% else %} {# is_legacy #} | |
28 | |
13 class {{v8_class}} final : public {{cpp_class}} { | 29 class {{v8_class}} final : public {{cpp_class}} { |
14 public: | 30 public: |
15 static {{v8_class}}* Create(v8::Local<v8::Function> callback, ScriptState* scr iptState) { | 31 static {{v8_class}}* Create(v8::Local<v8::Function> callback, ScriptState* scr iptState) { |
16 return new {{v8_class}}(callback, scriptState); | 32 return new {{v8_class}}(callback, scriptState); |
17 } | 33 } |
18 | 34 |
19 ~{{v8_class}}() override; | 35 ~{{v8_class}}() override; |
20 | 36 |
21 DECLARE_VIRTUAL_TRACE(); | 37 DECLARE_VIRTUAL_TRACE(); |
22 | 38 |
23 {% for method in methods %} | 39 {% for method in methods %} |
24 {{method.cpp_type}} {{method.name}}({{method.argument_declarations | join(', ' )}}) override; | 40 {{method.cpp_type}} {{method.name}}({{method.argument_declarations | join(', ' )}}) override; |
25 {% endfor %} | 41 {% endfor %} |
26 | 42 |
27 private: | 43 private: |
28 {{exported}}{{v8_class}}(v8::Local<v8::Function>, ScriptState*); | 44 {{exported}}{{v8_class}}(v8::Local<v8::Function>, ScriptState*); |
29 | 45 |
30 ScopedPersistent<v8::Function> m_callback; | 46 ScopedPersistent<v8::Function> m_callback; |
31 RefPtr<ScriptState> m_scriptState; | 47 RefPtr<ScriptState> m_scriptState; |
32 }; | 48 }; |
49 {% endif %} {# is_legacy #} | |
33 | 50 |
34 } | 51 } |
35 #endif // {{v8_class}}_h | 52 #endif // {{v8_class}}_h |
36 | 53 |
37 {% endfilter %}{# format_blink_cpp_source_code #} | 54 {% endfilter %}{# format_blink_cpp_source_code #} |
OLD | NEW |