Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_PROCESS_H_ | 5 #ifndef BASE_PROCESS_H_ |
| 6 #define BASE_PROCESS_H_ | 6 #define BASE_PROCESS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_api.h" | 9 #include "base/base_api.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #include <sys/types.h> | 13 #include <sys/types.h> |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include <windows.h> | 15 #include <windows.h> |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 | 19 |
| 20 // ProcessHandle is a platform specific type which represents the underlying OS | 20 // ProcessHandle is a platform specific type which represents the underlying OS |
| 21 // handle to a process. | 21 // handle to a process. |
| 22 // ProcessId is a number which identifies the process in the OS. | 22 // ProcessId is a number which identifies the process in the OS. |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 typedef HANDLE ProcessHandle; | 24 typedef HANDLE ProcessHandle; |
| 25 typedef DWORD ProcessId; | 25 typedef DWORD ProcessId; |
| 26 typedef HANDLE UserTokenHandle; | 26 typedef HANDLE UserTokenHandle; |
| 27 const ProcessHandle kNullProcessHandle = NULL; | 27 const ProcessHandle kNullProcessHandle = NULL; |
| 28 const ProcessId kNullProcessId = NULL; | |
|
amit
2011/04/01 05:15:12
Since PricessId is a DWORD here, why not = 0?
Jeff Bailey (chromium)
2011/04/01 05:26:09
Had to look up what a DWORD was. Will change is.
| |
| 28 #elif defined(OS_POSIX) | 29 #elif defined(OS_POSIX) |
| 29 // On POSIX, our ProcessHandle will just be the PID. | 30 // On POSIX, our ProcessHandle will just be the PID. |
| 30 typedef pid_t ProcessHandle; | 31 typedef pid_t ProcessHandle; |
| 31 typedef pid_t ProcessId; | 32 typedef pid_t ProcessId; |
| 32 const ProcessHandle kNullProcessHandle = 0; | 33 const ProcessHandle kNullProcessHandle = 0; |
| 34 const ProcessId kNullProcessId = 0; | |
| 33 #endif // defined(OS_WIN) | 35 #endif // defined(OS_WIN) |
| 34 | 36 |
| 35 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 37 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 36 // saved_priority_ will be set to this to indicate that it's not holding | 38 // saved_priority_ will be set to this to indicate that it's not holding |
| 37 // a valid value. -20 to 19 are valid process priorities. | 39 // a valid value. -20 to 19 are valid process priorities. |
| 38 const int kUnsetProcessPriority = 256; | 40 const int kUnsetProcessPriority = 256; |
| 39 #endif | 41 #endif |
| 40 | 42 |
| 41 class BASE_API Process { | 43 class BASE_API Process { |
| 42 public: | 44 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 101 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 100 // Holds the priority that the process was set to when it was backgrounded. | 102 // Holds the priority that the process was set to when it was backgrounded. |
| 101 // If the process wasn't backgrounded it will be kUnsetProcessPriority. | 103 // If the process wasn't backgrounded it will be kUnsetProcessPriority. |
| 102 int saved_priority_; | 104 int saved_priority_; |
| 103 #endif | 105 #endif |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 } // namespace base | 108 } // namespace base |
| 107 | 109 |
| 108 #endif // BASE_PROCESS_H_ | 110 #endif // BASE_PROCESS_H_ |
| OLD | NEW |