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

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

Issue 284113009: Mojo: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « mojo/public/cpp/bindings/interface_impl.h ('k') | mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..40937e39a5098d9f751b06a6dbb1b2fec410ca0a 100644
--- a/mojo/public/cpp/bindings/lib/interface_impl_internal.h
+++ b/mojo/public/cpp/bindings/lib/interface_impl_internal.h
@@ -13,11 +13,19 @@ namespace mojo {
namespace internal {
template <typename Interface>
+class InterfaceImplBase : public Interface {
+ public:
+ virtual ~InterfaceImplBase() {}
+ virtual void OnConnectionEstablished() = 0;
+ virtual void OnConnectionError() = 0;
+};
+
+template <typename Interface>
class InterfaceImplState : public ErrorHandler {
public:
typedef typename Interface::Client Client;
- explicit InterfaceImplState(WithErrorHandler<Interface>* instance)
+ explicit InterfaceImplState(InterfaceImplBase<Interface>* instance)
: router_(NULL),
client_(NULL),
proxy_(NULL) {
@@ -51,7 +59,8 @@ class InterfaceImplState : public ErrorHandler {
proxy_ = new typename Client::Proxy_(router_);
- stub_.sink()->SetClient(proxy_);
+ instance()->SetClient(proxy_);
+ instance()->OnConnectionEstablished();
}
Router* router() { return router_; }
@@ -60,9 +69,12 @@ class InterfaceImplState : public ErrorHandler {
Client* client() { return client_; }
private:
+ InterfaceImplBase<Interface>* instance() {
+ return static_cast<InterfaceImplBase<Interface>*>(stub_.sink());
+ }
+
virtual void OnConnectionError() MOJO_OVERRIDE {
- static_cast<WithErrorHandler<Interface>*>(stub_.sink())->
- OnConnectionError();
+ instance()->OnConnectionError();
}
internal::Router* router_;
« no previous file with comments | « mojo/public/cpp/bindings/interface_impl.h ('k') | mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698