| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 10 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code); | 501 BASE_EXPORT bool WaitForExitCode(ProcessHandle handle, int* exit_code); |
| 502 | 502 |
| 503 // Waits for process to exit. If it did exit within |timeout_milliseconds|, | 503 // Waits for process to exit. If it did exit within |timeout_milliseconds|, |
| 504 // then puts the exit code in |exit_code|, and returns true. | 504 // then puts the exit code in |exit_code|, and returns true. |
| 505 // In POSIX systems, if the process has been signaled then |exit_code| is set | 505 // In POSIX systems, if the process has been signaled then |exit_code| is set |
| 506 // to -1. Returns false on failure (the caller is then responsible for closing | 506 // to -1. Returns false on failure (the caller is then responsible for closing |
| 507 // |handle|). | 507 // |handle|). |
| 508 // The caller is always responsible for closing the |handle|. | 508 // The caller is always responsible for closing the |handle|. |
| 509 BASE_EXPORT bool WaitForExitCodeWithTimeout(ProcessHandle handle, | 509 BASE_EXPORT bool WaitForExitCodeWithTimeout(ProcessHandle handle, |
| 510 int* exit_code, | 510 int* exit_code, |
| 511 int64 timeout_milliseconds); | |
| 512 BASE_EXPORT bool WaitForExitCodeWithTimeout(ProcessHandle handle, | |
| 513 int* exit_code, | |
| 514 base::TimeDelta timeout); | 511 base::TimeDelta timeout); |
| 515 | 512 |
| 516 // Wait for all the processes based on the named executable to exit. If filter | 513 // Wait for all the processes based on the named executable to exit. If filter |
| 517 // is non-null, then only processes selected by the filter are waited on. | 514 // is non-null, then only processes selected by the filter are waited on. |
| 518 // Returns after all processes have exited or wait_milliseconds have expired. | 515 // Returns after all processes have exited or wait_milliseconds have expired. |
| 519 // Returns true if all the processes exited, false otherwise. | 516 // Returns true if all the processes exited, false otherwise. |
| 520 BASE_EXPORT bool WaitForProcessesToExit( | 517 BASE_EXPORT bool WaitForProcessesToExit( |
| 521 const FilePath::StringType& executable_name, | 518 const FilePath::StringType& executable_name, |
| 522 int64 wait_milliseconds, | |
| 523 const ProcessFilter* filter); | |
| 524 BASE_EXPORT bool WaitForProcessesToExit( | |
| 525 const FilePath::StringType& executable_name, | |
| 526 base::TimeDelta wait, | 519 base::TimeDelta wait, |
| 527 const ProcessFilter* filter); | 520 const ProcessFilter* filter); |
| 528 | 521 |
| 529 // Wait for a single process to exit. Return true if it exited cleanly within | 522 // Wait for a single process to exit. Return true if it exited cleanly within |
| 530 // the given time limit. On Linux |handle| must be a child process, however | 523 // the given time limit. On Linux |handle| must be a child process, however |
| 531 // on Mac and Windows it can be any process. | 524 // on Mac and Windows it can be any process. |
| 532 BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle, | 525 BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle, |
| 533 int64 wait_milliseconds); | |
| 534 BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle, | |
| 535 base::TimeDelta wait); | 526 base::TimeDelta wait); |
| 536 | 527 |
| 537 // Waits a certain amount of time (can be 0) for all the processes with a given | 528 // Waits a certain amount of time (can be 0) for all the processes with a given |
| 538 // executable name to exit, then kills off any of them that are still around. | 529 // executable name to exit, then kills off any of them that are still around. |
| 539 // If filter is non-null, then only processes selected by the filter are waited | 530 // If filter is non-null, then only processes selected by the filter are waited |
| 540 // on. Killed processes are ended with the given exit code. Returns false if | 531 // on. Killed processes are ended with the given exit code. Returns false if |
| 541 // any processes needed to be killed, true if they all exited cleanly within | 532 // any processes needed to be killed, true if they all exited cleanly within |
| 542 // the wait_milliseconds delay. | 533 // the wait_milliseconds delay. |
| 543 BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name, | 534 BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name, |
| 544 int64 wait_milliseconds, | 535 int64 wait_milliseconds, |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // instance running inside the parent. The parent's Breakpad instance should | 846 // instance running inside the parent. The parent's Breakpad instance should |
| 856 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler | 847 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler |
| 857 // in the child after forking will restore the standard exception handler. | 848 // in the child after forking will restore the standard exception handler. |
| 858 // See http://crbug.com/20371/ for more details. | 849 // See http://crbug.com/20371/ for more details. |
| 859 void RestoreDefaultExceptionHandler(); | 850 void RestoreDefaultExceptionHandler(); |
| 860 #endif // defined(OS_MACOSX) | 851 #endif // defined(OS_MACOSX) |
| 861 | 852 |
| 862 } // namespace base | 853 } // namespace base |
| 863 | 854 |
| 864 #endif // BASE_PROCESS_UTIL_H_ | 855 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |