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/error_handler.h" | 9 #include "mojo/public/cpp/bindings/error_handler.h" |
10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 // Unbinds the underlying pipe from this binding and returns it so it can be | 164 // Unbinds the underlying pipe from this binding and returns it so it can be |
165 // used in another context, such as on another thread or with a different | 165 // used in another context, such as on another thread or with a different |
166 // implementation. Put this object into a state where it can be rebound to a | 166 // implementation. Put this object into a state where it can be rebound to a |
167 // new pipe. | 167 // new pipe. |
168 InterfaceRequest<Interface> Unbind() { | 168 InterfaceRequest<Interface> Unbind() { |
169 InterfaceRequest<Interface> request = | 169 InterfaceRequest<Interface> request = |
170 MakeRequest<Interface>(internal_router_->PassMessagePipe()); | 170 MakeRequest<Interface>(internal_router_->PassMessagePipe()); |
171 DestroyRouter(); | 171 DestroyRouter(); |
172 return request; | 172 // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove |
| 173 // it once that's fixed. |
| 174 return request.Pass(); |
173 } | 175 } |
174 | 176 |
175 // Sets an error handler that will be called if a connection error occurs on | 177 // Sets an error handler that will be called if a connection error occurs on |
176 // the bound message pipe. | 178 // the bound message pipe. |
177 void set_error_handler(ErrorHandler* error_handler) { | 179 void set_error_handler(ErrorHandler* error_handler) { |
178 error_handler_ = error_handler; | 180 error_handler_ = error_handler; |
179 } | 181 } |
180 | 182 |
181 // Implements the |Binding|'s response to a connection error. | 183 // Implements the |Binding|'s response to a connection error. |
182 void OnConnectionError() override { | 184 void OnConnectionError() override { |
(...skipping 23 matching lines...) Expand all Loading... |
206 typename Interface::Stub_ stub_; | 208 typename Interface::Stub_ stub_; |
207 Interface* impl_; | 209 Interface* impl_; |
208 ErrorHandler* error_handler_ = nullptr; | 210 ErrorHandler* error_handler_ = nullptr; |
209 | 211 |
210 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); | 212 MOJO_DISALLOW_COPY_AND_ASSIGN(Binding); |
211 }; | 213 }; |
212 | 214 |
213 } // namespace mojo | 215 } // namespace mojo |
214 | 216 |
215 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 217 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
OLD | NEW |