OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // filter is non-null, then only processes selected by the filter are killed. | 144 // filter is non-null, then only processes selected by the filter are killed. |
145 // Returns false if all processes were able to be killed off, false if at least | 145 // Returns false if all processes were able to be killed off, false if at least |
146 // one couldn't be killed. | 146 // one couldn't be killed. |
147 bool KillProcesses(const std::wstring& executable_name, int exit_code, | 147 bool KillProcesses(const std::wstring& executable_name, int exit_code, |
148 const ProcessFilter* filter); | 148 const ProcessFilter* filter); |
149 | 149 |
150 // Attempts to kill the process identified by the given process | 150 // Attempts to kill the process identified by the given process |
151 // entry structure, giving it the specified exit code. If |wait| is true, wait | 151 // entry structure, giving it the specified exit code. If |wait| is true, wait |
152 // for the process to be actually terminated before returning. | 152 // for the process to be actually terminated before returning. |
153 // Returns true if this is successful, false otherwise. | 153 // Returns true if this is successful, false otherwise. |
154 bool KillProcess(int process_id, int exit_code, bool wait); | 154 bool KillProcess(ProcessHandle process, int exit_code, bool wait); |
155 #if defined(OS_WIN) | 155 #if defined(OS_WIN) |
156 bool KillProcess(HANDLE process, int exit_code, bool wait); | 156 bool KillProcessById(DWORD process_id, int exit_code, bool wait); |
157 #endif | 157 #endif |
158 | 158 |
159 // Get the termination status (exit code) of the process and return true if the | 159 // Get the termination status (exit code) of the process and return true if the |
160 // status indicates the process crashed. It is an error to call this if the | 160 // status indicates the process crashed. It is an error to call this if the |
161 // process hasn't terminated yet. | 161 // process hasn't terminated yet. |
162 bool DidProcessCrash(ProcessHandle handle); | 162 bool DidProcessCrash(ProcessHandle handle); |
163 | 163 |
164 // Waits for process to exit. In POSIX systems, if the process hasn't been | 164 // Waits for process to exit. In POSIX systems, if the process hasn't been |
165 // signaled then puts the exit code in |exit_code|; otherwise it's considered | 165 // signaled then puts the exit code in |exit_code|; otherwise it's considered |
166 // a failure. On Windows |exit_code| is always filled. Returns true on success, | 166 // a failure. On Windows |exit_code| is always filled. Returns true on success, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 349 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
350 void EnableTerminationOnHeapCorruption(); | 350 void EnableTerminationOnHeapCorruption(); |
351 | 351 |
352 // If supported on the platform, and the user has sufficent rights, increase | 352 // If supported on the platform, and the user has sufficent rights, increase |
353 // the current process's scheduling priority to a high priority. | 353 // the current process's scheduling priority to a high priority. |
354 void RaiseProcessToHighPriority(); | 354 void RaiseProcessToHighPriority(); |
355 | 355 |
356 } // namespace base | 356 } // namespace base |
357 | 357 |
358 #endif // BASE_PROCESS_UTIL_H_ | 358 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |