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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 const file_handle_mapping_vector& fds_to_remap, | 354 const file_handle_mapping_vector& fds_to_remap, |
355 bool wait, ProcessHandle* process_handle) { | 355 bool wait, ProcessHandle* process_handle) { |
356 LaunchOptions options; | 356 LaunchOptions options; |
357 options.environ = &environ; | 357 options.environ = &environ; |
358 options.fds_to_remap = &fds_to_remap; | 358 options.fds_to_remap = &fds_to_remap; |
359 options.wait = wait; | 359 options.wait = wait; |
360 options.process_handle = process_handle; | 360 options.process_handle = process_handle; |
361 return LaunchProcess(argv, options); | 361 return LaunchProcess(argv, options); |
362 } | 362 } |
363 | 363 |
364 // TODO(evan): deprecated; change callers to use LaunchProcess, remove. | |
365 inline bool LaunchAppInNewProcessGroup( | |
366 const std::vector<std::string>& argv, | |
367 const environment_vector& environ, | |
368 const file_handle_mapping_vector& fds_to_remap, | |
369 bool wait, | |
370 ProcessHandle* process_handle) { | |
371 LaunchOptions options; | |
372 options.environ = &environ; | |
373 options.fds_to_remap = &fds_to_remap; | |
374 options.wait = wait; | |
375 options.process_handle = process_handle; | |
376 options.new_process_group = true; | |
377 return LaunchProcess(argv, options); | |
378 } | |
379 | |
380 // AlterEnvironment returns a modified environment vector, constructed from the | 364 // AlterEnvironment returns a modified environment vector, constructed from the |
381 // given environment and the list of changes given in |changes|. Each key in | 365 // given environment and the list of changes given in |changes|. Each key in |
382 // the environment is matched against the first element of the pairs. In the | 366 // the environment is matched against the first element of the pairs. In the |
383 // event of a match, the value is replaced by the second of the pair, unless | 367 // event of a match, the value is replaced by the second of the pair, unless |
384 // the second is empty, in which case the key-value is removed. | 368 // the second is empty, in which case the key-value is removed. |
385 // | 369 // |
386 // The returned array is allocated using new[] and must be freed by the caller. | 370 // The returned array is allocated using new[] and must be freed by the caller. |
387 BASE_API char** AlterEnvironment(const environment_vector& changes, | 371 BASE_API char** AlterEnvironment(const environment_vector& changes, |
388 const char* const* const env); | 372 const char* const* const env); |
389 #endif // defined(OS_POSIX) | 373 #endif // defined(OS_POSIX) |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 // instance running inside the parent. The parent's Breakpad instance should | 757 // instance running inside the parent. The parent's Breakpad instance should |
774 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 758 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
775 // in the child after forking will restore the standard exception handler. | 759 // in the child after forking will restore the standard exception handler. |
776 // See http://crbug.com/20371/ for more details. | 760 // See http://crbug.com/20371/ for more details. |
777 void RestoreDefaultExceptionHandler(); | 761 void RestoreDefaultExceptionHandler(); |
778 #endif // defined(OS_MACOSX) | 762 #endif // defined(OS_MACOSX) |
779 | 763 |
780 } // namespace base | 764 } // namespace base |
781 | 765 |
782 #endif // BASE_PROCESS_UTIL_H_ | 766 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |