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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Returns true if the process terminates within the allowed time. | 101 // Returns true if the process terminates within the allowed time. |
102 // NOTE: On POSIX |exit_code| is ignored. | 102 // NOTE: On POSIX |exit_code| is ignored. |
103 bool Terminate(int exit_code, bool wait) const; | 103 bool Terminate(int exit_code, bool wait) const; |
104 | 104 |
105 // Waits for the process to exit. Returns true on success. | 105 // Waits for the process to exit. Returns true on success. |
106 // On POSIX, if the process has been signaled then |exit_code| is set to -1. | 106 // On POSIX, if the process has been signaled then |exit_code| is set to -1. |
107 // On Linux this must be a child process, however on Mac and Windows it can be | 107 // On Linux this must be a child process, however on Mac and Windows it can be |
108 // any process. | 108 // any process. |
109 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code is | 109 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code is |
110 // not required. | 110 // not required. |
111 bool WaitForExit(int* exit_code); | 111 bool WaitForExit(int* exit_code) const; |
112 | 112 |
113 // Same as WaitForExit() but only waits for up to |timeout|. | 113 // Same as WaitForExit() but only waits for up to |timeout|. |
114 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code | 114 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code |
115 // is not required. | 115 // is not required. |
116 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); | 116 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) const; |
117 | 117 |
118 #if defined(OS_MACOSX) | 118 #if defined(OS_MACOSX) |
119 // The Mac needs a Mach port in order to manipulate a process's priority, | 119 // The Mac needs a Mach port in order to manipulate a process's priority, |
120 // and there's no good way to get that from base given the pid. These Mac | 120 // and there's no good way to get that from base given the pid. These Mac |
121 // variants of the IsProcessBackgrounded and SetProcessBackgrounded API take | 121 // variants of the IsProcessBackgrounded and SetProcessBackgrounded API take |
122 // a port provider for this reason. See crbug.com/460102 | 122 // a port provider for this reason. See crbug.com/460102 |
123 // | 123 // |
124 // A process is backgrounded when its task priority is | 124 // A process is backgrounded when its task priority is |
125 // |TASK_BACKGROUND_APPLICATION|. | 125 // |TASK_BACKGROUND_APPLICATION|. |
126 // | 126 // |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Exposed for testing. | 173 // Exposed for testing. |
174 // Given the contents of the /proc/<pid>/cgroup file, determine whether the | 174 // Given the contents of the /proc/<pid>/cgroup file, determine whether the |
175 // process is backgrounded or not. | 175 // process is backgrounded or not. |
176 BASE_EXPORT bool IsProcessBackgroundedCGroup( | 176 BASE_EXPORT bool IsProcessBackgroundedCGroup( |
177 const StringPiece& cgroup_contents); | 177 const StringPiece& cgroup_contents); |
178 #endif // defined(OS_CHROMEOS) | 178 #endif // defined(OS_CHROMEOS) |
179 | 179 |
180 } // namespace base | 180 } // namespace base |
181 | 181 |
182 #endif // BASE_PROCESS_PROCESS_H_ | 182 #endif // BASE_PROCESS_PROCESS_H_ |
OLD | NEW |