| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IPC_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
| 6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 static std::string GenerateVerifiedChannelID(const std::string& prefix); | 197 static std::string GenerateVerifiedChannelID(const std::string& prefix); |
| 198 #endif | 198 #endif |
| 199 | 199 |
| 200 #if defined(OS_LINUX) | 200 #if defined(OS_LINUX) |
| 201 // Sandboxed processes live in a PID namespace, so when sending the IPC hello | 201 // Sandboxed processes live in a PID namespace, so when sending the IPC hello |
| 202 // message from client to server we need to send the PID from the global | 202 // message from client to server we need to send the PID from the global |
| 203 // PID namespace. | 203 // PID namespace. |
| 204 static void SetGlobalPid(int pid); | 204 static void SetGlobalPid(int pid); |
| 205 #endif | 205 #endif |
| 206 | 206 |
| 207 #if defined(OS_ANDROID) |
| 208 // Most tests are single process and work the same on all platforms. However |
| 209 // in some cases we want to test multi-process, and Android differs in that it |
| 210 // can't 'exec' after forking. This callback resets any data in the forked |
| 211 // process such that it acts similar to if it was exec'd, for tests. |
| 212 static void NotifyProcessForkedForTesting(); |
| 213 #endif |
| 214 |
| 207 protected: | 215 protected: |
| 208 // Used in Chrome by the TestSink to provide a dummy channel implementation | 216 // Used in Chrome by the TestSink to provide a dummy channel implementation |
| 209 // for testing. TestSink overrides the "interesting" functions in Channel so | 217 // for testing. TestSink overrides the "interesting" functions in Channel so |
| 210 // no actual implementation is needed. This will cause un-overridden calls to | 218 // no actual implementation is needed. This will cause un-overridden calls to |
| 211 // segfault. Do not use outside of test code! | 219 // segfault. Do not use outside of test code! |
| 212 Channel() : channel_impl_(0) { } | 220 Channel() : channel_impl_(0) { } |
| 213 | 221 |
| 214 private: | 222 private: |
| 215 // PIMPL to which all channel calls are delegated. | 223 // PIMPL to which all channel calls are delegated. |
| 216 class ChannelImpl; | 224 class ChannelImpl; |
| 217 ChannelImpl *channel_impl_; | 225 ChannelImpl *channel_impl_; |
| 218 }; | 226 }; |
| 219 | 227 |
| 220 #if defined(OS_POSIX) | 228 #if defined(OS_POSIX) |
| 221 // SocketPair() creates a pair of socket FDs suitable for using with | 229 // SocketPair() creates a pair of socket FDs suitable for using with |
| 222 // IPC::Channel. | 230 // IPC::Channel. |
| 223 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 231 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 224 #endif | 232 #endif |
| 225 | 233 |
| 226 } // namespace IPC | 234 } // namespace IPC |
| 227 | 235 |
| 228 #endif // IPC_IPC_CHANNEL_H_ | 236 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |