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

Unified Diff: mojo/edk/system/raw_channel.cc

Issue 1549703002: Suppress erronous TSAN errors in new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert change to enable new EDK by default Created 5 years 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 | « mojo/edk/system/message_in_transit.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/raw_channel.cc
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index d0c97fa4203fb7e24667f27f89072d1b6d099a63..34f0c1c7445c94b8673a12ab518124b65b6ec57b 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -202,12 +202,16 @@ void RawChannel::Init(Delegate* delegate) {
}
void RawChannel::EnsureLazyInitialized() {
- if (!initialized_) {
- internal::g_io_thread_task_runner->PostTask(
- FROM_HERE,
- base::Bind(&RawChannel::LockAndCallLazyInitialize,
- weak_ptr_factory_.GetWeakPtr()));
+ {
+ base::AutoLock locker(write_lock_);
+ if (initialized_)
+ return;
}
+
+ internal::g_io_thread_task_runner->PostTask(
+ FROM_HERE,
+ base::Bind(&RawChannel::LockAndCallLazyInitialize,
+ weak_ptr_factory_.GetWeakPtr()));
}
void RawChannel::LockAndCallLazyInitialize() {
@@ -286,11 +290,10 @@ void RawChannel::Shutdown() {
base::AutoLock read_locker(read_lock_);
base::AutoLock locker(write_lock_);
OnShutdownNoLock(std::move(read_buffer_), std::move(write_buffer_));
+ if (initialized_)
+ base::MessageLoop::current()->RemoveDestructionObserver(this);
}
- if (initialized_) {
- base::MessageLoop::current()->RemoveDestructionObserver(this);
- }
delete this;
return;
}
« no previous file with comments | « mojo/edk/system/message_in_transit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698