OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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_PROCESS_H_ | 5 #ifndef BASE_PROCESS_PROCESS_H_ |
6 #define BASE_PROCESS_PROCESS_H_ | 6 #define BASE_PROCESS_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/move.h" | 10 #include "base/move.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // claim to be valid. The actual behavior in that case is OS dependent like so: | 25 // claim to be valid. The actual behavior in that case is OS dependent like so: |
26 // | 26 // |
27 // Windows: The underlying ProcessHandle will be valid after the process dies | 27 // Windows: The underlying ProcessHandle will be valid after the process dies |
28 // and can be used to gather some information about that process, but most | 28 // and can be used to gather some information about that process, but most |
29 // methods will obviously fail. | 29 // methods will obviously fail. |
30 // | 30 // |
31 // POSIX: The underlying PorcessHandle is not guaranteed to remain valid after | 31 // POSIX: The underlying PorcessHandle is not guaranteed to remain valid after |
32 // the process dies, and it may be reused by the system, which means that it may | 32 // the process dies, and it may be reused by the system, which means that it may |
33 // end up pointing to the wrong process. | 33 // end up pointing to the wrong process. |
34 class BASE_EXPORT Process { | 34 class BASE_EXPORT Process { |
35 MOVE_ONLY_TYPE_FOR_CPP_03(Process, RValue) | 35 MOVE_ONLY_TYPE_FOR_CPP_03(Process) |
36 | 36 |
37 public: | 37 public: |
38 explicit Process(ProcessHandle handle = kNullProcessHandle); | 38 explicit Process(ProcessHandle handle = kNullProcessHandle); |
39 | 39 |
40 // Move constructor for C++03 move emulation of this type. | 40 Process(Process&& other); |
41 Process(RValue other); | |
42 | 41 |
43 // The destructor does not terminate the process. | 42 // The destructor does not terminate the process. |
44 ~Process(); | 43 ~Process(); |
45 | 44 |
46 // Move operator= for C++03 move emulation of this type. | 45 Process& operator=(Process&& other); |
47 Process& operator=(RValue other); | |
48 | 46 |
49 // Returns an object for the current process. | 47 // Returns an object for the current process. |
50 static Process Current(); | 48 static Process Current(); |
51 | 49 |
52 // Returns a Process for the given |pid|. | 50 // Returns a Process for the given |pid|. |
53 static Process Open(ProcessId pid); | 51 static Process Open(ProcessId pid); |
54 | 52 |
55 // Returns a Process for the given |pid|. On Windows the handle is opened | 53 // Returns a Process for the given |pid|. On Windows the handle is opened |
56 // with more access rights and must only be used by trusted code (can read the | 54 // with more access rights and must only be used by trusted code (can read the |
57 // address space and duplicate handles). | 55 // address space and duplicate handles). |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Exposed for testing. | 136 // Exposed for testing. |
139 // Given the contents of the /proc/<pid>/cgroup file, determine whether the | 137 // Given the contents of the /proc/<pid>/cgroup file, determine whether the |
140 // process is backgrounded or not. | 138 // process is backgrounded or not. |
141 BASE_EXPORT bool IsProcessBackgroundedCGroup( | 139 BASE_EXPORT bool IsProcessBackgroundedCGroup( |
142 const StringPiece& cgroup_contents); | 140 const StringPiece& cgroup_contents); |
143 #endif // defined(OS_CHROMEOS) | 141 #endif // defined(OS_CHROMEOS) |
144 | 142 |
145 } // namespace base | 143 } // namespace base |
146 | 144 |
147 #endif // BASE_PROCESS_PROCESS_H_ | 145 #endif // BASE_PROCESS_PROCESS_H_ |
OLD | NEW |