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 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/process/process_handle.h" |
10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
11 | 12 |
12 #include <sys/types.h> | |
13 #if defined(OS_WIN) | |
14 #include <windows.h> | |
15 #endif | |
16 | |
17 namespace base { | 13 namespace base { |
18 | 14 |
19 // ProcessHandle is a platform specific type which represents the underlying OS | |
20 // handle to a process. | |
21 // ProcessId is a number which identifies the process in the OS. | |
22 #if defined(OS_WIN) | |
23 typedef HANDLE ProcessHandle; | |
24 typedef DWORD ProcessId; | |
25 typedef HANDLE UserTokenHandle; | |
26 const ProcessHandle kNullProcessHandle = NULL; | |
27 const ProcessId kNullProcessId = 0; | |
28 #elif defined(OS_POSIX) | |
29 // On POSIX, our ProcessHandle will just be the PID. | |
30 typedef pid_t ProcessHandle; | |
31 typedef pid_t ProcessId; | |
32 const ProcessHandle kNullProcessHandle = 0; | |
33 const ProcessId kNullProcessId = 0; | |
34 #endif // defined(OS_WIN) | |
35 | |
36 class BASE_EXPORT Process { | 15 class BASE_EXPORT Process { |
37 public: | 16 public: |
38 Process() : process_(kNullProcessHandle) { | 17 Process() : process_(kNullProcessHandle) { |
39 } | 18 } |
40 | 19 |
41 explicit Process(ProcessHandle handle) : process_(handle) { | 20 explicit Process(ProcessHandle handle) : process_(handle) { |
42 } | 21 } |
43 | 22 |
44 // A handle to the current process. | 23 // A handle to the current process. |
45 static Process Current(); | 24 static Process Current(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // of this value is OS dependent. | 61 // of this value is OS dependent. |
83 int GetPriority() const; | 62 int GetPriority() const; |
84 | 63 |
85 private: | 64 private: |
86 ProcessHandle process_; | 65 ProcessHandle process_; |
87 }; | 66 }; |
88 | 67 |
89 } // namespace base | 68 } // namespace base |
90 | 69 |
91 #endif // BASE_PROCESS_H_ | 70 #endif // BASE_PROCESS_H_ |
OLD | NEW |