| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 MessagePipeHandle handle() const { return internal_state_.handle(); } | 201 MessagePipeHandle handle() const { return internal_state_.handle(); } |
| 202 | 202 |
| 203 // Returns the associated group that this object belongs to. Returns null if: | 203 // Returns the associated group that this object belongs to. Returns null if: |
| 204 // - this object is not bound; or | 204 // - this object is not bound; or |
| 205 // - the interface doesn't have methods to pass associated interface | 205 // - the interface doesn't have methods to pass associated interface |
| 206 // pointers or requests. | 206 // pointers or requests. |
| 207 AssociatedGroup* associated_group() { | 207 AssociatedGroup* associated_group() { |
| 208 return internal_state_.associated_group(); | 208 return internal_state_.associated_group(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Allows immediate, synchronous dispatch of any incoming method call elicited |
| 212 // by an event on the Binding's own thread. This is useful for efficiency when |
| 213 // a Binding lives on the same thread that's running Mojo IPC Support (e.g. |
| 214 // Chrome's IO thread) because there's no risk of subtle reentrancy issues in |
| 215 // interface implementations. |
| 216 // |
| 217 // This may also be used in testing when, e.g., an InterfacePtr and Binding |
| 218 // live on the same thread and you want synchronous behavior for messages that |
| 219 // are asynchronous under normal conditions. |
| 220 // |
| 221 // Note that this option also affects all endpoints which are associated with |
| 222 // this one and which live on the same thread. |
| 223 void EnableImmediateDispatchOfEventsFromSameThread(bool enabled) { |
| 224 internal_state_.EnableImmediateDispatchOfEventsFromSameThread(enabled); |
| 225 } |
| 226 |
| 211 // Exposed for testing, should not generally be used. | 227 // Exposed for testing, should not generally be used. |
| 212 void EnableTestingMode() { internal_state_.EnableTestingMode(); } | 228 void EnableTestingMode() { internal_state_.EnableTestingMode(); } |
| 213 | 229 |
| 214 private: | 230 private: |
| 215 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> | 231 internal::BindingState<Interface, Interface::PassesAssociatedKinds_> |
| 216 internal_state_; | 232 internal_state_; |
| 217 | 233 |
| 218 DISALLOW_COPY_AND_ASSIGN(Binding); | 234 DISALLOW_COPY_AND_ASSIGN(Binding); |
| 219 }; | 235 }; |
| 220 | 236 |
| 221 } // namespace mojo | 237 } // namespace mojo |
| 222 | 238 |
| 223 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ | 239 #endif // MOJO_PUBLIC_CPP_BINDINGS_BINDING_H_ |
| OLD | NEW |