| 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
|
|
|