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_INTERFACE_PTR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 // Returns the associated group that this object belongs to. Returns null if: | 168 // Returns the associated group that this object belongs to. Returns null if: |
169 // - this object is not bound; or | 169 // - this object is not bound; or |
170 // - the interface doesn't have methods to pass associated interface | 170 // - the interface doesn't have methods to pass associated interface |
171 // pointers or requests. | 171 // pointers or requests. |
172 AssociatedGroup* associated_group() { | 172 AssociatedGroup* associated_group() { |
173 return internal_state_.associated_group(); | 173 return internal_state_.associated_group(); |
174 } | 174 } |
175 | 175 |
| 176 // Allows synchronous dispatch for this endpoint. When sync dispatch is |
| 177 // allowed, a response originating from a binding on the same thread may |
| 178 // synchronously invoke the response callback. |
| 179 // |
| 180 // Note that this also allows synchronous dispatch for any endpoints |
| 181 // which are associated with this one and which live on the same thread. |
| 182 void SetAllowSyncDispatch(bool allowed) { |
| 183 internal_state_.SetAllowSyncDispatch(allowed); |
| 184 } |
| 185 |
176 // DO NOT USE. Exposed only for internal use and for testing. | 186 // DO NOT USE. Exposed only for internal use and for testing. |
177 internal::InterfacePtrState<Interface, Interface::PassesAssociatedKinds_>* | 187 internal::InterfacePtrState<Interface, Interface::PassesAssociatedKinds_>* |
178 internal_state() { | 188 internal_state() { |
179 return &internal_state_; | 189 return &internal_state_; |
180 } | 190 } |
181 | 191 |
182 // Allow InterfacePtr<> to be used in boolean expressions, but not | 192 // Allow InterfacePtr<> to be used in boolean expressions, but not |
183 // implicitly convertible to a real bool (which is dangerous). | 193 // implicitly convertible to a real bool (which is dangerous). |
184 private: | 194 private: |
185 typedef internal::InterfacePtrState<Interface, | 195 typedef internal::InterfacePtrState<Interface, |
(...skipping 25 matching lines...) Expand all Loading... |
211 InterfacePtr<Interface> MakeProxy(InterfacePtrInfo<Interface> info) { | 221 InterfacePtr<Interface> MakeProxy(InterfacePtrInfo<Interface> info) { |
212 InterfacePtr<Interface> ptr; | 222 InterfacePtr<Interface> ptr; |
213 if (info.is_valid()) | 223 if (info.is_valid()) |
214 ptr.Bind(std::move(info)); | 224 ptr.Bind(std::move(info)); |
215 return std::move(ptr); | 225 return std::move(ptr); |
216 } | 226 } |
217 | 227 |
218 } // namespace mojo | 228 } // namespace mojo |
219 | 229 |
220 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 230 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
OLD | NEW |