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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // Close the process handle. This will not terminate the process. | 95 // Close the process handle. This will not terminate the process. |
96 void Close(); | 96 void Close(); |
97 | 97 |
98 // Terminates the process with extreme prejudice. The given |exit_code| will | 98 // Terminates the process with extreme prejudice. The given |exit_code| will |
99 // be the exit code of the process. If |wait| is true, this method will wait | 99 // be the exit code of the process. If |wait| is true, this method will wait |
100 // for up to one minute for the process to actually terminate. | 100 // for up to one minute for the process to actually terminate. |
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 // Terminates the current process immediately with |exit_code|. | |
106 void TerminateCurrentProcessImmediately(int exit_code) const; | |
Primiano Tucci (use gerrit)
2017/01/16 14:37:34
+static (and move up with the other statics) as th
| |
107 | |
105 // Waits for the process to exit. Returns true on success. | 108 // 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. | 109 // 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 | 110 // On Linux this must be a child process, however on Mac and Windows it can be |
108 // any process. | 111 // any process. |
109 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code is | 112 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code is |
110 // not required. | 113 // not required. |
111 bool WaitForExit(int* exit_code) const; | 114 bool WaitForExit(int* exit_code) const; |
112 | 115 |
113 // Same as WaitForExit() but only waits for up to |timeout|. | 116 // Same as WaitForExit() but only waits for up to |timeout|. |
114 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code | 117 // NOTE: |exit_code| is optional, nullptr can be passed if the exit code |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 // Exposed for testing. | 176 // Exposed for testing. |
174 // Given the contents of the /proc/<pid>/cgroup file, determine whether the | 177 // Given the contents of the /proc/<pid>/cgroup file, determine whether the |
175 // process is backgrounded or not. | 178 // process is backgrounded or not. |
176 BASE_EXPORT bool IsProcessBackgroundedCGroup( | 179 BASE_EXPORT bool IsProcessBackgroundedCGroup( |
177 const StringPiece& cgroup_contents); | 180 const StringPiece& cgroup_contents); |
178 #endif // defined(OS_CHROMEOS) | 181 #endif // defined(OS_CHROMEOS) |
179 | 182 |
180 } // namespace base | 183 } // namespace base |
181 | 184 |
182 #endif // BASE_PROCESS_PROCESS_H_ | 185 #endif // BASE_PROCESS_PROCESS_H_ |
OLD | NEW |