Chromium Code Reviews| 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()); |
|
piman
2014/05/21 00:55:24
nit: DCHECK_EQ
hubbe
2014/05/21 04:27:35
DCHECK_EQ requires the values to be printable, Thr
|
| } |
| 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()); |
|
piman
2014/05/21 00:55:24
nit: DCHECK_EQ
hubbe
2014/05/21 04:27:35
See above.
|
| + 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 |