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

Unified Diff: base/message_loop/message_loop.cc

Issue 2235283002: Fix incorrect memory barrier usage I previously asked to be introduced. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/message_loop/message_loop.h ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_loop.cc
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc
index 93b9d0a2ec44bcc64567d197996faad652a242ff..f22eb9845a1a37bf51b3b163567474d35c314f9d 100644
--- a/base/message_loop/message_loop.cc
+++ b/base/message_loop/message_loop.cc
@@ -418,21 +418,13 @@ void MessageLoop::BindToCurrentThread() {
unbound_task_runner_->BindToCurrentThread();
unbound_task_runner_ = nullptr;
SetThreadTaskRunnerHandle();
- {
- // Save the current thread's ID for potential use by other threads
- // later from GetThreadName().
- thread_id_ = PlatformThread::CurrentId();
- subtle::MemoryBarrier();
- }
+ thread_id_ = PlatformThread::CurrentId();
}
std::string MessageLoop::GetThreadName() const {
- if (thread_id_ == kInvalidThreadId) {
- // |thread_id_| may already have been initialized but this thread might not
- // have received the update yet.
- subtle::MemoryBarrier();
- DCHECK_NE(kInvalidThreadId, thread_id_);
- }
+ DCHECK_NE(kInvalidThreadId, thread_id_)
+ << "GetThreadName() must only be called after BindToCurrentThread()'s "
+ << "side-effects have been synchronized with this thread.";
return ThreadIdNameManager::GetInstance()->GetName(thread_id_);
}
« no previous file with comments | « base/message_loop/message_loop.h ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698