Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: base/synchronization/lock.h

Issue 403803004: base: Enable lock dchecks with dchecks_always_on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix condition variable too Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/synchronization/condition_variable_win.cc ('k') | base/synchronization/lock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/lock.h
diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h
index 9c0d062a900bfc3bf4a33417b8a2c02cdf44236f..f384e4147281b1d245676f4a3f03db60e631ce5a 100644
--- a/base/synchronization/lock.h
+++ b/base/synchronization/lock.h
@@ -16,7 +16,8 @@ namespace base {
// AssertAcquired() method.
class BASE_EXPORT Lock {
public:
-#if defined(NDEBUG) // Optimized wrapper implementation
+#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
+ // Optimized wrapper implementation
Lock() : lock_() {}
~Lock() {}
void Acquire() { lock_.Lock(); }
@@ -55,7 +56,7 @@ class BASE_EXPORT Lock {
}
void AssertAcquired() const;
-#endif // NDEBUG
+#endif // NDEBUG && !DCHECK_ALWAYS_ON
#if defined(OS_POSIX)
// The posix implementation of ConditionVariable needs to be able
@@ -69,7 +70,7 @@ class BASE_EXPORT Lock {
#endif
private:
-#if !defined(NDEBUG)
+#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
// Members and routines taking care of locks assertions.
// Note that this checks for recursive locks and allows them
// if the variable is set. This is allowed by the underlying implementation
@@ -81,7 +82,7 @@ class BASE_EXPORT Lock {
// All private data is implicitly protected by lock_.
// Be VERY careful to only access members under that lock.
base::PlatformThreadRef owning_thread_ref_;
-#endif // NDEBUG
+#endif // !NDEBUG || DCHECK_ALWAYS_ON
// Platform specific underlying lock implementation.
internal::LockImpl lock_;
« no previous file with comments | « base/synchronization/condition_variable_win.cc ('k') | base/synchronization/lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698