| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
| 6 // computing statistics of processes. | 6 // computing statistics of processes. |
| 7 | 7 |
| 8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
| 9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 // AlterEnvironment returns a modified environment vector, constructed from the | 229 // AlterEnvironment returns a modified environment vector, constructed from the |
| 230 // given environment and the list of changes given in |changes|. Each key in | 230 // given environment and the list of changes given in |changes|. Each key in |
| 231 // the environment is matched against the first element of the pairs. In the | 231 // the environment is matched against the first element of the pairs. In the |
| 232 // event of a match, the value is replaced by the second of the pair, unless | 232 // event of a match, the value is replaced by the second of the pair, unless |
| 233 // the second is empty, in which case the key-value is removed. | 233 // the second is empty, in which case the key-value is removed. |
| 234 // | 234 // |
| 235 // The returned array is allocated using new[] and must be freed by the caller. | 235 // The returned array is allocated using new[] and must be freed by the caller. |
| 236 char** AlterEnvironment(const environment_vector& changes, | 236 char** AlterEnvironment(const environment_vector& changes, |
| 237 const char* const* const env); | 237 const char* const* const env); |
| 238 | |
| 239 #if defined(OS_MACOSX) | |
| 240 // Similar to the above, but also returns the new process's task_t if | |
| 241 // |task_handle| is not NULL. If |task_handle| is not NULL, the caller is | |
| 242 // responsible for calling |mach_port_deallocate()| on the returned handle. | |
| 243 bool LaunchAppAndGetTask(const std::vector<std::string>& argv, | |
| 244 const environment_vector& environ, | |
| 245 const file_handle_mapping_vector& fds_to_remap, | |
| 246 bool wait, | |
| 247 task_t* task_handle, | |
| 248 ProcessHandle* process_handle); | |
| 249 #endif // defined(OS_MACOSX) | |
| 250 #endif // defined(OS_POSIX) | 238 #endif // defined(OS_POSIX) |
| 251 | 239 |
| 252 // Executes the application specified by cl. This function delegates to one | 240 // Executes the application specified by cl. This function delegates to one |
| 253 // of the above two platform-specific functions. | 241 // of the above two platform-specific functions. |
| 254 bool LaunchApp(const CommandLine& cl, | 242 bool LaunchApp(const CommandLine& cl, |
| 255 bool wait, bool start_hidden, ProcessHandle* process_handle); | 243 bool wait, bool start_hidden, ProcessHandle* process_handle); |
| 256 | 244 |
| 257 // Executes the application specified by |cl| and wait for it to exit. Stores | 245 // Executes the application specified by |cl| and wait for it to exit. Stores |
| 258 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true | 246 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true |
| 259 // on success (application launched and exited cleanly, with exit code | 247 // on success (application launched and exited cleanly, with exit code |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 // instance running inside the parent. The parent's Breakpad instance should | 605 // instance running inside the parent. The parent's Breakpad instance should |
| 618 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 606 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 619 // in the child after forking will restore the standard exception handler. | 607 // in the child after forking will restore the standard exception handler. |
| 620 // See http://crbug.com/20371/ for more details. | 608 // See http://crbug.com/20371/ for more details. |
| 621 void RestoreDefaultExceptionHandler(); | 609 void RestoreDefaultExceptionHandler(); |
| 622 #endif // defined(OS_MACOSX) | 610 #endif // defined(OS_MACOSX) |
| 623 | 611 |
| 624 } // namespace base | 612 } // namespace base |
| 625 | 613 |
| 626 #endif // BASE_PROCESS_UTIL_H_ | 614 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |