Chromium Code Reviews| Index: ipc/ipc_channel.h |
| diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h |
| index f6bd5044c14af5150e12a9a964a382d7d630c4cc..ce9908d74bcd6d7ab22a596d94526dbd48384735 100644 |
| --- a/ipc/ipc_channel.h |
| +++ b/ipc/ipc_channel.h |
| @@ -179,7 +179,23 @@ class IPC_EXPORT Channel : public Sender { |
| // deleted once the contents of the Message have been sent. |
| virtual bool Send(Message* message) = 0; |
| -#if defined(OS_POSIX) && !defined(OS_NACL) |
| + // The IPC library is built for various platforms, including Win, Mac, Linux |
| + // and NaCl in SFI-mode and in Non-SFI mode. |
| + // Here, as for NaCl, the IPC library for NaCl in SFI-mode is linked into |
|
Mark Seaborn
2014/10/22 00:35:51
This comment is rather long... We shouldn't have
hidehiko
2014/10/22 13:31:05
Indeed. Added comment in components/nacl_nonsfi.gy
|
| + // irt.nexe and loaded by nacl_helper (the channel implementation is |
| + // ipc_channel_nacl), while the one for NaCl in Non-SFI mode is linked into |
| + // nacl_helper_nonsfi and runs directly on Linux platform (the channel |
| + // implementation is ipc_channel_posix). |
| + // So, since both are built by the NaCl/PNaCl toolchains, OS_NACL macro is |
| + // defined (derived from __native_client__ macro) in both cases, but the |
| + // latter is closer to Linux build. Actually GetClientFileDescriptor, |
| + // TakeClientFileDescriptor GenerateUniqueRandomChannelID, |
| + // GenerateVerifiedChannelID and SetGlobalPid are needed and used to |
| + // implement nacl_helper_nonsfi. |
| + // The compiler defined macro to figure out if this is compiled for NaCl in |
| + // SFI-mode or in Non-SFI mode is __native_client_nonsfi__. |
| +#if defined(OS_POSIX) && \ |
| + (!defined(OS_NACL) || defined(__native_client_nonsfi__)) |
| // On POSIX an IPC::Channel wraps a socketpair(), this method returns the |
| // FD # for the client end of the socket. |
| // This method may only be called on the server side of a channel. |
| @@ -190,13 +206,13 @@ class IPC_EXPORT Channel : public Sender { |
| // file descriptor to the caller. |
| // This method can be called on any thread. |
| virtual int TakeClientFileDescriptor() = 0; |
| -#endif // defined(OS_POSIX) && !defined(OS_NACL) |
| +#endif |
| // Returns true if a named server channel is initialized on the given channel |
| // ID. Even if true, the server may have already accepted a connection. |
| static bool IsNamedServerInitialized(const std::string& channel_id); |
| -#if !defined(OS_NACL) |
| +#if !defined(OS_NACL) || defined(__native_client_nonsfi__) |
| // Generates a channel ID that's non-predictable and unique. |
| static std::string GenerateUniqueRandomChannelID(); |
| @@ -207,7 +223,7 @@ class IPC_EXPORT Channel : public Sender { |
| static std::string GenerateVerifiedChannelID(const std::string& prefix); |
| #endif |
| -#if defined(OS_LINUX) |
| +#if defined(OS_LINUX) || defined(__native_client_nonsfi__) |
| // Sandboxed processes live in a PID namespace, so when sending the IPC hello |
| // message from client to server we need to send the PID from the global |
| // PID namespace. |