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

Unified Diff: third_party/WebKit/Source/bindings/templates/callback_function.h

Issue 2312093003: Generated bindings for IDL callback functions (Closed)
Patch Set: Edited template 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/callback_function.h
diff --git a/third_party/WebKit/Source/bindings/templates/callback_function.h b/third_party/WebKit/Source/bindings/templates/callback_function.h
new file mode 100644
index 0000000000000000000000000000000000000000..d972f0e4b55f4c2835083b6298c244ed3d086e7b
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/templates/callback_function.h
@@ -0,0 +1,40 @@
+{% filter format_blink_cpp_source_code %}
+
+{% include 'copyright_block.txt' %}
+#ifndef {{v8_class}}_h
+#define {{v8_class}}_h
+
+{% for filename in header_includes %}
+#include "{{filename}}"
+{% endfor %}
+
+namespace blink {
+
+class {{exported}}{{v8_class}} final : public GarbageCollectedFinalized<{{v8_class}}>, public ActiveDOMCallback {
Yuki 2016/09/07 10:04:02 Let's start with a simplest version. We don't need
lkawai 2016/09/08 09:11:31 Done.
+ USING_GARBAGE_COLLECTED_MIXIN({{v8_class}});
Yuki 2016/09/07 10:04:02 Let's remove this line.
lkawai 2016/09/08 09:11:31 Done.
+
+public:
+ static {{v8_class}}* create(v8::Local<v8::Function> callback, v8::Local<v8::Object> owner, ScriptState* scriptState)
Yuki 2016/09/07 10:04:02 We don't need |owner|.
lkawai 2016/09/08 09:11:31 Done.
+ {
+ return new {{v8_class}}(callback, owner, scriptState);
+ }
+
+ {{v8_class}}(v8::Local<v8::Function>, v8::Local<v8::Object>, ScriptState*);
+ ~{{v8_class}}() override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+ bool call({{argument_declarations | join(', ')}});
+ ExecutionContext* getExecutionContext() const { return ContextLifecycleObserver::getExecutionContext(); }
Yuki 2016/09/07 10:04:02 Let's remove getExecutionContext(). If you need a
lkawai 2016/09/08 09:11:31 Done.
+ {{rvalue_cpp_type}} getValue();
+
+private:
+ ScopedPersistent<v8::Function> m_callback;
+ RefPtr<ScriptState> m_scriptState;
+ {{member_cpp_type}} returnValue;
+};
+
+} // namespace blink
+#endif // {{v8_class}}_h
+
+{% endfilter %}{# format_blink_cpp_source_code #}

Powered by Google App Engine
This is Rietveld 408576698