| Index: content/child/child_thread.cc
|
| diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
|
| index 315224e79d8f212401804d811c7645266e47d4bd..f19eba41e5bd0ed9604f6b2225a416c0aa43980d 100644
|
| --- a/content/child/child_thread.cc
|
| +++ b/content/child/child_thread.cc
|
| @@ -48,6 +48,7 @@
|
| #include "ipc/ipc_switches.h"
|
| #include "ipc/ipc_sync_channel.h"
|
| #include "ipc/ipc_sync_message_filter.h"
|
| +#include "ipc/mojo/ipc_channel_mojo.h"
|
|
|
| #if defined(OS_WIN)
|
| #include "content/common/handle_enumerator_win.h"
|
| @@ -204,20 +205,46 @@ ChildThread::ChildThread()
|
| : router_(this),
|
| channel_connected_factory_(this),
|
| in_browser_process_(false) {
|
| - channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + InitOptions options;
|
| + options.channel_name = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| switches::kProcessChannelID);
|
| - Init();
|
| + Init(options);
|
| }
|
|
|
| -ChildThread::ChildThread(const std::string& channel_name)
|
| - : channel_name_(channel_name),
|
| - router_(this),
|
| +ChildThread::ChildThread(const InitOptions& options)
|
| + : router_(this),
|
| channel_connected_factory_(this),
|
| in_browser_process_(true) {
|
| - Init();
|
| + Init(options);
|
| +}
|
| +
|
| +scoped_ptr<IPC::SyncChannel> ChildThread::CreateChannel(bool use_mojo_channel) {
|
| + if (use_mojo_channel) {
|
| + VLOG(1) << "Mojo is enabled on child";
|
| + return IPC::SyncChannel::Create(
|
| + IPC::ChannelMojo::CreateBuilder(
|
| + channel_name_,
|
| + IPC::Channel::MODE_CLIENT,
|
| + ChildProcess::current()->io_message_loop_proxy()),
|
| + this,
|
| + ChildProcess::current()->io_message_loop_proxy(),
|
| + true,
|
| + ChildProcess::current()->GetShutDownEvent());
|
| + } else {
|
| + VLOG(1) << "Mojo is disabled on child";
|
| + return IPC::SyncChannel::Create(
|
| + channel_name_,
|
| + IPC::Channel::MODE_CLIENT,
|
| + this,
|
| + ChildProcess::current()->io_message_loop_proxy(),
|
| + true,
|
| + ChildProcess::current()->GetShutDownEvent());
|
| + }
|
| }
|
|
|
| -void ChildThread::Init() {
|
| +void ChildThread::Init(const InitOptions& options) {
|
| + channel_name_ = options.channel_name;
|
| +
|
| g_lazy_tls.Pointer()->Set(this);
|
| on_channel_error_called_ = false;
|
| message_loop_ = base::MessageLoop::current();
|
| @@ -227,13 +254,7 @@ void ChildThread::Init() {
|
| // the logger, and the logger does not like being created on the IO thread.
|
| IPC::Logging::GetInstance();
|
| #endif
|
| - channel_ =
|
| - IPC::SyncChannel::Create(channel_name_,
|
| - IPC::Channel::MODE_CLIENT,
|
| - this,
|
| - ChildProcess::current()->io_message_loop_proxy(),
|
| - true,
|
| - ChildProcess::current()->GetShutDownEvent());
|
| + channel_ = CreateChannel(options.use_mojo_channel);
|
| #ifdef IPC_MESSAGE_LOG_ENABLED
|
| if (!in_browser_process_)
|
| IPC::Logging::GetInstance()->SetIPCSender(this);
|
|
|