OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Attempts to kill the process identified by the given process | 165 // Attempts to kill the process identified by the given process |
166 // entry structure, giving it the specified exit code. If |wait| is true, wait | 166 // entry structure, giving it the specified exit code. If |wait| is true, wait |
167 // for the process to be actually terminated before returning. | 167 // for the process to be actually terminated before returning. |
168 // Returns true if this is successful, false otherwise. | 168 // Returns true if this is successful, false otherwise. |
169 bool KillProcess(ProcessHandle process, int exit_code, bool wait); | 169 bool KillProcess(ProcessHandle process, int exit_code, bool wait); |
170 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
171 bool KillProcessById(ProcessId process_id, int exit_code, bool wait); | 171 bool KillProcessById(ProcessId process_id, int exit_code, bool wait); |
172 #endif | 172 #endif |
173 | 173 |
174 // Get the termination status (exit code) of the process and return true if the | 174 // Get the termination status (exit code) of the process and return true if the |
175 // status indicates the process crashed. It is an error to call this if the | 175 // status indicates the process crashed. |child_exited| is set to true iff the |
176 // process hasn't terminated yet. | 176 // child process has terminated. (|child_exited| may be NULL.) |
177 bool DidProcessCrash(ProcessHandle handle); | 177 // |
| 178 // On Windows, it is an error to call this if the process hasn't terminated |
| 179 // yet. On POSIX, |child_exited| is set correctly since we detect terminate in |
| 180 // a different manner on POSIX. |
| 181 bool DidProcessCrash(bool* child_exited, ProcessHandle handle); |
178 | 182 |
179 // Waits for process to exit. In POSIX systems, if the process hasn't been | 183 // Waits for process to exit. In POSIX systems, if the process hasn't been |
180 // signaled then puts the exit code in |exit_code|; otherwise it's considered | 184 // signaled then puts the exit code in |exit_code|; otherwise it's considered |
181 // a failure. On Windows |exit_code| is always filled. Returns true on success, | 185 // a failure. On Windows |exit_code| is always filled. Returns true on success, |
182 // and closes |handle| in any case. | 186 // and closes |handle| in any case. |
183 bool WaitForExitCode(ProcessHandle handle, int* exit_code); | 187 bool WaitForExitCode(ProcessHandle handle, int* exit_code); |
184 | 188 |
185 // Wait for all the processes based on the named executable to exit. If filter | 189 // Wait for all the processes based on the named executable to exit. If filter |
186 // is non-null, then only processes selected by the filter are waited on. | 190 // is non-null, then only processes selected by the filter are waited on. |
187 // Returns after all processes have exited or wait_milliseconds have expired. | 191 // Returns after all processes have exited or wait_milliseconds have expired. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 372 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
369 void EnableTerminationOnHeapCorruption(); | 373 void EnableTerminationOnHeapCorruption(); |
370 | 374 |
371 // If supported on the platform, and the user has sufficent rights, increase | 375 // If supported on the platform, and the user has sufficent rights, increase |
372 // the current process's scheduling priority to a high priority. | 376 // the current process's scheduling priority to a high priority. |
373 void RaiseProcessToHighPriority(); | 377 void RaiseProcessToHighPriority(); |
374 | 378 |
375 } // namespace base | 379 } // namespace base |
376 | 380 |
377 #endif // BASE_PROCESS_UTIL_H_ | 381 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |