| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 class ErrorHandlerImpl : public ErrorHandler { | 55 class ErrorHandlerImpl : public ErrorHandler { |
| 56 public: | 56 public: |
| 57 explicit ErrorHandlerImpl(InterfaceImpl* impl) : impl_(impl) {} | 57 explicit ErrorHandlerImpl(InterfaceImpl* impl) : impl_(impl) {} |
| 58 ~ErrorHandlerImpl() override {} | 58 ~ErrorHandlerImpl() override {} |
| 59 | 59 |
| 60 // ErrorHandler implementation: | 60 // ErrorHandler implementation: |
| 61 void OnConnectionError() override { | 61 void OnConnectionError() override { |
| 62 bool delete_on_error = delete_on_error_; |
| 62 impl_->OnConnectionError(); | 63 impl_->OnConnectionError(); |
| 63 if (delete_on_error_) | 64 if (delete_on_error) |
| 64 delete impl_; | 65 delete impl_; |
| 65 } | 66 } |
| 66 | 67 |
| 67 void set_delete_on_error(bool delete_on_error) { | 68 void set_delete_on_error(bool delete_on_error) { |
| 68 delete_on_error_ = delete_on_error; | 69 delete_on_error_ = delete_on_error; |
| 69 } | 70 } |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 InterfaceImpl* impl_; | 73 InterfaceImpl* impl_; |
| 73 bool delete_on_error_ = false; | 74 bool delete_on_error_ = false; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 Impl* WeakBindToRequest( | 169 Impl* WeakBindToRequest( |
| 169 Impl* instance, | 170 Impl* instance, |
| 170 InterfaceRequest<Interface>* request, | 171 InterfaceRequest<Interface>* request, |
| 171 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { | 172 const MojoAsyncWaiter* waiter = Environment::GetDefaultAsyncWaiter()) { |
| 172 return WeakBindToPipe(instance, request->PassMessagePipe(), waiter); | 173 return WeakBindToPipe(instance, request->PassMessagePipe(), waiter); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace mojo | 176 } // namespace mojo |
| 176 | 177 |
| 177 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ | 178 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_IMPL_H_ |
| OLD | NEW |