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

Unified Diff: base/threading/thread_checker_impl.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/threading/thread_checker_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_checker_impl.cc
diff --git a/base/threading/thread_checker_impl.cc b/base/threading/thread_checker_impl.cc
index 985433e5f1154a5e11bc18b58d70e1a89aa00d40..eb87bae772cbbf9be35ccddad88ed886b1b1052a 100644
--- a/base/threading/thread_checker_impl.cc
+++ b/base/threading/thread_checker_impl.cc
@@ -7,7 +7,7 @@
namespace base {
ThreadCheckerImpl::ThreadCheckerImpl()
- : valid_thread_id_(kInvalidThreadId) {
+ : valid_thread_id_() {
EnsureThreadIdAssigned();
}
@@ -16,19 +16,19 @@ ThreadCheckerImpl::~ThreadCheckerImpl() {}
bool ThreadCheckerImpl::CalledOnValidThread() const {
EnsureThreadIdAssigned();
AutoLock auto_lock(lock_);
- return valid_thread_id_ == PlatformThread::CurrentId();
+ return valid_thread_id_ == PlatformThread::CurrentRef();
}
void ThreadCheckerImpl::DetachFromThread() {
AutoLock auto_lock(lock_);
- valid_thread_id_ = kInvalidThreadId;
+ valid_thread_id_ = PlatformThreadRef();
}
void ThreadCheckerImpl::EnsureThreadIdAssigned() const {
AutoLock auto_lock(lock_);
- if (valid_thread_id_ != kInvalidThreadId)
- return;
- valid_thread_id_ = PlatformThread::CurrentId();
+ if (valid_thread_id_.is_null()) {
+ valid_thread_id_ = PlatformThread::CurrentRef();
+ }
}
} // namespace base
« no previous file with comments | « base/threading/thread_checker_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698