8#ifndef SkWeakRefCnt_DEFINED
9#define SkWeakRefCnt_DEFINED
69 fWeakCnt.store(0, std::memory_order_relaxed);
75 int32_t getWeakCnt()
const {
76 return fWeakCnt.load(std::memory_order_relaxed);
84 int32_t atomic_conditional_acquire_strong_ref()
const {
85 int32_t
prev = fRefCnt.load(std::memory_order_relaxed);
90 }
while(!fRefCnt.compare_exchange_weak(
prev,
prev+1, std::memory_order_acquire,
91 std::memory_order_relaxed));
104 if (atomic_conditional_acquire_strong_ref() != 0) {
119 (void)fWeakCnt.fetch_add(+1, std::memory_order_relaxed);
130 if (1 == fWeakCnt.fetch_add(-1, std::memory_order_acq_rel)) {
135 fWeakCnt.store(1, std::memory_order_relaxed);
137 this->INHERITED::internal_dispose();
145 return fRefCnt.load(std::memory_order_relaxed) == 0;
168 mutable std::atomic<int32_t> fWeakCnt;
static float prev(float f)
#define INHERITED(method,...)
virtual void internal_dispose() const
bool weak_expired() const
virtual void weak_dispose() const