#include "base/memory/ref_counted.h"
#include <limits>
#include <ostream>
#include <type_traits>
#include "base/threading/thread_collision_warner.h"
namespace base {
namespace {
#if DCHECK_IS_ON()
std::atomic_int g_cross_thread_ref_count_access_allow_count(0);
#endif
}
namespace subtle {
bool RefCountedThreadSafeBase::HasOneRef() const { … }
bool RefCountedThreadSafeBase::HasAtLeastOneRef() const { … }
#if DCHECK_IS_ON()
RefCountedThreadSafeBase::~RefCountedThreadSafeBase() { … }
#endif
#if defined(ARCH_CPU_64_BITS)
void RefCountedBase::AddRefImpl() const { … }
void RefCountedBase::ReleaseImpl() const { … }
#endif
#if !(defined(ARCH_CPU_X86_FAMILY) || defined(__ARM_FEATURE_ATOMICS))
bool RefCountedThreadSafeBase::Release() const {
return ReleaseImpl();
}
void RefCountedThreadSafeBase::AddRef() const {
AddRefImpl();
}
void RefCountedThreadSafeBase::AddRefWithCheck() const {
AddRefWithCheckImpl();
}
#endif
#if DCHECK_IS_ON()
bool RefCountedBase::CalledOnValidSequence() const { … }
#endif
}
#if DCHECK_IS_ON()
ScopedAllowCrossThreadRefCountAccess::ScopedAllowCrossThreadRefCountAccess() { … }
ScopedAllowCrossThreadRefCountAccess::~ScopedAllowCrossThreadRefCountAccess() { … }
#endif
}