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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl

Issue 1003773002: CPP bindings: DCHECK when a Callback is destructed without being invoked (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixed BUILD.gn file. Created 5 years, 9 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: mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
index afc6504dc81f33bf535546964eafcd06a29d266b..76b6bd78a88621a4b34497060bcd523ce32a1103 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl
@@ -1,6 +1,7 @@
class {{interface.name}}Stub : public mojo::MessageReceiverWithResponder {
public:
{{interface.name}}Stub();
+ virtual ~{{interface.name}}Stub() override;
jamesr 2015/03/16 21:05:57 "virtual" and "override" are redundant, you only w
rudominer 2015/03/16 22:57:20 Done.
void set_sink({{interface.name}}* sink) { sink_ = sink; }
{{interface.name}}* sink() { return sink_; }
@@ -8,6 +9,26 @@ class {{interface.name}}Stub : public mojo::MessageReceiverWithResponder {
virtual bool AcceptWithResponder(mojo::Message* message,
mojo::MessageReceiver* responder) override;
+ void OnConnectionError() {
+ connection_error_occurred_ = true;
+ }
+
+ bool connection_error_occurred() const {
+ return connection_error_occurred_;
+ }
+
+ void Close() {
+ closed_ = true;
+ }
+
+ bool closed() {
+ return closed_;
+ }
+
+
private:
{{interface.name}}* sink_;
+ ::mojo::internal::SharedData<{{interface.name}}Stub*> weak_self_;
+ bool connection_error_occurred_;
+ bool closed_;
};

Powered by Google App Engine
This is Rietveld 408576698