Commit c3ab543b authored by Hajime Morrita's avatar Hajime Morrita

IPC Fuzzer: Enable ChannelMojo if it should be enabled.

Now Chrome start using ChannelMojo. The ipc_fuzzer has to
follow the move.

R=tsepez@chromium.org, inferno@chromium.org
BUG=453571

Review URL: https://codereview.chromium.org/875513007

Cr-Commit-Position: refs/heads/master@{#313962}
parent 3d1eef54
include_rules = [
"+chrome/common",
"+content/public/common",
]
......@@ -12,6 +12,7 @@
'type': 'executable',
'dependencies': [
'../message_lib/message_lib.gyp:ipc_message_lib',
'../../../ipc/mojo/ipc_mojo.gyp:ipc_mojo'
],
'sources': [
'replay.cc',
......
......@@ -12,8 +12,10 @@
#include "base/logging.h"
#include "base/posix/global_descriptors.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/common/content_switches.h"
#include "ipc/ipc_descriptors.h"
#include "ipc/ipc_switches.h"
#include "ipc/mojo/ipc_channel_mojo.h"
namespace ipc_fuzzer {
......@@ -66,10 +68,22 @@ void ReplayProcess::OpenChannel() {
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessChannelID);
channel_ = IPC::ChannelProxy::Create(channel_name,
IPC::Channel::MODE_CLIENT,
this,
io_thread_.message_loop_proxy());
// TODO(morrita): As the adoption of ChannelMojo spreads, this
// criteria has to be updated.
std::string process_type =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType);
bool should_use_mojo = process_type == switches::kRendererProcess &&
IPC::ChannelMojo::ShouldBeUsed();
if (should_use_mojo) {
channel_ = IPC::ChannelProxy::Create(
IPC::ChannelMojo::CreateClientFactory(channel_name), this,
io_thread_.message_loop_proxy());
} else {
channel_ =
IPC::ChannelProxy::Create(channel_name, IPC::Channel::MODE_CLIENT, this,
io_thread_.message_loop_proxy());
}
}
bool ReplayProcess::OpenTestcase() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment