| 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 28 matching lines...) Expand all Loading... |
| 39 unsigned long long WriteOperationCount; | 39 unsigned long long WriteOperationCount; |
| 40 unsigned long long OtherOperationCount; | 40 unsigned long long OtherOperationCount; |
| 41 unsigned long long ReadTransferCount; | 41 unsigned long long ReadTransferCount; |
| 42 unsigned long long WriteTransferCount; | 42 unsigned long long WriteTransferCount; |
| 43 unsigned long long OtherTransferCount; | 43 unsigned long long OtherTransferCount; |
| 44 }; | 44 }; |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 namespace process_util { | 47 namespace process_util { |
| 48 | 48 |
| 49 // A minimalistic but hopefully cross-platform set of exit codes. |
| 50 // Do not change the enumeration values or you will break third-party |
| 51 // installers. |
| 52 enum { |
| 53 PROCESS_END_NORMAL_TERMINATON = 0, |
| 54 PROCESS_END_KILLED_BY_USER = 1, |
| 55 PROCESS_END_PROCESS_WAS_HUNG = 2 |
| 56 }; |
| 57 |
| 49 // Returns the id of the current process. | 58 // Returns the id of the current process. |
| 50 int GetCurrentProcId(); | 59 int GetCurrentProcId(); |
| 51 | 60 |
| 52 // Returns the ProcessHandle of the current process. | 61 // Returns the ProcessHandle of the current process. |
| 53 ProcessHandle GetCurrentProcessHandle(); | 62 ProcessHandle GetCurrentProcessHandle(); |
| 54 | 63 |
| 55 // Returns the unique ID for the specified process. This is functionally the | 64 // Returns the unique ID for the specified process. This is functionally the |
| 56 // same as Windows' GetProcessId(), but works on versions of Windows before | 65 // same as Windows' GetProcessId(), but works on versions of Windows before |
| 57 // Win XP SP1 as well. | 66 // Win XP SP1 as well. |
| 58 int GetProcId(ProcessHandle process); | 67 int GetProcId(ProcessHandle process); |
| 59 | 68 |
| 60 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 61 // Runs the given application name with the given command line. Normally, the | 70 // Runs the given application name with the given command line. Normally, the |
| 62 // first command line argument should be the path to the process, and don't | 71 // first command line argument should be the path to the process, and don't |
| 63 // forget to quote it. | 72 // forget to quote it. |
| 64 // | 73 // |
| 65 // If wait is true, it will block and wait for the other process to finish, | 74 // If wait is true, it will block and wait for the other process to finish, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 318 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
| 310 void EnableTerminationOnHeapCorruption(); | 319 void EnableTerminationOnHeapCorruption(); |
| 311 | 320 |
| 312 // If supported on the platform, and the user has sufficent rights, increase | 321 // If supported on the platform, and the user has sufficent rights, increase |
| 313 // the current process's scheduling priority to a high priority. | 322 // the current process's scheduling priority to a high priority. |
| 314 void RaiseProcessToHighPriority(); | 323 void RaiseProcessToHighPriority(); |
| 315 | 324 |
| 316 } // namespace process_util | 325 } // namespace process_util |
| 317 | 326 |
| 318 #endif // BASE_PROCESS_UTIL_H_ | 327 #endif // BASE_PROCESS_UTIL_H_ |
| OLD | NEW |