Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Friends | List of all members
fml::WeakPtr< T > Class Template Reference

#include <weak_ptr.h>

Public Member Functions

 WeakPtr ()
 
 WeakPtr (const WeakPtr< T > &r)=default
 
template<typename U >
 WeakPtr (const WeakPtr< U > &r)
 
 WeakPtr (WeakPtr< T > &&r)=default
 
template<typename U >
 WeakPtr (WeakPtr< U > &&r)
 
WeakPtr< T > & operator= (const WeakPtr< T > &r)=default
 
WeakPtr< T > & operator= (WeakPtr< T > &&r)=default
 
void reset ()
 
 operator bool () const
 
Tget () const
 
Toperator* () const
 
Toperator-> () const
 

Protected Member Functions

 WeakPtr (T *ptr, fml::RefPtr< fml::internal::WeakPtrFlag > &&flag)
 
void CheckThreadSafety () const
 

Friends

template<typename U >
class WeakPtr
 
class WeakPtrFactory< T >
 

Detailed Description

template<typename T>
class fml::WeakPtr< T >

Definition at line 47 of file weak_ptr.h.

Constructor & Destructor Documentation

◆ WeakPtr() [1/6]

template<typename T >
fml::WeakPtr< T >::WeakPtr ( )
inline

Definition at line 49 of file weak_ptr.h.

49: ptr_(nullptr) {}

◆ WeakPtr() [2/6]

template<typename T >
fml::WeakPtr< T >::WeakPtr ( const WeakPtr< T > &  r)
default

◆ WeakPtr() [3/6]

template<typename T >
template<typename U >
fml::WeakPtr< T >::WeakPtr ( const WeakPtr< U > &  r)
inline

Definition at line 56 of file weak_ptr.h.

57 : ptr_(static_cast<T*>(r.ptr_)), flag_(r.flag_), checker_(r.checker_) {}
#define T
Definition: precompiler.cc:65

◆ WeakPtr() [4/6]

template<typename T >
fml::WeakPtr< T >::WeakPtr ( WeakPtr< T > &&  r)
default

◆ WeakPtr() [5/6]

template<typename T >
template<typename U >
fml::WeakPtr< T >::WeakPtr ( WeakPtr< U > &&  r)
inline

Definition at line 63 of file weak_ptr.h.

64 : ptr_(static_cast<T*>(r.ptr_)),
65 flag_(std::move(r.flag_)),
66 checker_(r.checker_) {}

◆ WeakPtr() [6/6]

template<typename T >
fml::WeakPtr< T >::WeakPtr ( T ptr,
fml::RefPtr< fml::internal::WeakPtrFlag > &&  flag 
)
inlineexplicitprotected

Definition at line 105 of file weak_ptr.h.

106 : ptr_(ptr), flag_(std::move(flag)) {}
FlutterSemanticsFlag flag

Member Function Documentation

◆ CheckThreadSafety()

template<typename T >
void fml::WeakPtr< T >::CheckThreadSafety ( ) const
inlineprotected

Definition at line 108 of file weak_ptr.h.

108 {
110 }
#define FML_DCHECK_CREATION_THREAD_IS_CURRENT(c)

◆ get()

template<typename T >
T * fml::WeakPtr< T >::get ( ) const
inline

Definition at line 87 of file weak_ptr.h.

87 {
89 return *this ? ptr_ : nullptr;
90 }
void CheckThreadSafety() const
Definition: weak_ptr.h:108

◆ operator bool()

template<typename T >
fml::WeakPtr< T >::operator bool ( ) const
inlineexplicit

Definition at line 82 of file weak_ptr.h.

82 {
84 return flag_ && flag_->is_valid();
85 }

◆ operator*()

template<typename T >
T & fml::WeakPtr< T >::operator* ( ) const
inline

Definition at line 92 of file weak_ptr.h.

92 {
94 FML_DCHECK(*this);
95 return *get();
96 }
T * get() const
Definition: weak_ptr.h:87
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ operator->()

template<typename T >
T * fml::WeakPtr< T >::operator-> ( ) const
inline

Definition at line 98 of file weak_ptr.h.

98 {
100 FML_DCHECK(*this);
101 return get();
102 }

◆ operator=() [1/2]

template<typename T >
WeakPtr< T > & fml::WeakPtr< T >::operator= ( const WeakPtr< T > &  r)
default

◆ operator=() [2/2]

template<typename T >
WeakPtr< T > & fml::WeakPtr< T >::operator= ( WeakPtr< T > &&  r)
default

◆ reset()

template<typename T >
void fml::WeakPtr< T >::reset ( )
inline

Definition at line 77 of file weak_ptr.h.

77{ flag_ = nullptr; }

Friends And Related Function Documentation

◆ WeakPtr

template<typename T >
template<typename U >
friend class WeakPtr
friend

Definition at line 114 of file weak_ptr.h.

◆ WeakPtrFactory< T >

template<typename T >
friend class WeakPtrFactory< T >
friend

Definition at line 114 of file weak_ptr.h.


The documentation for this class was generated from the following file: