summaryrefslogtreecommitdiffstats
path: root/base/lock_impl.h
diff options
context:
space:
mode:
authorrdsmith@google.com <rdsmith@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-13 12:45:33 +0000
committerrdsmith@google.com <rdsmith@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-13 12:45:33 +0000
commitb36f2e4174e9cd104d33c027042db0028e55500a (patch)
tree27a8d86d25af2f3f49e29480f287023828053808 /base/lock_impl.h
parent1dd0f46d242ac273cd7ff138b9311384c60c1464 (diff)
downloadchromium_src-b36f2e4174e9cd104d33c027042db0028e55500a.zip
chromium_src-b36f2e4174e9cd104d33c027042db0028e55500a.tar.gz
chromium_src-b36f2e4174e9cd104d33c027042db0028e55500a.tar.bz2
Revert 49648 - Initial implementation of new AssertAcquired() functionality for Posix.
Webkit compile failing. BUG=44091 TEST=Try bot run on Windows, Linux, Mac. Will land during low traffic time and revert on any problems or perf degradation. Review URL: http://codereview.chromium.org/2196001 TBR=rdsmith@google.com Review URL: http://codereview.chromium.org/2805001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lock_impl.h')
-rw-r--r--base/lock_impl.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/base/lock_impl.h b/base/lock_impl.h
index 5e323a6..2d4a921 100644
--- a/base/lock_impl.h
+++ b/base/lock_impl.h
@@ -41,6 +41,17 @@ class LockImpl {
// a successful call to Try, or a call to Lock.
void Unlock();
+ // Debug-only method that will DCHECK() if the lock is not acquired by the
+ // current thread. In non-debug builds, no check is performed.
+ // Because linux and mac condition variables modify the underlyning lock
+ // through the os_lock() method, runtime assertions can not be done on those
+ // builds.
+#if defined(NDEBUG) || !defined(OS_WIN)
+ void AssertAcquired() const {}
+#else
+ void AssertAcquired() const;
+#endif
+
// Return the native underlying lock. Not supported for Windows builds.
// TODO(awalker): refactor lock and condition variables so that this is
// unnecessary.
@@ -51,6 +62,14 @@ class LockImpl {
private:
OSLockType os_lock_;
+#if !defined(NDEBUG) && defined(OS_WIN)
+ // All private data is implicitly protected by lock_.
+ // Be VERY careful to only access members under that lock.
+ PlatformThreadId owning_thread_id_;
+ int32 recursion_count_shadow_;
+ bool recursion_used_; // Allow debugging to continued after a DCHECK().
+#endif // NDEBUG
+
DISALLOW_COPY_AND_ASSIGN(LockImpl);
};