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

Unified Diff: third_party/mojo/src/mojo/edk/embedder/channel_init.cc

Issue 877993004: Revert "Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: third_party/mojo/src/mojo/edk/embedder/channel_init.cc
diff --git a/third_party/mojo/src/mojo/edk/embedder/channel_init.cc b/third_party/mojo/src/mojo/edk/embedder/channel_init.cc
index 0b6d76c54f67d05628990318388caed748fe2018..9a0bfce6256bf72e2cd2fb1c9e36a9bf82306a78 100644
--- a/third_party/mojo/src/mojo/edk/embedder/channel_init.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/channel_init.cc
@@ -15,9 +15,6 @@ ChannelInit::ChannelInit() : channel_info_(nullptr), weak_factory_(this) {
}
ChannelInit::~ChannelInit() {
- // TODO(vtl): This is likely leaky in common scenarios (we're on the main
- // thread, which outlives the I/O thread, and we're destroyed after the I/O
- // thread is destroyed.
if (channel_info_)
DestroyChannel(channel_info_);
}
@@ -25,12 +22,14 @@ ChannelInit::~ChannelInit() {
ScopedMessagePipeHandle ChannelInit::Init(
base::PlatformFile file,
scoped_refptr<base::TaskRunner> io_thread_task_runner) {
+ DCHECK(!io_thread_task_runner_); // Should only init once.
+ io_thread_task_runner_ = io_thread_task_runner;
ScopedMessagePipeHandle message_pipe =
- CreateChannel(ScopedPlatformHandle(PlatformHandle(file)),
- io_thread_task_runner,
- base::Bind(&ChannelInit::OnCreatedChannel,
- weak_factory_.GetWeakPtr()),
- base::MessageLoop::current()->task_runner()).Pass();
+ CreateChannel(
+ ScopedPlatformHandle(PlatformHandle(file)), io_thread_task_runner,
+ base::Bind(&ChannelInit::OnCreatedChannel, weak_factory_.GetWeakPtr(),
+ io_thread_task_runner),
+ base::MessageLoop::current()->message_loop_proxy()).Pass();
return message_pipe.Pass();
}
@@ -41,6 +40,7 @@ void ChannelInit::WillDestroySoon() {
// static
void ChannelInit::OnCreatedChannel(base::WeakPtr<ChannelInit> self,
+ scoped_refptr<base::TaskRunner> io_thread,
ChannelInfo* channel) {
// If |self| was already destroyed, shut the channel down.
if (!self) {
@@ -48,7 +48,6 @@ void ChannelInit::OnCreatedChannel(base::WeakPtr<ChannelInit> self,
return;
}
- DCHECK(!self->channel_info_);
self->channel_info_ = channel;
}
« no previous file with comments | « third_party/mojo/src/mojo/edk/embedder/channel_init.h ('k') | third_party/mojo/src/mojo/edk/embedder/embedder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698