| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 #elif defined(OS_POSIX) | 342 #elif defined(OS_POSIX) |
| 343 // A POSIX-specific version of LaunchProcess that takes an argv array | 343 // A POSIX-specific version of LaunchProcess that takes an argv array |
| 344 // instead of a CommandLine. Useful for situations where you need to | 344 // instead of a CommandLine. Useful for situations where you need to |
| 345 // control the command line arguments directly, but prefer the | 345 // control the command line arguments directly, but prefer the |
| 346 // CommandLine version if launching Chrome itself. | 346 // CommandLine version if launching Chrome itself. |
| 347 BASE_API bool LaunchProcess(const std::vector<std::string>& argv, | 347 BASE_API bool LaunchProcess(const std::vector<std::string>& argv, |
| 348 const LaunchOptions& options); | 348 const LaunchOptions& options); |
| 349 | 349 |
| 350 // TODO(evan): deprecated; change callers to use LaunchProcess, remove. | |
| 351 inline bool LaunchApp(const std::vector<std::string>& argv, | |
| 352 const file_handle_mapping_vector& fds_to_remap, | |
| 353 bool wait, ProcessHandle* process_handle) { | |
| 354 LaunchOptions options; | |
| 355 options.fds_to_remap = &fds_to_remap; | |
| 356 options.wait = wait; | |
| 357 options.process_handle = process_handle; | |
| 358 return LaunchProcess(argv, options); | |
| 359 } | |
| 360 | |
| 361 // AlterEnvironment returns a modified environment vector, constructed from the | 350 // AlterEnvironment returns a modified environment vector, constructed from the |
| 362 // given environment and the list of changes given in |changes|. Each key in | 351 // given environment and the list of changes given in |changes|. Each key in |
| 363 // the environment is matched against the first element of the pairs. In the | 352 // the environment is matched against the first element of the pairs. In the |
| 364 // event of a match, the value is replaced by the second of the pair, unless | 353 // event of a match, the value is replaced by the second of the pair, unless |
| 365 // the second is empty, in which case the key-value is removed. | 354 // the second is empty, in which case the key-value is removed. |
| 366 // | 355 // |
| 367 // The returned array is allocated using new[] and must be freed by the caller. | 356 // The returned array is allocated using new[] and must be freed by the caller. |
| 368 BASE_API char** AlterEnvironment(const environment_vector& changes, | 357 BASE_API char** AlterEnvironment(const environment_vector& changes, |
| 369 const char* const* const env); | 358 const char* const* const env); |
| 370 #endif // defined(OS_POSIX) | 359 #endif // defined(OS_POSIX) |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // instance running inside the parent. The parent's Breakpad instance should | 750 // instance running inside the parent. The parent's Breakpad instance should |
| 762 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 751 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 763 // in the child after forking will restore the standard exception handler. | 752 // in the child after forking will restore the standard exception handler. |
| 764 // See http://crbug.com/20371/ for more details. | 753 // See http://crbug.com/20371/ for more details. |
| 765 void RestoreDefaultExceptionHandler(); | 754 void RestoreDefaultExceptionHandler(); |
| 766 #endif // defined(OS_MACOSX) | 755 #endif // defined(OS_MACOSX) |
| 767 | 756 |
| 768 } // namespace base | 757 } // namespace base |
| 769 | 758 |
| 770 #endif // BASE_PROCESS_UTIL_H_ | 759 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |