8#ifndef FLUTTER_FML_MEMORY_WEAK_PTR_H_
9#define FLUTTER_FML_MEMORY_WEAK_PTR_H_
13#include "flutter/fml/logging.h"
14#include "flutter/fml/memory/ref_counted.h"
15#include "flutter/fml/memory/task_runner_checker.h"
16#include "flutter/fml/memory/thread_checker.h"
17#include "flutter/fml/memory/weak_ptr_internal.h"
57 : ptr_(static_cast<
T*>(r.ptr_)), flag_(r.flag_), checker_(r.checker_) {}
64 : ptr_(static_cast<
T*>(r.ptr_)),
65 flag_(
std::move(r.flag_)),
66 checker_(r.checker_) {}
77 void reset() { flag_ =
nullptr; }
82 explicit operator bool()
const {
89 return *
this ? ptr_ :
nullptr;
106 : ptr_(ptr), flag_(
std::move(
flag)) {}
113 template <
typename U>
121 : ptr_(ptr), flag_(
std::move(
flag)), checker_(checker) {}
131class TaskRunnerAffineWeakPtrFactory;
144 template <
typename U>
147 : ptr_(static_cast<
T*>(r.ptr_)), flag_(r.flag_), checker_(r.checker_) {}
151 template <
typename U>
154 : ptr_(static_cast<
T*>(r.ptr_)),
155 flag_(
std::move(r.flag_)),
156 checker_(r.checker_) {}
171 explicit operator bool()
const {
178 return *
this ? ptr_ :
nullptr;
199 template <
typename U>
207 : ptr_(ptr), flag_(
std::move(
flag)), checker_(checker) {}
281 void CheckThreadSafety()
const {
285 DebugThreadChecker checker_;
317 void CheckThreadSafety()
const {
321 DebugTaskRunnerChecker checker_;
RefPtr< T > Clone() const
TaskRunnerAffineWeakPtrFactory(T *ptr)
TaskRunnerAffineWeakPtr< T > GetWeakPtr() const
~TaskRunnerAffineWeakPtrFactory()
TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr< T > &&r)=default
friend class TaskRunnerAffineWeakPtr
TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr< T > &r)=default
void CheckThreadSafety() const
TaskRunnerAffineWeakPtr< T > & operator=(const TaskRunnerAffineWeakPtr< T > &r)=default
TaskRunnerAffineWeakPtr< T > & operator=(TaskRunnerAffineWeakPtr< T > &&r)=default
~TaskRunnerAffineWeakPtr()=default
TaskRunnerAffineWeakPtr(const TaskRunnerAffineWeakPtr< U > &r)
TaskRunnerAffineWeakPtr(TaskRunnerAffineWeakPtr< U > &&r)
TaskRunnerAffineWeakPtr()
WeakPtr< T > GetWeakPtr() const
void CheckThreadSafety() const
WeakPtr(WeakPtr< U > &&r)
WeakPtr(const WeakPtr< U > &r)
WeakPtr< T > & operator=(WeakPtr< T > &&r)=default
WeakPtr< T > & operator=(const WeakPtr< T > &r)=default
WeakPtr(T *ptr, fml::RefPtr< fml::internal::WeakPtrFlag > &&flag)
WeakPtr(const WeakPtr< T > &r)=default
WeakPtr(WeakPtr< T > &&r)=default
FlutterSemanticsFlag flag
#define FML_DCHECK(condition)
RefPtr< T > MakeRefCounted(Args &&... args)
FML_DECLARE_TASK_RUNNER_CHECKER(checker)
FML_DECLARE_THREAD_CHECKER(checker)
#define FML_DCHECK_TASK_RUNNER_IS_CURRENT(c)
#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c)