| 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_BINDING_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 void Close() { | 165 void Close() { |
| 166 MOJO_DCHECK(internal_router_); | 166 MOJO_DCHECK(internal_router_); |
| 167 internal_router_.reset(); | 167 internal_router_.reset(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Unbinds the underlying pipe from this binding and returns it so it can be | 170 // Unbinds the underlying pipe from this binding and returns it so it can be |
| 171 // used in another context, such as on another thread or with a different | 171 // used in another context, such as on another thread or with a different |
| 172 // implementation. Put this object into a state where it can be rebound to a | 172 // implementation. Put this object into a state where it can be rebound to a |
| 173 // new pipe. | 173 // new pipe. |
| 174 InterfaceRequest<Interface> Unbind() { | 174 InterfaceRequest<Interface> Unbind() { |
| 175 auto request = MakeRequest<Interface>(internal_router_->PassMessagePipe()); | 175 auto request = |
| 176 InterfaceRequest<Interface>(internal_router_->PassMessagePipe()); |
| 176 internal_router_.reset(); | 177 internal_router_.reset(); |
| 177 return request; | 178 return request; |
| 178 } | 179 } |
| 179 | 180 |
| 180 // Sets an error handler that will be called if a connection error occurs on | 181 // Sets an error handler that will be called if a connection error occurs on |
| 181 // the bound message pipe. | 182 // the bound message pipe. |
| 182 void set_connection_error_handler(const Closure& error_handler) { | 183 void set_connection_error_handler(const Closure& error_handler) { |
| 183 connection_error_handler_ = error_handler; | 184 connection_error_handler_ = error_handler; |
| 184 } | 185 } |
| 185 | 186 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 208 typename Interface::Stub_ stub_; | 209 typename Interface::Stub_ stub_; |
| 209 Interface* impl_; | 210 Interface* impl_; |
| 210 Closure connection_error_handler_; | 211 Closure connection_error_handler_; |
| 211 | 212 |
| 212 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); | 213 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); |
| 213 }; | 214 }; |
| 214 | 215 |
| 215 } // namespace mojo | 216 } // namespace mojo |
| 216 | 217 |
| 217 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 218 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| OLD | NEW |