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

Unified Diff: ipc/mojo/ipc_channel_mojo.cc

Issue 1837433002: ChannelMojo: Bind the channel TaskRunner to the right thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.cc
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index db79c1122e34f4b38b6dc796f1159b006f847216..57ec8ec91abd67cefe479963e7d0eb2f968e7cfd 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -223,8 +223,7 @@ scoped_ptr<ChannelFactory> ChannelMojo::CreateClientFactory(
ChannelMojo::ChannelMojo(mojo::ScopedMessagePipeHandle handle,
Mode mode,
Listener* listener)
- : task_runner_(base::ThreadTaskRunnerHandle::Get()),
- pipe_(handle.get()),
+ : pipe_(handle.get()),
listener_(listener),
waiting_connect_(true),
weak_factory_(this) {
@@ -239,6 +238,8 @@ ChannelMojo::~ChannelMojo() {
bool ChannelMojo::Connect() {
base::AutoLock lock(lock_);
+ DCHECK(!task_runner_);
+ task_runner_ = base::ThreadTaskRunnerHandle::Get();
DCHECK(!message_reader_);
bootstrap_->Connect();
return true;
@@ -312,6 +313,7 @@ void ChannelMojo::InitMessageReader(mojom::ChannelAssociatedPtrInfo sender,
}
void ChannelMojo::OnPipeError() {
+ DCHECK(task_runner_);
if (task_runner_->RunsTasksOnCurrentThread()) {
listener_->OnChannelError();
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698