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

Unified Diff: base/lock.cc

Issue 7660: Move windows specific lock-recursion-counter into windows impl file... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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/lock.h ('k') | base/lock_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/lock.cc
===================================================================
--- base/lock.cc (revision 3595)
+++ base/lock.cc (working copy)
@@ -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.
cpu_(ooo_6.6-7.5) 2008/10/21 22:41:23 Deprecated?
« no previous file with comments | « base/lock.h ('k') | base/lock_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698