OLD | NEW |
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/binding.h" | 8 #include "mojo/public/cpp/bindings/binding.h" |
9 #include "mojo/public/cpp/bindings/interface_request.h" | 9 #include "mojo/public/cpp/bindings/interface_request.h" |
10 #include "mojo/public/cpp/environment/environment.h" | 10 #include "mojo/public/cpp/environment/environment.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 binding_.Bind(handle.Pass(), waiter); | 34 binding_.Bind(handle.Pass(), waiter); |
35 } | 35 } |
36 | 36 |
37 bool WaitForIncomingMethodCall() { | 37 bool WaitForIncomingMethodCall() { |
38 return binding_.WaitForIncomingMethodCall(); | 38 return binding_.WaitForIncomingMethodCall(); |
39 } | 39 } |
40 | 40 |
41 Client* client() { return binding_.client(); } | 41 Client* client() { return binding_.client(); } |
42 internal::Router* internal_router() { return binding_.internal_router(); } | 42 internal::Router* internal_router() { return binding_.internal_router(); } |
43 | 43 |
| 44 // Implements ErrorHandler. |
| 45 // |
44 // Called when the client is no longer connected to this instance. NOTE: The | 46 // Called when the client is no longer connected to this instance. NOTE: The |
45 // client() method continues to return a non-null pointer after this method | 47 // client() method continues to return a non-null pointer after this method |
46 // is called. After this method is called, any method calls made on client() | 48 // is called. After this method is called, any method calls made on client() |
47 // will be silently ignored. | 49 // will be silently ignored. |
48 virtual void OnConnectionError() {} | 50 void OnConnectionError() override {} |
49 | 51 |
50 void set_delete_on_error(bool delete_on_error) { | 52 void set_delete_on_error(bool delete_on_error) { |
51 error_handler_impl_.set_delete_on_error(delete_on_error); | 53 error_handler_impl_.set_delete_on_error(delete_on_error); |
52 } | 54 } |
53 | 55 |
54 private: | 56 private: |
55 class ErrorHandlerImpl : public ErrorHandler { | 57 class ErrorHandlerImpl : public ErrorHandler { |
56 public: | 58 public: |
57 explicit ErrorHandlerImpl(InterfaceImpl* impl) : impl_(impl) {} | 59 explicit ErrorHandlerImpl(InterfaceImpl* impl) : impl_(impl) {} |
58 ~ErrorHandlerImpl() override {} | 60 ~ErrorHandlerImpl() override {} |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 Impl* WeakBindToRequest( | 175 Impl* WeakBindToRequest( |
174 Impl* instance, | 176 Impl* instance, |
175 InterfaceRequest<Interface>* request, | 177 InterfaceRequest<Interface>* request, |
176 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { | 178 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
177 return WeakBindToPipe(instance, request->PassMessagePipe(), waiter); | 179 return WeakBindToPipe(instance, request->PassMessagePipe(), waiter); |
178 } | 180 } |
179 | 181 |
180 } // namespace mojo | 182 } // namespace mojo |
181 | 183 |
182 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ | 184 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ |
OLD | NEW |