| 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 "mojo/public/c/environment/async_waiter.h" | 8 #include "mojo/public/c/environment/async_waiter.h" |
| 9 #include "mojo/public/cpp/bindings/callback.h" | 9 #include "mojo/public/cpp/bindings/callback.h" |
| 10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Unbinds the underlying pipe from this binding and returns it so it can be | 169 // Unbinds the underlying pipe from this binding and returns it so it can be |
| 170 // used in another context, such as on another thread or with a different | 170 // used in another context, such as on another thread or with a different |
| 171 // implementation. Put this object into a state where it can be rebound to a | 171 // implementation. Put this object into a state where it can be rebound to a |
| 172 // new pipe. | 172 // new pipe. |
| 173 InterfaceRequest<Interface> Unbind() { | 173 InterfaceRequest<Interface> Unbind() { |
| 174 InterfaceRequest<Interface> request = | 174 InterfaceRequest<Interface> request = |
| 175 MakeRequest<Interface>(internal_router_->PassMessagePipe()); | 175 MakeRequest<Interface>(internal_router_->PassMessagePipe()); |
| 176 DestroyRouter(); | 176 DestroyRouter(); |
| 177 // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove | 177 // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove |
| 178 // it once that's fixed. | 178 // it once that's fixed. |
| 179 return request.Pass(); | 179 return request; |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Sets an error handler that will be called if a connection error occurs on | 182 // Sets an error handler that will be called if a connection error occurs on |
| 183 // the bound message pipe. | 183 // the bound message pipe. |
| 184 void set_connection_error_handler(const Closure& error_handler) { | 184 void set_connection_error_handler(const Closure& error_handler) { |
| 185 connection_error_handler_ = error_handler; | 185 connection_error_handler_ = error_handler; |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Returns the interface implementation that was previously specified. Caller | 188 // Returns the interface implementation that was previously specified. Caller |
| 189 // does not take ownership. | 189 // does not take ownership. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 216 typename Interface::Stub_ stub_; | 216 typename Interface::Stub_ stub_; |
| 217 Interface* impl_; | 217 Interface* impl_; |
| 218 Closure connection_error_handler_; | 218 Closure connection_error_handler_; |
| 219 | 219 |
| 220 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); | 220 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 } // namespace mojo | 223 } // namespace mojo |
| 224 | 224 |
| 225 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 225 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| OLD | NEW |