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

Unified Diff: mojo/public/cpp/bindings/interface_impl.h

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some InterfaceProvider impls for common cases Created 6 years, 5 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/cpp/bindings/interface_impl.h
diff --git a/mojo/public/cpp/bindings/interface_impl.h b/mojo/public/cpp/bindings/interface_impl.h
index 4a78cb4b05a1f11b4380a001aab45fa76e91a8e2..387c62d0a41ec522c895738db2fbfd00325d3c40 100644
--- a/mojo/public/cpp/bindings/interface_impl.h
+++ b/mojo/public/cpp/bindings/interface_impl.h
@@ -55,6 +55,15 @@ class InterfaceImpl : public internal::InterfaceImplBase<Interface> {
MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceImpl);
};
+// Use InterfaceImplDeleteOnError if your interface implementation should delete
+// itself when detecting a connection error.
+template <typename Interface>
+class InterfaceImplDeleteOnError : public InterfaceImpl<Interface> {
+ public:
+ virtual ~InterfaceImplDeleteOnError() {}
+ virtual void OnConnectionError() { delete this; }
+};
+
// Takes an instance of an InterfaceImpl<..> subclass and binds it to the given
// MessagePipe. The instance is returned for convenience in member initializer
// lists, etc. If the pipe is closed, the instance's OnConnectionError method

Powered by Google App Engine
This is Rietveld 408576698