| Index: ipc/ipc_channel_common.cc
|
| diff --git a/ipc/ipc_channel_common.cc b/ipc/ipc_channel_common.cc
|
| index 10b88b6de7eee7f3546689a3e956dc07de419399..6225a869ae6f4f18036294e8a4585640d2921242 100644
|
| --- a/ipc/ipc_channel_common.cc
|
| +++ b/ipc/ipc_channel_common.cc
|
| @@ -9,31 +9,37 @@
|
|
|
| namespace IPC {
|
|
|
| +#if defined(OS_LINUX)
|
| +
|
| +namespace {
|
| +int g_global_pid = 0;
|
| +}
|
| +
|
| // static
|
| -std::unique_ptr<Channel> Channel::CreateClient(
|
| - const IPC::ChannelHandle& channel_handle,
|
| - Listener* listener,
|
| - const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
|
| - if (channel_handle.mojo_handle.is_valid()) {
|
| - return ChannelMojo::Create(
|
| - mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
|
| - Channel::MODE_CLIENT, listener, ipc_task_runner);
|
| - }
|
| - return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener);
|
| +void Channel::SetGlobalPid(int pid) {
|
| + g_global_pid = pid;
|
| }
|
|
|
| // static
|
| -std::unique_ptr<Channel> Channel::CreateNamedServer(
|
| - const IPC::ChannelHandle& channel_handle,
|
| - Listener* listener) {
|
| - return Channel::Create(channel_handle, Channel::MODE_NAMED_SERVER, listener);
|
| +int Channel::GetGlobalPid() {
|
| + return g_global_pid;
|
| }
|
|
|
| +#endif // defined(OS_LINUX)
|
| +
|
| // static
|
| -std::unique_ptr<Channel> Channel::CreateNamedClient(
|
| +std::unique_ptr<Channel> Channel::CreateClient(
|
| const IPC::ChannelHandle& channel_handle,
|
| - Listener* listener) {
|
| - return Channel::Create(channel_handle, Channel::MODE_NAMED_CLIENT, listener);
|
| + Listener* listener,
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
|
| +#if defined(OS_NACL_SFI)
|
| + return Channel::Create(channel_handle, Channel::MODE_CLIENT, listener);
|
| +#else
|
| + DCHECK(channel_handle.is_mojo_channel_handle());
|
| + return ChannelMojo::Create(
|
| + mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
|
| + Channel::MODE_CLIENT, listener, ipc_task_runner);
|
| +#endif
|
| }
|
|
|
| // static
|
| @@ -41,12 +47,14 @@ std::unique_ptr<Channel> Channel::CreateServer(
|
| const IPC::ChannelHandle& channel_handle,
|
| Listener* listener,
|
| const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
|
| - if (channel_handle.mojo_handle.is_valid()) {
|
| - return ChannelMojo::Create(
|
| - mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
|
| - Channel::MODE_SERVER, listener, ipc_task_runner);
|
| - }
|
| +#if defined(OS_NACL_SFI)
|
| return Channel::Create(channel_handle, Channel::MODE_SERVER, listener);
|
| +#else
|
| + DCHECK(channel_handle.is_mojo_channel_handle());
|
| + return ChannelMojo::Create(
|
| + mojo::ScopedMessagePipeHandle(channel_handle.mojo_handle),
|
| + Channel::MODE_SERVER, listener, ipc_task_runner);
|
| +#endif
|
| }
|
|
|
| // static
|
| @@ -82,4 +90,3 @@ void Channel::WillConnect() {
|
| }
|
|
|
| } // namespace IPC
|
| -
|
|
|