#include <ref_counted_internal.h>
Definition at line 19 of file ref_counted_internal.h.
◆ RefCountedThreadSafeBase()
fml::internal::RefCountedThreadSafeBase::RefCountedThreadSafeBase |
( |
| ) |
|
|
inlineprotected |
Definition at line 86 of file ref_counted_internal.h.
87 : ref_count_(1u)
88#ifndef NDEBUG
89 ,
90 adoption_required_(true)
91#endif
92{
93}
◆ ~RefCountedThreadSafeBase()
fml::internal::RefCountedThreadSafeBase::~RefCountedThreadSafeBase |
( |
| ) |
|
|
inlineprotected |
Definition at line 95 of file ref_counted_internal.h.
95 {
96#ifndef NDEBUG
98
100#endif
101}
#define FML_DCHECK(condition)
◆ AddRef()
void fml::internal::RefCountedThreadSafeBase::AddRef |
( |
| ) |
const |
|
inline |
Definition at line 21 of file ref_counted_internal.h.
21 {
22#ifndef NDEBUG
25#endif
26 ref_count_.fetch_add(1u, std::memory_order_relaxed);
27 }
◆ Adopt()
void fml::internal::RefCountedThreadSafeBase::Adopt |
( |
| ) |
|
|
inlineprotected |
◆ AssertHasOneRef()
void fml::internal::RefCountedThreadSafeBase::AssertHasOneRef |
( |
| ) |
const |
|
inline |
◆ HasOneRef()
bool fml::internal::RefCountedThreadSafeBase::HasOneRef |
( |
| ) |
const |
|
inline |
Definition at line 29 of file ref_counted_internal.h.
29 {
30 return ref_count_.load(std::memory_order_acquire) == 1u;
31 }
◆ Release()
bool fml::internal::RefCountedThreadSafeBase::Release |
( |
| ) |
const |
|
inlineprotected |
Definition at line 40 of file ref_counted_internal.h.
40 {
41#ifndef NDEBUG
44#endif
45 FML_DCHECK(ref_count_.load(std::memory_order_acquire) != 0u);
46
47
48
49
50
51
52
53
54
55
56
57
58 if (ref_count_.fetch_sub(1u, std::memory_order_release) == 1u) {
59 std::atomic_thread_fence(std::memory_order_acquire);
60#ifndef NDEBUG
61 destruction_started_ = true;
62#endif
63 return true;
64 }
65 return false;
66 }
The documentation for this class was generated from the following file: