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_PROCESS_PROCESS_H_ | 5 #ifndef BASE_PROCESS_PROCESS_H_ |
6 #define BASE_PROCESS_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" |
11 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 | 14 |
15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
16 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Get the PID for this process. | 85 // Get the PID for this process. |
86 ProcessId Pid() const; | 86 ProcessId Pid() const; |
87 | 87 |
88 // Returns true if this process is the current process. | 88 // Returns true if this process is the current process. |
89 bool is_current() const; | 89 bool is_current() const; |
90 | 90 |
91 // Close the process handle. This will not terminate the process. | 91 // Close the process handle. This will not terminate the process. |
92 void Close(); | 92 void Close(); |
93 | 93 |
94 // Terminates the process with extreme prejudice. The given |result_code| will | 94 // Terminates the process with extreme prejudice. The given |result_code| will |
95 // be the exit code of the process. | 95 // be the exit code of the process. If |wait| is true, this method will wait |
| 96 // for up to one minute for the process to actually terminate. |
| 97 // Returns true if the process terminates within the allowed time. |
96 // NOTE: On POSIX |result_code| is ignored. | 98 // NOTE: On POSIX |result_code| is ignored. |
97 void Terminate(int result_code); | 99 bool Terminate(int result_code, bool wait) const; |
98 | 100 |
99 // Waits for the process to exit. Returns true on success. | 101 // Waits for the process to exit. Returns true on success. |
100 // On POSIX, if the process has been signaled then |exit_code| is set to -1. | 102 // On POSIX, if the process has been signaled then |exit_code| is set to -1. |
101 // On Linux this must be a child process, however on Mac and Windows it can be | 103 // On Linux this must be a child process, however on Mac and Windows it can be |
102 // any process. | 104 // any process. |
103 bool WaitForExit(int* exit_code); | 105 bool WaitForExit(int* exit_code); |
104 | 106 |
105 // Same as WaitForExit() but only waits for up to |timeout|. | 107 // Same as WaitForExit() but only waits for up to |timeout|. |
106 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); | 108 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); |
107 | 109 |
(...skipping 15 matching lines...) Expand all Loading... |
123 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
124 bool is_current_process_; | 126 bool is_current_process_; |
125 win::ScopedHandle process_; | 127 win::ScopedHandle process_; |
126 #else | 128 #else |
127 ProcessHandle process_; | 129 ProcessHandle process_; |
128 #endif | 130 #endif |
129 }; | 131 }; |
130 | 132 |
131 } // namespace base | 133 } // namespace base |
132 | 134 |
133 #endif // BASE_PROCESS_PROCESS_PROCESS_H_ | 135 #endif // BASE_PROCESS_PROCESS_H_ |
OLD | NEW |