OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This file contains functions for launching subprocesses. | 5 // This file contains functions for launching subprocesses. |
6 | 6 |
7 #ifndef BASE_PROCESS_LAUNCH_H_ | 7 #ifndef BASE_PROCESS_LAUNCH_H_ |
8 #define BASE_PROCESS_LAUNCH_H_ | 8 #define BASE_PROCESS_LAUNCH_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // true, then this bit will not be set in the new child process. | 121 // true, then this bit will not be set in the new child process. |
122 bool allow_new_privs; | 122 bool allow_new_privs; |
123 #endif // defined(OS_LINUX) | 123 #endif // defined(OS_LINUX) |
124 | 124 |
125 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
126 // If non-negative, the specified file descriptor will be set as the launched | 126 // If non-negative, the specified file descriptor will be set as the launched |
127 // process' controlling terminal. | 127 // process' controlling terminal. |
128 int ctrl_terminal_fd; | 128 int ctrl_terminal_fd; |
129 #endif // defined(OS_CHROMEOS) | 129 #endif // defined(OS_CHROMEOS) |
130 | 130 |
| 131 #if defined(OS_MACOSX) |
| 132 // If this name is non-empty, the new child, after fork() but before exec(), |
| 133 // will look up this server name in the bootstrap namespace. The resulting |
| 134 // service port will be replaced as the bootstrap port in the child. Because |
| 135 // the process's IPC space is cleared on exec(), any rights to the old |
| 136 // bootstrap port will not be transferred to the new process. |
| 137 std::string replacement_bootstrap_name; |
| 138 #endif |
| 139 |
131 #endif // !defined(OS_WIN) | 140 #endif // !defined(OS_WIN) |
132 }; | 141 }; |
133 | 142 |
134 // Launch a process via the command line |cmdline|. | 143 // Launch a process via the command line |cmdline|. |
135 // See the documentation of LaunchOptions for details on |options|. | 144 // See the documentation of LaunchOptions for details on |options|. |
136 // | 145 // |
137 // Returns true upon success. | 146 // Returns true upon success. |
138 // | 147 // |
139 // Upon success, if |process_handle| is non-null, it will be filled in with the | 148 // Upon success, if |process_handle| is non-null, it will be filled in with the |
140 // handle of the launched process. NOTE: In this case, the caller is | 149 // handle of the launched process. NOTE: In this case, the caller is |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 252 |
244 #if defined(OS_MACOSX) | 253 #if defined(OS_MACOSX) |
245 // Restore the default exception handler, setting it to Apple Crash Reporter | 254 // Restore the default exception handler, setting it to Apple Crash Reporter |
246 // (ReportCrash). When forking and execing a new process, the child will | 255 // (ReportCrash). When forking and execing a new process, the child will |
247 // inherit the parent's exception ports, which may be set to the Breakpad | 256 // inherit the parent's exception ports, which may be set to the Breakpad |
248 // instance running inside the parent. The parent's Breakpad instance should | 257 // instance running inside the parent. The parent's Breakpad instance should |
249 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 258 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
250 // in the child after forking will restore the standard exception handler. | 259 // in the child after forking will restore the standard exception handler. |
251 // See http://crbug.com/20371/ for more details. | 260 // See http://crbug.com/20371/ for more details. |
252 void RestoreDefaultExceptionHandler(); | 261 void RestoreDefaultExceptionHandler(); |
| 262 |
| 263 // Look up the bootstrap server named |replacement_bootstrap_name| via the |
| 264 // current |bootstrap_port|. Then replace the task's bootstrap port with the |
| 265 // received right. |
| 266 void ReplaceBootstrapPort(const std::string& replacement_bootstrap_name); |
253 #endif // defined(OS_MACOSX) | 267 #endif // defined(OS_MACOSX) |
254 | 268 |
255 // Creates a LaunchOptions object suitable for launching processes in a test | 269 // Creates a LaunchOptions object suitable for launching processes in a test |
256 // binary. This should not be called in production/released code. | 270 // binary. This should not be called in production/released code. |
257 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); | 271 BASE_EXPORT LaunchOptions LaunchOptionsForTest(); |
258 | 272 |
259 } // namespace base | 273 } // namespace base |
260 | 274 |
261 #endif // BASE_PROCESS_LAUNCH_H_ | 275 #endif // BASE_PROCESS_LAUNCH_H_ |
OLD | NEW |