summaryrefslogtreecommitdiffstats
path: root/base/lock.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/lock.cc')
-rw-r--r--base/lock.cc70
1 files changed, 1 insertions, 69 deletions
diff --git a/base/lock.cc b/base/lock.cc
index dc17c47..9ff963b 100644
--- a/base/lock.cc
+++ b/base/lock.cc
@@ -2,74 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Provide place to put profiling methods for the
// Lock class.
-// The Lock class is used everywhere, and hence any changes
-// to lock.h tend to require a complete rebuild. To facilitate
-// profiler development, all the profiling methods are listed
-// here.
-#include "base/lock.h"
-#include "base/logging.h"
-
-#ifndef NDEBUG
-Lock::Lock()
- : lock_(),
- recursion_count_shadow_(0),
- recursion_used_(false),
- acquisition_count_(0),
- contention_count_(0) {
-}
-#else // NDEBUG
-Lock::Lock()
- : lock_() {
-}
-#endif // NDEBUG
-
-Lock::~Lock() {
-}
-
-void Lock::Acquire() {
-#ifdef NDEBUG
- lock_.Lock();
-#else // NDEBUG
- if (!lock_.Try()) {
- // We have contention.
- lock_.Lock();
- contention_count_++;
- }
- // ONLY access data after locking.
- recursion_count_shadow_++;
- acquisition_count_++;
- if (2 == recursion_count_shadow_ && !recursion_used_) {
- recursion_used_ = true;
- // TODO(jar): this is causing failures in ThreadTest.Restart and
- // ChromeThreadTest.Get on Linux.
- // DCHECK(false); // Catch accidental redundant lock acquisition.
- }
-#endif // NDEBUG
-}
-
-void Lock::Release() {
-#ifndef NDEBUG
- --recursion_count_shadow_; // ONLY access while lock is still held.
- DCHECK(0 <= recursion_count_shadow_);
-#endif // NDEBUG
- lock_.Unlock();
-}
-
-bool Lock::Try() {
- if (lock_.Try()) {
-#ifndef NDEBUG
- recursion_count_shadow_++;
- acquisition_count_++;
- if (2 == recursion_count_shadow_ && !recursion_used_) {
- recursion_used_ = true;
- DCHECK(false); // Catch accidental redundant lock acquisition.
- }
-#endif
- return true;
- } else {
- return false;
- }
-}
+// Depricated file. See lock_impl_*.cc for platform specific versions.