Index: synchronization/condition_variable_posix.cc |
diff --git a/synchronization/condition_variable_posix.cc b/synchronization/condition_variable_posix.cc |
index c9a2ec43f829e7fdbb73351e8739ad5e699150eb..03f81845dcfc825657d84f63ea09fef2f71d04f5 100644 |
--- a/synchronization/condition_variable_posix.cc |
+++ b/synchronization/condition_variable_posix.cc |
@@ -7,7 +7,6 @@ |
#include <errno.h> |
#include <sys/time.h> |
-#include "base/logging.h" |
#include "base/synchronization/lock.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/time/time.h" |
@@ -16,8 +15,9 @@ namespace base { |
ConditionVariable::ConditionVariable(Lock* user_lock) |
: user_mutex_(user_lock->lock_.native_handle()) |
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
- , user_lock_(user_lock) |
+#if DCHECK_IS_ON() |
+ , |
+ user_lock_(user_lock) |
#endif |
{ |
int rv = 0; |
@@ -62,12 +62,12 @@ ConditionVariable::~ConditionVariable() { |
void ConditionVariable::Wait() { |
base::ThreadRestrictions::AssertWaitAllowed(); |
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
+#if DCHECK_IS_ON() |
user_lock_->CheckHeldAndUnmark(); |
#endif |
int rv = pthread_cond_wait(&condition_, user_mutex_); |
DCHECK_EQ(0, rv); |
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
+#if DCHECK_IS_ON() |
user_lock_->CheckUnheldAndMark(); |
#endif |
} |
@@ -80,7 +80,7 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { |
relative_time.tv_nsec = |
(usecs % Time::kMicrosecondsPerSecond) * Time::kNanosecondsPerMicrosecond; |
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
+#if DCHECK_IS_ON() |
user_lock_->CheckHeldAndUnmark(); |
#endif |
@@ -118,7 +118,7 @@ void ConditionVariable::TimedWait(const TimeDelta& max_time) { |
#endif // OS_MACOSX |
DCHECK(rv == 0 || rv == ETIMEDOUT); |
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
+#if DCHECK_IS_ON() |
user_lock_->CheckUnheldAndMark(); |
#endif |
} |