Chromium Embedded Framework (CEF)
114.2.1+gd70a0a8+chromium-114.0.5735.45
|
The WeakPtr class holds a weak reference to |T*|. More...
#include "include/base/cef_weak_ptr.h"
Public Member Functions | |
WeakPtr ()=default | |
WeakPtr (std::nullptr_t) | |
template<typename U > | |
WeakPtr (const WeakPtr< U > &other) | |
Allow conversion from U to T provided U "is a" T. More... | |
template<typename U > | |
WeakPtr (WeakPtr< U > &&other) noexcept | |
T * | get () const |
T & | operator* () const |
T * | operator-> () const |
operator bool () const | |
Allow conditionals to test validity, e.g. More... | |
bool | MaybeValid () const |
Returns false if the WeakPtr is confirmed to be invalid. More... | |
bool | WasInvalidated () const |
Returns whether the object |this| points to has been invalidated. More... | |
Public Member Functions inherited from base::cef_internal::WeakPtrBase | |
WeakPtrBase () | |
~WeakPtrBase () | |
WeakPtrBase (const WeakPtrBase &other)=default | |
WeakPtrBase (WeakPtrBase &&other) noexcept=default | |
WeakPtrBase & | operator= (const WeakPtrBase &other)=default |
WeakPtrBase & | operator= (WeakPtrBase &&other) noexcept=default |
void | reset () |
Friends | |
class | cef_internal::SupportsWeakPtrBase |
template<typename U > | |
class | WeakPtr |
class | SupportsWeakPtr< T > |
class | WeakPtrFactory< T > |
Additional Inherited Members | |
Protected Member Functions inherited from base::cef_internal::WeakPtrBase | |
WeakPtrBase (const WeakReference &ref, uintptr_t ptr) | |
Protected Attributes inherited from base::cef_internal::WeakPtrBase | |
WeakReference | ref_ |
uintptr_t | ptr_ |
The WeakPtr class holds a weak reference to |T*|.
This class is designed to be used like a normal pointer. You should always null-test an object of this class before using it or invoking a method that may result in the underlying object being destroyed.
EXAMPLE:
class Foo { ... }; WeakPtr<Foo> foo; if (foo) foo->method();
|
default |
|
inline |
|
inline |
Allow conversion from U to T provided U "is a" T.
Note that this is separate from the (implicit) copy and move constructors.
|
inlinenoexcept |
|
inline |
|
inline |
Returns false if the WeakPtr is confirmed to be invalid.
This call is safe to make from any thread, e.g. to optimize away unnecessary work, but operator bool() must always be called, on the correct thread, before actually using the pointer.
Warning: as with any object, this call is only thread-safe if the WeakPtr instance isn't being re-assigned or reset() racily with this call.
|
inlineexplicit |
Allow conditionals to test validity, e.g.
if (weak_ptr) {...}
;
|
inline |
|
inline |
|
inline |
Returns whether the object |this| points to has been invalidated.
This can be used to distinguish a WeakPtr to a destroyed object from one that has been explicitly set to null.
|
friend |
|
friend |
|
friend |