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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/callback_function.h

Issue 2312093003: Generated bindings for IDL callback functions (Closed)
Patch Set: Did rebase-update Created 4 years, 3 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 {% 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 class {{v8_class}} final : public {{cpp_class}}, public ActiveDOMCallback { 13 class ScriptState;
14 USING_GARBAGE_COLLECTED_MIXIN({{v8_class}}); 14
15 class {{exported}}{{v8_class}} final : public GarbageCollectedFinalized<{{v8_cla ss}}>{
16
15 public: 17 public:
16 static {{v8_class}}* create(v8::Local<v8::Function> callback, ScriptState* s criptState) 18 static {{v8_class}}* create(v8::Local<v8::Function> callback, ScriptState* s criptState)
17 { 19 {
18 return new {{v8_class}}(callback, scriptState); 20 return new {{v8_class}}(callback, scriptState);
19 } 21 }
20 22
21 ~{{v8_class}}() override; 23 {{v8_class}}(v8::Local<v8::Function>, ScriptState*);
24 ~{{v8_class}}() = default;
22 25
23 DECLARE_VIRTUAL_TRACE(); 26 DECLARE_VIRTUAL_TRACE();
24 27
25 {% for method in methods %} 28 bool call({{argument_declarations | join(', ')}});
26 {{method.cpp_type}} {{method.name}}({{method.argument_declarations | join(', ')}}) override; 29 {% if rvalue_cpp_type != 'void' %}
27 {% endfor %} 30 {{rvalue_cpp_type}} getValue();
31 {% endif %}
32
28 private: 33 private:
29 {{exported}}{{v8_class}}(v8::Local<v8::Function>, ScriptState*);
30
31 ScopedPersistent<v8::Function> m_callback; 34 ScopedPersistent<v8::Function> m_callback;
32 RefPtr<ScriptState> m_scriptState; 35 RefPtr<ScriptState> m_scriptState;
36 {% if rvalue_cpp_type != 'void' %}
37 {{member_cpp_type}} returnValue;
38 {% endif %}
33 }; 39 };
34 40
35 } 41 } // namespace blink
36 #endif // {{v8_class}}_h 42 #endif // {{v8_class}}_h
37 43
38 {% endfilter %}{# format_blink_cpp_source_code #} 44 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698