| Index: content/child/child_thread.cc
|
| diff --git a/content/child/child_thread.cc b/content/child/child_thread.cc
|
| index b153f044f103e350950e44dad61637e71d4940fa..7e58c1ffd2fd449b193d5829d5de424279f7bd0d 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"
|
| @@ -192,6 +193,17 @@ void QuitMainThreadMessageLoop() {
|
|
|
| } // namespace
|
|
|
| +ChildThread::Options::Options()
|
| + : channel_name(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kProcessChannelID)),
|
| + use_mojo_channel(false) {}
|
| +
|
| +ChildThread::Options::Options(bool mojo)
|
| + : channel_name(CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
| + switches::kProcessChannelID)),
|
| + use_mojo_channel(mojo) {}
|
| +
|
| +
|
| ChildThread::ChildThreadMessageRouter::ChildThreadMessageRouter(
|
| IPC::Sender* sender)
|
| : sender_(sender) {}
|
| @@ -204,20 +216,43 @@ ChildThread::ChildThread()
|
| : router_(this),
|
| channel_connected_factory_(this),
|
| in_browser_process_(false) {
|
| - 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 Options& options)
|
| + : router_(this),
|
| channel_connected_factory_(this),
|
| in_browser_process_(true) {
|
| - Init();
|
| + Init(options);
|
| }
|
|
|
| -void ChildThread::Init() {
|
| +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::CreateFactory(
|
| + channel_name_,
|
| + IPC::Channel::MODE_CLIENT,
|
| + ChildProcess::current()->io_message_loop_proxy()),
|
| + this,
|
| + ChildProcess::current()->io_message_loop_proxy(),
|
| + true,
|
| + ChildProcess::current()->GetShutDownEvent());
|
| + }
|
| +
|
| + 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(const Options& options) {
|
| + channel_name_ = options.channel_name;
|
| +
|
| g_lazy_tls.Pointer()->Set(this);
|
| on_channel_error_called_ = false;
|
| message_loop_ = base::MessageLoop::current();
|
| @@ -227,13 +262,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);
|
|
|