| Index: base/memory/ref_counted.cc
|
| diff --git a/base/memory/ref_counted.cc b/base/memory/ref_counted.cc
|
| index f5924d0fe76e44672ca24372f93b40d418f46b62..cd6181b147349e46c4a86b7487e952d4725d1f91 100644
|
| --- a/base/memory/ref_counted.cc
|
| +++ b/base/memory/ref_counted.cc
|
| @@ -15,32 +15,32 @@ bool RefCountedThreadSafeBase::HasOneRef() const {
|
| }
|
|
|
| RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(0) {
|
| -#ifndef NDEBUG
|
| +#if DCHECK_IS_ON()
|
| in_dtor_ = false;
|
| #endif
|
| }
|
|
|
| RefCountedThreadSafeBase::~RefCountedThreadSafeBase() {
|
| -#ifndef NDEBUG
|
| +#if DCHECK_IS_ON()
|
| DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without "
|
| "calling Release()";
|
| #endif
|
| }
|
|
|
| void RefCountedThreadSafeBase::AddRef() const {
|
| -#ifndef NDEBUG
|
| +#if DCHECK_IS_ON()
|
| DCHECK(!in_dtor_);
|
| #endif
|
| AtomicRefCountInc(&ref_count_);
|
| }
|
|
|
| bool RefCountedThreadSafeBase::Release() const {
|
| -#ifndef NDEBUG
|
| +#if DCHECK_IS_ON()
|
| DCHECK(!in_dtor_);
|
| DCHECK(!AtomicRefCountIsZero(&ref_count_));
|
| #endif
|
| if (!AtomicRefCountDec(&ref_count_)) {
|
| -#ifndef NDEBUG
|
| +#if DCHECK_IS_ON()
|
| in_dtor_ = true;
|
| #endif
|
| return true;
|
|
|