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

Unified Diff: mojo/public/cpp/bindings/lib/interface_impl_internal.h

Issue 275363002: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OnConnectionEstablished() Created 6 years, 7 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/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();
}

Powered by Google App Engine
This is Rietveld 408576698