| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 bool Equals(const InterfacePtr& other) const { | 194 bool Equals(const InterfacePtr& other) const { |
| 195 if (this == &other) | 195 if (this == &other) |
| 196 return true; | 196 return true; |
| 197 | 197 |
| 198 // Now that the two refer to different objects, they are equivalent if | 198 // Now that the two refer to different objects, they are equivalent if |
| 199 // and only if they are both null. | 199 // and only if they are both null. |
| 200 return !(*this) && !other; | 200 return !(*this) && !other; |
| 201 } | 201 } |
| 202 | 202 |
| 203 size_t pending_callback_count() const { |
| 204 return internal_state_.pending_callback_count(); |
| 205 } |
| 206 |
| 207 void set_process_async_during_sync(bool value) { |
| 208 internal_state_.set_process_async_during_sync(value); |
| 209 } |
| 210 |
| 203 // DO NOT USE. Exposed only for internal use and for testing. | 211 // DO NOT USE. Exposed only for internal use and for testing. |
| 204 internal::InterfacePtrState<Interface>* internal_state() { | 212 internal::InterfacePtrState<Interface>* internal_state() { |
| 205 return &internal_state_; | 213 return &internal_state_; |
| 206 } | 214 } |
| 207 | 215 |
| 208 // Allow InterfacePtr<> to be used in boolean expressions, but not | 216 // Allow InterfacePtr<> to be used in boolean expressions, but not |
| 209 // implicitly convertible to a real bool (which is dangerous). | 217 // implicitly convertible to a real bool (which is dangerous). |
| 210 private: | 218 private: |
| 211 // TODO(dcheng): Use an explicit conversion operator. | 219 // TODO(dcheng): Use an explicit conversion operator. |
| 212 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable; | 220 typedef internal::InterfacePtrState<Interface> InterfacePtr::*Testable; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 240 base::ThreadTaskRunnerHandle::Get()) { | 248 base::ThreadTaskRunnerHandle::Get()) { |
| 241 InterfacePtr<Interface> ptr; | 249 InterfacePtr<Interface> ptr; |
| 242 if (info.is_valid()) | 250 if (info.is_valid()) |
| 243 ptr.Bind(std::move(info), std::move(runner)); | 251 ptr.Bind(std::move(info), std::move(runner)); |
| 244 return std::move(ptr); | 252 return std::move(ptr); |
| 245 } | 253 } |
| 246 | 254 |
| 247 } // namespace mojo | 255 } // namespace mojo |
| 248 | 256 |
| 249 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ | 257 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_PTR_H_ |
| OLD | NEW |