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 <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback_forward.h" | |
11 #include "base/macros.h" | 10 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
13 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "mojo/public/cpp/bindings/callback.h" |
15 #include "mojo/public/cpp/bindings/interface_ptr.h" | 15 #include "mojo/public/cpp/bindings/interface_ptr.h" |
16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
17 #include "mojo/public/cpp/bindings/interface_request.h" | 17 #include "mojo/public/cpp/bindings/interface_request.h" |
18 #include "mojo/public/cpp/bindings/lib/binding_state.h" | 18 #include "mojo/public/cpp/bindings/lib/binding_state.h" |
19 #include "mojo/public/cpp/system/core.h" | 19 #include "mojo/public/cpp/system/core.h" |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 | 22 |
23 class AssociatedGroup; | 23 class AssociatedGroup; |
24 | 24 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 CHECK(!HasAssociatedInterfaces()); | 205 CHECK(!HasAssociatedInterfaces()); |
206 return internal_state_.Unbind(); | 206 return internal_state_.Unbind(); |
207 } | 207 } |
208 | 208 |
209 // Sets an error handler that will be called if a connection error occurs on | 209 // Sets an error handler that will be called if a connection error occurs on |
210 // the bound message pipe. | 210 // the bound message pipe. |
211 // | 211 // |
212 // This method may only be called after this Binding has been bound to a | 212 // This method may only be called after this Binding has been bound to a |
213 // message pipe. The error handler will be reset when this Binding is unbound | 213 // message pipe. The error handler will be reset when this Binding is unbound |
214 // or closed. | 214 // or closed. |
215 void set_connection_error_handler(const base::Closure& error_handler) { | 215 void set_connection_error_handler(const Closure& error_handler) { |
216 DCHECK(is_bound()); | 216 DCHECK(is_bound()); |
217 internal_state_.set_connection_error_handler(error_handler); | 217 internal_state_.set_connection_error_handler(error_handler); |
218 } | 218 } |
219 | 219 |
220 // Returns the interface implementation that was previously specified. Caller | 220 // Returns the interface implementation that was previously specified. Caller |
221 // does not take ownership. | 221 // does not take ownership. |
222 Interface* impl() { return internal_state_.impl(); } | 222 Interface* impl() { return internal_state_.impl(); } |
223 | 223 |
224 // Indicates whether the binding has been completed (i.e., whether a message | 224 // Indicates whether the binding has been completed (i.e., whether a message |
225 // pipe has been bound to the implementation). | 225 // pipe has been bound to the implementation). |
(...skipping 19 matching lines...) Expand all Loading... |
245 private: | 245 private: |
246 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> | 246 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> |
247 internal_state_; | 247 internal_state_; |
248 | 248 |
249 DISALLOW_COPY_AND_ASSIGN(Binding); | 249 DISALLOW_COPY_AND_ASSIGN(Binding); |
250 }; | 250 }; |
251 | 251 |
252 } // namespace mojo | 252 } // namespace mojo |
253 | 253 |
254 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 254 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
OLD | NEW |