Index: mojo/public/cpp/bindings/lib/interface_impl_internal.h |
diff --git a/mojo/public/cpp/bindings/lib/interface_impl_internal.h b/mojo/public/cpp/bindings/lib/interface_impl_internal.h |
index 8c098ccbf9860d6c802435b0d0e5297c666b5128..549768d81ae513aad0ec2689840d0c545b0694f0 100644 |
--- a/mojo/public/cpp/bindings/lib/interface_impl_internal.h |
+++ b/mojo/public/cpp/bindings/lib/interface_impl_internal.h |
@@ -12,12 +12,27 @@ |
namespace mojo { |
namespace internal { |
+class InterfaceImplBase : public ErrorHandler { |
darin (slow to review)
2014/05/15 18:06:20
I don't think this interface is needed. InterfaceI
|
+ public: |
+ virtual ~InterfaceImplBase() {} |
+ virtual void OnConnectionEstablished() = 0; |
+ virtual void OnConnectionError() = 0; |
+}; |
+ |
+template <typename Base> |
+class WithInterfaceImplBase : public Base { |
darin (slow to review)
2014/05/15 18:06:20
This class should just be renamed InterfaceImplBas
|
+ public: |
+ virtual ~WithInterfaceImplBase() {} |
+ virtual void OnConnectionEstablished() = 0; |
+ virtual void OnConnectionError() = 0; |
+}; |
+ |
template <typename Interface> |
-class InterfaceImplState : public ErrorHandler { |
+class InterfaceImplState : public InterfaceImplBase { |
public: |
typedef typename Interface::Client Client; |
- explicit InterfaceImplState(WithErrorHandler<Interface>* instance) |
+ explicit InterfaceImplState(WithInterfaceImplBase<Interface>* instance) |
: router_(NULL), |
client_(NULL), |
proxy_(NULL) { |
@@ -52,6 +67,7 @@ class InterfaceImplState : public ErrorHandler { |
proxy_ = new typename Client::Proxy_(router_); |
stub_.sink()->SetClient(proxy_); |
+ OnConnectionEstablished(); |
darin (slow to review)
2014/05/15 18:06:20
no need for the virtual function call here. this c
|
} |
Router* router() { return router_; } |
@@ -60,8 +76,13 @@ class InterfaceImplState : public ErrorHandler { |
Client* client() { return client_; } |
private: |
+ virtual void OnConnectionEstablished() MOJO_OVERRIDE { |
+ static_cast<WithInterfaceImplBase<Interface>*>(stub_.sink())-> |
+ OnConnectionEstablished(); |
+ } |
+ |
virtual void OnConnectionError() MOJO_OVERRIDE { |
- static_cast<WithErrorHandler<Interface>*>(stub_.sink())-> |
+ static_cast<WithInterfaceImplBase<Interface>*>(stub_.sink())-> |
OnConnectionError(); |
} |