OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 contains routines to kill processes and get the exit code and | 5 // This file contains routines to kill processes and get the exit code and |
6 // termination status. | 6 // termination status. |
7 | 7 |
8 #ifndef BASE_PROCESS_KILL_H_ | 8 #ifndef BASE_PROCESS_KILL_H_ |
9 #define BASE_PROCESS_KILL_H_ | 9 #define BASE_PROCESS_KILL_H_ |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // Wait for all the processes based on the named executable to exit. If filter | 113 // Wait for all the processes based on the named executable to exit. If filter |
114 // is non-null, then only processes selected by the filter are waited on. | 114 // is non-null, then only processes selected by the filter are waited on. |
115 // Returns after all processes have exited or wait_milliseconds have expired. | 115 // Returns after all processes have exited or wait_milliseconds have expired. |
116 // Returns true if all the processes exited, false otherwise. | 116 // Returns true if all the processes exited, false otherwise. |
117 BASE_EXPORT bool WaitForProcessesToExit( | 117 BASE_EXPORT bool WaitForProcessesToExit( |
118 const FilePath::StringType& executable_name, | 118 const FilePath::StringType& executable_name, |
119 base::TimeDelta wait, | 119 base::TimeDelta wait, |
120 const ProcessFilter* filter); | 120 const ProcessFilter* filter); |
121 | 121 |
122 // Wait for a single process to exit. Return true if it exited cleanly within | |
123 // the given time limit. On Linux |handle| must be a child process, however | |
124 // on Mac and Windows it can be any process. | |
125 BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle, | |
126 base::TimeDelta wait); | |
127 | |
128 // Waits a certain amount of time (can be 0) for all the processes with a given | 122 // Waits a certain amount of time (can be 0) for all the processes with a given |
129 // executable name to exit, then kills off any of them that are still around. | 123 // executable name to exit, then kills off any of them that are still around. |
130 // If filter is non-null, then only processes selected by the filter are waited | 124 // If filter is non-null, then only processes selected by the filter are waited |
131 // on. Killed processes are ended with the given exit code. Returns false if | 125 // on. Killed processes are ended with the given exit code. Returns false if |
132 // any processes needed to be killed, true if they all exited cleanly within | 126 // any processes needed to be killed, true if they all exited cleanly within |
133 // the wait_milliseconds delay. | 127 // the wait_milliseconds delay. |
134 BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name, | 128 BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name, |
135 base::TimeDelta wait, | 129 base::TimeDelta wait, |
136 int exit_code, | 130 int exit_code, |
137 const ProcessFilter* filter); | 131 const ProcessFilter* filter); |
(...skipping 16 matching lines...) Expand all Loading... |
154 | 148 |
155 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 149 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
156 // The nicer version of EnsureProcessTerminated() that is patient and will | 150 // The nicer version of EnsureProcessTerminated() that is patient and will |
157 // wait for |pid| to finish and then reap it. | 151 // wait for |pid| to finish and then reap it. |
158 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); | 152 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); |
159 #endif | 153 #endif |
160 | 154 |
161 } // namespace base | 155 } // namespace base |
162 | 156 |
163 #endif // BASE_PROCESS_KILL_H_ | 157 #endif // BASE_PROCESS_KILL_H_ |
OLD | NEW |