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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // 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 |
352 // 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 |
353 // 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 |
354 // 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. |
355 // | 355 // |
356 // 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. |
357 BASE_API char** AlterEnvironment(const environment_vector& changes, | 357 BASE_API char** AlterEnvironment(const environment_vector& changes, |
358 const char* const* const env); | 358 const char* const* const env); |
359 #endif // defined(OS_POSIX) | 359 #endif // defined(OS_POSIX) |
360 | 360 |
361 // Executes the application specified by cl. This function delegates to one | 361 #if defined(OS_WIN) |
362 // of the above platform-specific functions. | |
363 // TODO(evan): deprecated; change callers to use LaunchProcess, remove. | 362 // TODO(evan): deprecated; change callers to use LaunchProcess, remove. |
| 363 // Successfully deprecated on non-Windows. |
364 inline bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, | 364 inline bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, |
365 ProcessHandle* process_handle) { | 365 ProcessHandle* process_handle) { |
366 LaunchOptions options; | 366 LaunchOptions options; |
367 options.wait = wait; | 367 options.wait = wait; |
368 options.process_handle = process_handle; | 368 options.process_handle = process_handle; |
369 | 369 |
370 return LaunchProcess(cl, options); | 370 return LaunchProcess(cl, options); |
371 } | 371 } |
| 372 #endif |
372 | 373 |
373 // Executes the application specified by |cl| and wait for it to exit. Stores | 374 // Executes the application specified by |cl| and wait for it to exit. Stores |
374 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true | 375 // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true |
375 // on success (application launched and exited cleanly, with exit code | 376 // on success (application launched and exited cleanly, with exit code |
376 // indicating success). | 377 // indicating success). |
377 BASE_API bool GetAppOutput(const CommandLine& cl, std::string* output); | 378 BASE_API bool GetAppOutput(const CommandLine& cl, std::string* output); |
378 | 379 |
379 #if defined(OS_POSIX) | 380 #if defined(OS_POSIX) |
380 // A restricted version of |GetAppOutput()| which (a) clears the environment, | 381 // A restricted version of |GetAppOutput()| which (a) clears the environment, |
381 // and (b) stores at most |max_output| bytes; also, it doesn't search the path | 382 // and (b) stores at most |max_output| bytes; also, it doesn't search the path |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 // instance running inside the parent. The parent's Breakpad instance should | 751 // instance running inside the parent. The parent's Breakpad instance should |
751 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 752 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
752 // in the child after forking will restore the standard exception handler. | 753 // in the child after forking will restore the standard exception handler. |
753 // See http://crbug.com/20371/ for more details. | 754 // See http://crbug.com/20371/ for more details. |
754 void RestoreDefaultExceptionHandler(); | 755 void RestoreDefaultExceptionHandler(); |
755 #endif // defined(OS_MACOSX) | 756 #endif // defined(OS_MACOSX) |
756 | 757 |
757 } // namespace base | 758 } // namespace base |
758 | 759 |
759 #endif // BASE_PROCESS_UTIL_H_ | 760 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |