| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ipc/mojo/ipc_channel_mojo.h" | 5 #include "ipc/mojo/ipc_channel_mojo.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 Listener* listener) | 286 Listener* listener) |
| 287 : mode_(mode), | 287 : mode_(mode), |
| 288 listener_(listener), | 288 listener_(listener), |
| 289 peer_pid_(base::kNullProcessId), | 289 peer_pid_(base::kNullProcessId), |
| 290 io_runner_(io_runner), | 290 io_runner_(io_runner), |
| 291 channel_info_(nullptr, ChannelInfoDeleter(nullptr)), | 291 channel_info_(nullptr, ChannelInfoDeleter(nullptr)), |
| 292 weak_factory_(this) { | 292 weak_factory_(this) { |
| 293 // Create MojoBootstrap after all members are set as it touches | 293 // Create MojoBootstrap after all members are set as it touches |
| 294 // ChannelMojo from a different thread. | 294 // ChannelMojo from a different thread. |
| 295 bootstrap_ = MojoBootstrap::Create(handle, mode, this); | 295 bootstrap_ = MojoBootstrap::Create(handle, mode, this); |
| 296 if (io_runner == base::MessageLoop::current()->message_loop_proxy()) { | 296 if (io_runner == base::MessageLoop::current()->task_runner()) { |
| 297 InitOnIOThread(delegate); | 297 InitOnIOThread(delegate); |
| 298 } else { | 298 } else { |
| 299 io_runner->PostTask(FROM_HERE, | 299 io_runner->PostTask(FROM_HERE, |
| 300 base::Bind(&ChannelMojo::InitOnIOThread, | 300 base::Bind(&ChannelMojo::InitOnIOThread, |
| 301 base::Unretained(this), delegate)); | 301 base::Unretained(this), delegate)); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 ChannelMojo::~ChannelMojo() { | 305 ChannelMojo::~ChannelMojo() { |
| 306 Close(); | 306 Close(); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (!ok) { | 552 if (!ok) { |
| 553 LOG(ERROR) << "Failed to add new Mojo handle."; | 553 LOG(ERROR) << "Failed to add new Mojo handle."; |
| 554 return MOJO_RESULT_UNKNOWN; | 554 return MOJO_RESULT_UNKNOWN; |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 | 557 |
| 558 return MOJO_RESULT_OK; | 558 return MOJO_RESULT_OK; |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace IPC | 561 } // namespace IPC |
| OLD | NEW |