Macro rename s/CS_DEBUG_CHECKS/RTC_CS_DEBUG_CHECKS.
Bug: None
Change-Id: Ie55de3148cb450de8e37d53e810f2a2d590a1f6c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144049
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28466}
diff --git a/rtc_base/critical_section.cc b/rtc_base/critical_section.cc
index db6831f..4a5c53b 100644
--- a/rtc_base/critical_section.cc
+++ b/rtc_base/critical_section.cc
@@ -19,6 +19,12 @@
// TODO(tommi): Split this file up to per-platform implementation files.
+#if RTC_DCHECK_IS_ON
+#define RTC_CS_DEBUG_CODE(x) x
+#else // !RTC_DCHECK_IS_ON
+#define RTC_CS_DEBUG_CODE(x)
+#endif // !RTC_DCHECK_IS_ON
+
namespace rtc {
CriticalSection::CriticalSection() {
@@ -41,8 +47,8 @@
pthread_mutex_init(&mutex_, &mutex_attribute);
pthread_mutexattr_destroy(&mutex_attribute);
#endif
- CS_DEBUG_CODE(thread_ = 0);
- CS_DEBUG_CODE(recursion_count_ = 0);
+ RTC_CS_DEBUG_CODE(thread_ = 0);
+ RTC_CS_DEBUG_CODE(recursion_count_ = 0);
RTC_UNUSED(thread_);
RTC_UNUSED(recursion_count_);
#else
@@ -109,7 +115,7 @@
pthread_mutex_lock(&mutex_);
#endif
-#if CS_DEBUG_CHECKS
+#if RTC_DCHECK_IS_ON
if (!recursion_count_) {
RTC_DCHECK(!thread_);
thread_ = CurrentThreadRef();
@@ -141,7 +147,7 @@
if (pthread_mutex_trylock(&mutex_) != 0)
return false;
#endif
-#if CS_DEBUG_CHECKS
+#if RTC_DCHECK_IS_ON
if (!recursion_count_) {
RTC_DCHECK(!thread_);
thread_ = CurrentThreadRef();
@@ -161,7 +167,7 @@
#if defined(WEBRTC_WIN)
LeaveCriticalSection(&crit_);
#elif defined(WEBRTC_POSIX)
-#if CS_DEBUG_CHECKS
+#if RTC_DCHECK_IS_ON
--recursion_count_;
RTC_DCHECK(recursion_count_ >= 0);
if (!recursion_count_)
@@ -193,11 +199,11 @@
return crit_.OwningThread ==
reinterpret_cast<HANDLE>(static_cast<size_t>(GetCurrentThreadId()));
#elif defined(WEBRTC_POSIX)
-#if CS_DEBUG_CHECKS
+#if RTC_DCHECK_IS_ON
return IsThreadRefEqual(thread_, CurrentThreadRef());
#else
return true;
-#endif // CS_DEBUG_CHECKS
+#endif // RTC_DCHECK_IS_ON
#else
#error Unsupported platform.
#endif
diff --git a/rtc_base/critical_section.h b/rtc_base/critical_section.h
index ddb701f..4433529 100644
--- a/rtc_base/critical_section.h
+++ b/rtc_base/critical_section.h
@@ -40,14 +40,6 @@
#include <dispatch/dispatch.h>
#endif
-#define CS_DEBUG_CHECKS RTC_DCHECK_IS_ON
-
-#if CS_DEBUG_CHECKS
-#define CS_DEBUG_CODE(x) x
-#else // !CS_DEBUG_CHECKS
-#define CS_DEBUG_CODE(x)
-#endif // !CS_DEBUG_CHECKS
-
namespace rtc {
// Locking methods (Enter, TryEnter, Leave)are const to permit protecting