|
|
|
@ -93,9 +93,9 @@ class DualRefCounted : public Impl { |
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " unref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs - 1 << ", weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " unref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs - 1 << ", weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1; |
|
|
|
|
} |
|
|
|
|
CHECK_GT(strong_refs, 0u); |
|
|
|
|
#endif |
|
|
|
@ -112,10 +112,10 @@ class DualRefCounted : public Impl { |
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " unref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs - 1 << ", weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << ") " << reason; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " unref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs - 1 << ", weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << ") " << reason; |
|
|
|
|
} |
|
|
|
|
CHECK_GT(strong_refs, 0u); |
|
|
|
|
#else |
|
|
|
@ -137,9 +137,9 @@ class DualRefCounted : public Impl { |
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " ref_if_non_zero " << strong_refs |
|
|
|
|
<< " -> " << strong_refs + 1 << " (weak_refs=" << weak_refs |
|
|
|
|
<< ")"; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " ref_if_non_zero " << strong_refs |
|
|
|
|
<< " -> " << strong_refs + 1 << " (weak_refs=" << weak_refs |
|
|
|
|
<< ")"; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if (strong_refs == 0) return nullptr; |
|
|
|
@ -156,10 +156,10 @@ class DualRefCounted : public Impl { |
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " ref_if_non_zero " << strong_refs |
|
|
|
|
<< " -> " << strong_refs + 1 << " (weak_refs=" << weak_refs |
|
|
|
|
<< ") " << reason; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " ref_if_non_zero " << strong_refs |
|
|
|
|
<< " -> " << strong_refs + 1 << " (weak_refs=" << weak_refs |
|
|
|
|
<< ") " << reason; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
// Avoid unused-parameter warnings for debug-only parameters
|
|
|
|
@ -214,8 +214,8 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
const uint32_t strong_refs = GetStrongRefs(prev_ref_pair); |
|
|
|
|
if (trace != nullptr) { |
|
|
|
|
LOG(INFO) << trace << ":" << this << " weak_unref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs - 1 << " (refs=" << strong_refs << ")"; |
|
|
|
|
VLOG(2) << trace << ":" << this << " weak_unref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs - 1 << " (refs=" << strong_refs << ")"; |
|
|
|
|
} |
|
|
|
|
CHECK_GT(weak_refs, 0u); |
|
|
|
|
#endif |
|
|
|
@ -236,9 +236,9 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
const uint32_t strong_refs = GetStrongRefs(prev_ref_pair); |
|
|
|
|
if (trace != nullptr) { |
|
|
|
|
LOG(INFO) << trace << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " weak_unref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs - 1 << " (refs=" << strong_refs << ") " << reason; |
|
|
|
|
VLOG(2) << trace << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " weak_unref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs - 1 << " (refs=" << strong_refs << ") " << reason; |
|
|
|
|
} |
|
|
|
|
CHECK_GT(weak_refs, 0u); |
|
|
|
|
#else |
|
|
|
@ -301,8 +301,8 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
CHECK_NE(strong_refs, 0u); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " ref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs + 1 << "; (weak_refs=" << weak_refs << ")"; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " ref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs + 1 << "; (weak_refs=" << weak_refs << ")"; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
refs_.fetch_add(MakeRefPair(1, 0), std::memory_order_relaxed); |
|
|
|
@ -316,10 +316,10 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
CHECK_NE(strong_refs, 0u); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " ref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs + 1 << " (weak_refs=" << weak_refs << ") " |
|
|
|
|
<< reason; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " ref " << strong_refs << " -> " |
|
|
|
|
<< strong_refs + 1 << " (weak_refs=" << weak_refs << ") " |
|
|
|
|
<< reason; |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
// Use conditionally-important parameters
|
|
|
|
@ -336,8 +336,8 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t strong_refs = GetStrongRefs(prev_ref_pair); |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << "; (refs=" << strong_refs << ")"; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << "; (refs=" << strong_refs << ")"; |
|
|
|
|
} |
|
|
|
|
if (strong_refs == 0) CHECK_NE(weak_refs, 0u); |
|
|
|
|
#else |
|
|
|
@ -352,9 +352,9 @@ class DualRefCounted : public Impl { |
|
|
|
|
const uint32_t strong_refs = GetStrongRefs(prev_ref_pair); |
|
|
|
|
const uint32_t weak_refs = GetWeakRefs(prev_ref_pair); |
|
|
|
|
if (trace_ != nullptr) { |
|
|
|
|
LOG(INFO) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << " (refs=" << strong_refs << ") " << reason; |
|
|
|
|
VLOG(2) << trace_ << ":" << this << " " << location.file() << ":" |
|
|
|
|
<< location.line() << " weak_ref " << weak_refs << " -> " |
|
|
|
|
<< weak_refs + 1 << " (refs=" << strong_refs << ") " << reason; |
|
|
|
|
} |
|
|
|
|
if (strong_refs == 0) CHECK_NE(weak_refs, 0u); |
|
|
|
|
#else |
|
|
|
|