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

Side by Side Diff: trunk/src/mojo/public/cpp/bindings/interface_impl.h

Issue 287003004: Revert 270867 "Mojo: Internalize ServiceConnector<>" (Closed) Base URL: svn://svn.chromium.org/chrome/
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_
7 7
8 #include "mojo/public/cpp/bindings/lib/interface_impl_internal.h" 8 #include "mojo/public/cpp/bindings/lib/interface_impl_internal.h"
9 #include "mojo/public/cpp/system/macros.h" 9 #include "mojo/public/cpp/system/macros.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 // InterfaceImpl<..> is designed to be the base class of an interface 13 // InterfaceImpl<..> is designed to be the base class of an interface
14 // implementation. It may be bound to a pipe or a proxy, see BindToPipe and 14 // implementation. It may be bound to a pipe or a proxy, see BindToPipe and
15 // BindToProxy. 15 // BindToProxy.
16 //
17 // NOTE: A base class of WithErrorHandler<Interface> is used to avoid multiple
18 // inheritance. This base class inserts the signature of ErrorHandler into the
19 // inheritance chain.
16 template <typename Interface> 20 template <typename Interface>
17 class InterfaceImpl : public internal::InterfaceImplBase<Interface> { 21 class InterfaceImpl : public WithErrorHandler<Interface> {
18 public: 22 public:
19 typedef typename Interface::Client Client; 23 typedef typename Interface::Client Client;
20 24
21 InterfaceImpl() : internal_state_(this) {} 25 InterfaceImpl() : internal_state_(this) {}
22 virtual ~InterfaceImpl() {} 26 virtual ~InterfaceImpl() {}
23 27
24 // Subclasses can override this to handle post connection initialization.
25 virtual void OnConnectionEstablished() {}
26
27 // Subclasses must handle connection errors. 28 // Subclasses must handle connection errors.
28 virtual void OnConnectionError() = 0; 29 virtual void OnConnectionError() = 0;
29 30
30 // We override SetClient here so subclasses don't each have to. 31 // We override SetClient here so subclasses don't each have to.
31 virtual void SetClient(Client* client) MOJO_OVERRIDE { 32 virtual void SetClient(Client* client) MOJO_OVERRIDE {
32 internal_state_.set_client(client); 33 internal_state_.set_client(client);
33 } 34 }
34 Client* client() { return internal_state_.client(); } 35 Client* client() { return internal_state_.client(); }
35 36
36 // DO NOT USE. Exposed only for internal use and for testing. 37 // DO NOT USE. Exposed only for internal use and for testing.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Impl* BindToProxy(Impl* instance, 78 Impl* BindToProxy(Impl* instance,
78 InterfacePtr<Interface>* ptr, 79 InterfacePtr<Interface>* ptr,
79 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()) { 80 MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter()) {
80 instance->internal_state()->BindProxy(ptr, waiter); 81 instance->internal_state()->BindProxy(ptr, waiter);
81 return instance; 82 return instance;
82 } 83 }
83 84
84 } // namespace mojo 85 } // namespace mojo
85 86
86 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ 87 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_
OLDNEW
« no previous file with comments | « trunk/src/mojo/public/cpp/bindings/error_handler.h ('k') | trunk/src/mojo/public/cpp/bindings/lib/interface_impl_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698