Use DCHECK_IS_ON() instead of !NDEBUG for debug logic (issue #1961)

This commit is contained in:
Marshall Greenblatt
2016-09-01 14:24:30 +03:00
parent ad1619dbd7
commit 5068b50b48
278 changed files with 320 additions and 525 deletions

View File

@ -50,9 +50,7 @@
#include "include/base/cef_atomic_ref_count.h"
#include "include/base/cef_build.h"
#ifndef NDEBUG
#include "include/base/cef_logging.h"
#endif
#include "include/base/cef_thread_collision_warner.h"
namespace base {
@ -66,14 +64,14 @@ class RefCountedBase {
protected:
RefCountedBase()
: ref_count_(0)
#ifndef NDEBUG
#if DCHECK_IS_ON()
, in_dtor_(false)
#endif
{
}
~RefCountedBase() {
#ifndef NDEBUG
#if DCHECK_IS_ON()
DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()";
#endif
}
@ -84,7 +82,7 @@ class RefCountedBase {
// Current thread books the critical section "AddRelease"
// without release it.
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
#ifndef NDEBUG
#if DCHECK_IS_ON()
DCHECK(!in_dtor_);
#endif
++ref_count_;
@ -96,11 +94,11 @@ class RefCountedBase {
// Current thread books the critical section "AddRelease"
// without release it.
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
#ifndef NDEBUG
#if DCHECK_IS_ON()
DCHECK(!in_dtor_);
#endif
if (--ref_count_ == 0) {
#ifndef NDEBUG
#if DCHECK_IS_ON()
in_dtor_ = true;
#endif
return true;
@ -110,7 +108,7 @@ class RefCountedBase {
private:
mutable int ref_count_;
#ifndef NDEBUG
#if DCHECK_IS_ON()
mutable bool in_dtor_;
#endif
@ -134,7 +132,7 @@ class RefCountedThreadSafeBase {
private:
mutable AtomicRefCount ref_count_;
#ifndef NDEBUG
#if DCHECK_IS_ON()
mutable bool in_dtor_;
#endif