Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // Terminates the process with extreme prejudice. The given |exit_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 |exit_code| is ignored. | 98 // NOTE: On POSIX |exit_code| is ignored. |
| 99 bool Terminate(int exit_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. exit_code is optional if exit_code is not required NULL can be |
|
Lei Zhang
2015/05/06 08:05:15
We refer to variables as |variable_name|. See line
Lei Zhang
2015/05/06 08:05:15
The grammar here needs some work.
g.mehndiratt
2015/05/06 10:52:35
On 2015/05/06 08:05:15, Lei Zhang wrote:
Acknowle
g.mehndiratt
2015/05/06 10:52:35
On 2015/05/06 08:05:15, Lei Zhang wrote:
Acknowle
| |
| 105 // passed. | |
| 105 bool WaitForExit(int* exit_code); | 106 bool WaitForExit(int* exit_code); |
| 106 | 107 |
| 107 // Same as WaitForExit() but only waits for up to |timeout|. | 108 // Same as WaitForExit() but only waits for up to |timeout|. |
| 109 // exit_code is optional if exit_code is not required NULL can be passed. | |
| 108 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); | 110 bool WaitForExitWithTimeout(TimeDelta timeout, int* exit_code); |
| 109 | 111 |
| 110 // A process is backgrounded when it's priority is lower than normal. | 112 // A process is backgrounded when it's priority is lower than normal. |
| 111 // Return true if this process is backgrounded, false otherwise. | 113 // Return true if this process is backgrounded, false otherwise. |
| 112 bool IsProcessBackgrounded() const; | 114 bool IsProcessBackgrounded() const; |
| 113 | 115 |
| 114 // Set a process as backgrounded. If value is true, the priority of the | 116 // Set a process as backgrounded. If value is true, the priority of the |
| 115 // process will be lowered. If value is false, the priority of the process | 117 // process will be lowered. If value is false, the priority of the process |
| 116 // will be made "normal" - equivalent to default process priority. | 118 // will be made "normal" - equivalent to default process priority. |
| 117 // Returns true if the priority was changed, false otherwise. | 119 // Returns true if the priority was changed, false otherwise. |
| 118 bool SetProcessBackgrounded(bool value); | 120 bool SetProcessBackgrounded(bool value); |
| 119 | 121 |
| 120 // Returns an integer representing the priority of a process. The meaning | 122 // Returns an integer representing the priority of a process. The meaning |
| 121 // of this value is OS dependent. | 123 // of this value is OS dependent. |
| 122 int GetPriority() const; | 124 int GetPriority() const; |
| 123 | 125 |
| 124 private: | 126 private: |
| 125 #if defined(OS_WIN) | 127 #if defined(OS_WIN) |
| 126 bool is_current_process_; | 128 bool is_current_process_; |
| 127 win::ScopedHandle process_; | 129 win::ScopedHandle process_; |
| 128 #else | 130 #else |
| 129 ProcessHandle process_; | 131 ProcessHandle process_; |
| 130 #endif | 132 #endif |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 } // namespace base | 135 } // namespace base |
| 134 | 136 |
| 135 #endif // BASE_PROCESS_PROCESS_H_ | 137 #endif // BASE_PROCESS_PROCESS_H_ |
| OLD | NEW |