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

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: simplify the profile service loader / impl 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; }
tim (not reviewing) 2014/07/11 01:33:41 I might be missing something, but I think one thin
darin (slow to review) 2014/07/11 03:52:35 A template arg to InterfaceImpl<> would help solve
+};
+
// 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