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

Unified Diff: base/synchronization/lock.cc

Issue 292873002: make debug mode ~20% faster on linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment updated Created 6 years, 7 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/lock.h ('k') | base/threading/platform_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/synchronization/lock.cc
diff --git a/base/synchronization/lock.cc b/base/synchronization/lock.cc
index 49efbe926517342f079959386c2103295ddda0f9..7c7ee9dc5a966f30229f1ed198ef2f5b7e9dd510 100644
--- a/base/synchronization/lock.cc
+++ b/base/synchronization/lock.cc
@@ -13,34 +13,25 @@
namespace base {
-const PlatformThreadId kNoThreadId = static_cast<PlatformThreadId>(0);
-
Lock::Lock() : lock_() {
- owned_by_thread_ = false;
- owning_thread_id_ = kNoThreadId;
}
Lock::~Lock() {
- DCHECK(!owned_by_thread_);
- DCHECK_EQ(kNoThreadId, owning_thread_id_);
+ DCHECK(owning_thread_ref_.is_null());
}
void Lock::AssertAcquired() const {
- DCHECK(owned_by_thread_);
- DCHECK_EQ(owning_thread_id_, PlatformThread::CurrentId());
+ DCHECK(owning_thread_ref_ == PlatformThread::CurrentRef());
}
void Lock::CheckHeldAndUnmark() {
- DCHECK(owned_by_thread_);
- DCHECK_EQ(owning_thread_id_, PlatformThread::CurrentId());
- owned_by_thread_ = false;
- owning_thread_id_ = kNoThreadId;
+ DCHECK(owning_thread_ref_ == PlatformThread::CurrentRef());
+ owning_thread_ref_ = PlatformThreadRef();
}
void Lock::CheckUnheldAndMark() {
- DCHECK(!owned_by_thread_);
- owned_by_thread_ = true;
- owning_thread_id_ = PlatformThread::CurrentId();
+ DCHECK(owning_thread_ref_.is_null());
+ owning_thread_ref_ = PlatformThread::CurrentRef();
}
} // namespace base
« no previous file with comments | « base/synchronization/lock.h ('k') | base/threading/platform_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698