Add ipc_mojo_perftests
This change adds ipc_mojo_perftests that runs the same benchmark
as of ipc_perftests. Now head-to-head comparison becomes possible.
For this change, whole ipc_perftests logic is extracted to
ipc_perftest_support.cc to make it reusable by ipc_mojo_perftests.
TEST=none
BUG=none
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/536213002
Cr-Commit-Position: refs/heads/master@{#293988}
diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc
index 80ddd2d..6abef0f14 100644
--- a/ipc/ipc_test_base.cc
+++ b/ipc/ipc_test_base.cc
@@ -52,8 +52,8 @@
}
void IPCTestBase::CreateChannel(IPC::Listener* listener) {
- return CreateChannelFromChannelHandle(GetChannelName(test_client_name_),
- listener);
+ CreateChannelFromChannelHandle(
+ GetChannelName(test_client_name_), listener);
}
bool IPCTestBase::ConnectChannel() {
@@ -80,7 +80,8 @@
IPC::Listener* listener) {
CHECK(!channel_.get());
CHECK(!channel_proxy_.get());
- channel_ = IPC::Channel::CreateServer(channel_handle, listener);
+ channel_ = CreateChannelFactory(
+ channel_handle, task_runner().get())->BuildChannel(listener);
}
void IPCTestBase::CreateChannelProxy(
@@ -88,10 +89,11 @@
const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
CHECK(!channel_.get());
CHECK(!channel_proxy_.get());
- channel_proxy_ = IPC::ChannelProxy::Create(GetChannelName(test_client_name_),
- IPC::Channel::MODE_SERVER,
- listener,
- ipc_task_runner);
+ channel_proxy_ = IPC::ChannelProxy::Create(
+ CreateChannelFactory(GetChannelName(test_client_name_),
+ ipc_task_runner.get()),
+ listener,
+ ipc_task_runner);
}
void IPCTestBase::DestroyChannelProxy() {
@@ -135,3 +137,9 @@
scoped_refptr<base::TaskRunner> IPCTestBase::task_runner() {
return message_loop_->message_loop_proxy();
}
+
+scoped_ptr<IPC::ChannelFactory> IPCTestBase::CreateChannelFactory(
+ const IPC::ChannelHandle& handle,
+ base::TaskRunner* runner) {
+ return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER);
+}