| Index: ipc/ipc_channel_mojo.cc
|
| diff --git a/ipc/ipc_channel_mojo.cc b/ipc/ipc_channel_mojo.cc
|
| index 6d00311a129db66704be8e3a050045463fef4592..e71baff895e6892d9dc36d6d0bfc44f1f159b7eb 100644
|
| --- a/ipc/ipc_channel_mojo.cc
|
| +++ b/ipc/ipc_channel_mojo.cc
|
| @@ -235,6 +235,18 @@ MojoResult UnwrapAttachment(mojom::SerializedHandlePtr handle,
|
| return MOJO_RESULT_UNKNOWN;
|
| }
|
|
|
| +base::ProcessId GetSelfPID() {
|
| +#if defined(OS_LINUX)
|
| + if (int global_pid = Channel::GetGlobalPid())
|
| + return global_pid;
|
| +#endif // OS_LINUX
|
| +#if defined(OS_NACL)
|
| + return -1;
|
| +#else
|
| + return base::GetCurrentProcId();
|
| +#endif // defined(OS_NACL)
|
| +}
|
| +
|
| } // namespace
|
|
|
| //------------------------------------------------------------------------------
|
| @@ -370,29 +382,11 @@ bool ChannelMojo::Send(Message* message) {
|
| return message_reader_->Send(std::move(scoped_message));
|
| }
|
|
|
| -base::ProcessId ChannelMojo::GetPeerPID() const {
|
| - if (!message_reader_)
|
| - return base::kNullProcessId;
|
| - return message_reader_->GetPeerPid();
|
| -}
|
| -
|
| -base::ProcessId ChannelMojo::GetSelfPID() const {
|
| -#if defined(OS_LINUX)
|
| - if (int global_pid = GetGlobalPid())
|
| - return global_pid;
|
| -#endif // OS_LINUX
|
| -#if defined(OS_NACL)
|
| - return -1;
|
| -#else
|
| - return base::GetCurrentProcId();
|
| -#endif // defined(OS_NACL)
|
| -}
|
| -
|
| Channel::AssociatedInterfaceSupport*
|
| ChannelMojo::GetAssociatedInterfaceSupport() { return this; }
|
|
|
| -void ChannelMojo::OnPeerPidReceived() {
|
| - listener_->OnChannelConnected(static_cast<int32_t>(GetPeerPID()));
|
| +void ChannelMojo::OnPeerPidReceived(int32_t peer_pid) {
|
| + listener_->OnChannelConnected(peer_pid);
|
| }
|
|
|
| void ChannelMojo::OnMessageReceived(const Message& message) {
|
|
|