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 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 bool Equals(const InterfacePtr& other) const { | 187 bool Equals(const InterfacePtr& other) const { |
188 if (this == &other) | 188 if (this == &other) |
189 return true; | 189 return true; |
190 | 190 |
191 // Now that the two refer to different objects, they are equivalent if | 191 // Now that the two refer to different objects, they are equivalent if |
192 // and only if they are both null. | 192 // and only if they are both null. |
193 return !(*this) && !other; | 193 return !(*this) && !other; |
194 } | 194 } |
195 | 195 |
196 void EnableNestedDispatch(bool enabled) { | |
197 internal_state_.EnableNestedDispatch(enabled); | |
198 } | |
199 | |
200 // DO NOT USE. Exposed only for internal use and for testing. | 196 // DO NOT USE. Exposed only for internal use and for testing. |
201 internal::InterfacePtrState<Interface>* internal_state() { | 197 internal::InterfacePtrState<Interface>* internal_state() { |
202 return &internal_state_; | 198 return &internal_state_; |
203 } | 199 } |
204 | 200 |
205 // Allow InterfacePtr<> to be used in boolean expressions, but not | 201 // Allow InterfacePtr<> to be used in boolean expressions, but not |
206 // implicitly convertible to a real bool (which is dangerous). | 202 // implicitly convertible to a real bool (which is dangerous). |
207 private: | 203 private: |
208 // TODO(dcheng): Use an explicit conversion operator. | 204 // TODO(dcheng): Use an explicit conversion operator. |
209 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable; | 205 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable; |
(...skipping 27 matching lines...) Expand all Loading... |
237 base::ThreadTaskRunnerHandle::Get()) { | 233 base::ThreadTaskRunnerHandle::Get()) { |
238 InterfacePtr<Interface> ptr; | 234 InterfacePtr<Interface> ptr; |
239 if (info.is_valid()) | 235 if (info.is_valid()) |
240 ptr.Bind(std::move(info), std::move(runner)); | 236 ptr.Bind(std::move(info), std::move(runner)); |
241 return std::move(ptr); | 237 return std::move(ptr); |
242 } | 238 } |
243 | 239 |
244 } // namespace mojo | 240 } // namespace mojo |
245 | 241 |
246 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 242 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
OLD | NEW |