| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "mojo/public/c/environment/async_waiter.h" | 9 #include "mojo/public/c/environment/async_waiter.h" |
| 10 #include "mojo/public/cpp/bindings/callback.h" | 10 #include "mojo/public/cpp/bindings/callback.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // message pipe in order to call this method. We need a way to forcefully | 187 // message pipe in order to call this method. We need a way to forcefully |
| 188 // invalidate associated interface endpoint handles. | 188 // invalidate associated interface endpoint handles. |
| 189 InterfaceRequest<Interface> Unbind() { | 189 InterfaceRequest<Interface> Unbind() { |
| 190 CHECK(!HasAssociatedInterfaces()); | 190 CHECK(!HasAssociatedInterfaces()); |
| 191 return internal_state_.Unbind(); | 191 return internal_state_.Unbind(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Sets an error handler that will be called if a connection error occurs on | 194 // Sets an error handler that will be called if a connection error occurs on |
| 195 // the bound message pipe. | 195 // the bound message pipe. |
| 196 void set_connection_error_handler(const Closure& error_handler) { | 196 void set_connection_error_handler(const Closure& error_handler) { |
| 197 DCHECK(is_bound()); |
| 197 internal_state_.set_connection_error_handler(error_handler); | 198 internal_state_.set_connection_error_handler(error_handler); |
| 198 } | 199 } |
| 199 | 200 |
| 200 // Returns the interface implementation that was previously specified. Caller | 201 // Returns the interface implementation that was previously specified. Caller |
| 201 // does not take ownership. | 202 // does not take ownership. |
| 202 Interface* impl() { return internal_state_.impl(); } | 203 Interface* impl() { return internal_state_.impl(); } |
| 203 | 204 |
| 204 // Indicates whether the binding has been completed (i.e., whether a message | 205 // Indicates whether the binding has been completed (i.e., whether a message |
| 205 // pipe has been bound to the implementation). | 206 // pipe has been bound to the implementation). |
| 206 bool is_bound() const { return internal_state_.is_bound(); } | 207 bool is_bound() const { return internal_state_.is_bound(); } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 225 private: | 226 private: |
| 226 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> | 227 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> |
| 227 internal_state_; | 228 internal_state_; |
| 228 | 229 |
| 229 DISALLOW_COPY_AND_ASSIGN(Binding); | 230 DISALLOW_COPY_AND_ASSIGN(Binding); |
| 230 }; | 231 }; |
| 231 | 232 |
| 232 } // namespace mojo | 233 } // namespace mojo |
| 233 | 234 |
| 234 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 235 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| OLD | NEW |