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_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 23 matching lines...) Expand all Loading... |
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, RValue) |
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 // Move constructor for C++03 move emulation of this type. |
41 Process(RValue other); | 41 Process(RValue other); |
42 | 42 |
43 // The destructor does not terminate the process. | 43 // The destructor does not terminate the process. |
44 ~Process() {} | 44 ~Process(); |
45 | 45 |
46 // Move operator= for C++03 move emulation of this type. | 46 // Move operator= for C++03 move emulation of this type. |
47 Process& operator=(RValue other); | 47 Process& operator=(RValue other); |
48 | 48 |
49 // Returns an object for the current process. | 49 // Returns an object for the current process. |
50 static Process Current(); | 50 static Process Current(); |
51 | 51 |
52 // Returns a Process for the given |pid|. | 52 // Returns a Process for the given |pid|. |
53 static Process Open(ProcessId pid); | 53 static Process Open(ProcessId pid); |
54 | 54 |
(...skipping 29 matching lines...) Expand all Loading... |
84 | 84 |
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 |exit_code| will |
95 // be the exit code of the process. If |wait| is true, this method will wait | 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. | 96 // for up to one minute for the process to actually terminate. |
97 // Returns true if the process terminates within the allowed time. | 97 // Returns true if the process terminates within the allowed time. |
98 // NOTE: On POSIX |result_code| is ignored. | 98 // NOTE: On POSIX |exit_code| is ignored. |
99 bool Terminate(int result_code, bool wait) const; | 99 bool Terminate(int exit_code, bool wait) const; |
100 | 100 |
101 // Waits for the process to exit. Returns true on success. | 101 // Waits for the process to exit. Returns true on success. |
102 // 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. |
103 // 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 |
104 // any process. | 104 // any process. |
105 bool WaitForExit(int* exit_code); | 105 bool WaitForExit(int* exit_code); |
106 | 106 |
107 // Same as WaitForExit() but only waits for up to |timeout|. | 107 // Same as WaitForExit() but only waits for up to |timeout|. |
108 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); | 108 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); |
109 | 109 |
(...skipping 16 matching lines...) Expand all Loading... |
126 bool is_current_process_; | 126 bool is_current_process_; |
127 win::ScopedHandle process_; | 127 win::ScopedHandle process_; |
128 #else | 128 #else |
129 ProcessHandle process_; | 129 ProcessHandle process_; |
130 #endif | 130 #endif |
131 }; | 131 }; |
132 | 132 |
133 } // namespace base | 133 } // namespace base |
134 | 134 |
135 #endif // BASE_PROCESS_PROCESS_H_ | 135 #endif // BASE_PROCESS_PROCESS_H_ |
OLD | NEW |