Lines Matching refs:WeakPtr
31 // static void StartNew(const WeakPtr<Controller>& controller) {
36 // Worker(const WeakPtr<Controller>& controller)
42 // WeakPtr<Controller> controller_;
55 // To ensure correct use, the first time a WeakPtr issued by a WeakPtrFactory
62 // If all WeakPtr objects are destroyed or invalidated then the factory is
64 // destroyed, or new WeakPtr objects may be used, from a different sequence.
66 // Thus, at least one WeakPtr object must exist and have been dereferenced on
67 // the correct thread to enforce that other WeakPtr objects will enforce they
84 class WeakPtr;
87 // These classes are part of the WeakPtr implementation.
93 // deleted from another via base::WeakPtr::~WeakPtr().
139 // This class simplifies the implementation of WeakPtr's type conversion
141 // WeakPtr<T> cannot access the private members of WeakPtr<U>, so this
173 // A safe static downcast of a WeakPtr<Base> to WeakPtr<Derived>. This
180 static WeakPtr<Derived> StaticAsWeakPtr(Derived* t) {
192 static WeakPtr<Derived> AsWeakPtrImpl(SupportsWeakPtr<Base>* t) {
193 WeakPtr<Base> ptr = t->AsWeakPtr();
194 return WeakPtr<Derived>(
204 // The WeakPtr class holds a weak reference to |T*|.
213 // WeakPtr<Foo> foo;
218 class WeakPtr : public internal::WeakPtrBase {
220 WeakPtr() = default;
222 WeakPtr(std::nullptr_t) {}
227 WeakPtr(const WeakPtr<U>& other) : WeakPtrBase(other) {
234 WeakPtr(WeakPtr<U>&& other) : WeakPtrBase(std::move(other)) {
260 friend class WeakPtr;
264 WeakPtr(const internal::WeakReference& ref, T* ptr)
270 bool operator!=(const WeakPtr<T>& weak_ptr, std::nullptr_t) {
274 bool operator!=(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
278 bool operator==(const WeakPtr<T>& weak_ptr, std::nullptr_t) {
282 bool operator==(std::nullptr_t, const WeakPtr<T>& weak_ptr) {
309 WeakPtr<T> GetWeakPtr() {
310 return WeakPtr<T>(weak_reference_owner_.GetRef(),
342 WeakPtr<T> AsWeakPtr() {
343 return WeakPtr<T>(weak_reference_owner_.GetRef(), static_cast<T*>(this));
355 // Helper function that uses type deduction to safely return a WeakPtr<Derived>
364 // base::WeakPtr<Derived> ptr = base::AsWeakPtr(&derived);
367 // Derived::AsWeakPtr() is WeakPtr<Base> SupportsWeakPtr<Base>::AsWeakPtr(),
368 // and there's no way to safely cast WeakPtr<Base> to WeakPtr<Derived> at
371 // base::WeakPtr<Derived> ptr = derived.AsWeakPtr(); // Fails.
374 WeakPtr<Derived> AsWeakPtr(Derived* t) {