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 #include "base/process/process.h" | 5 #include "base/process/process.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 void Process::Close() { | 118 void Process::Close() { |
119 is_current_process_ = false; | 119 is_current_process_ = false; |
120 if (!process_.IsValid()) | 120 if (!process_.IsValid()) |
121 return; | 121 return; |
122 | 122 |
123 process_.Close(); | 123 process_.Close(); |
124 } | 124 } |
125 | 125 |
126 void Process::Terminate(int result_code) { | 126 bool Process::Terminate(int result_code, bool wait) const { |
127 ::TerminateProcess(Handle(), result_code); | 127 DCHECK(IsValid()); |
| 128 // TODO(rvargas) crbug/417532: Move the implementation here. |
| 129 return KillProcess(Handle(), result_code, wait); |
128 } | 130 } |
129 | 131 |
130 bool Process::WaitForExit(int* exit_code) { | 132 bool Process::WaitForExit(int* exit_code) { |
131 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(INFINITE), | 133 return WaitForExitWithTimeout(TimeDelta::FromMilliseconds(INFINITE), |
132 exit_code); | 134 exit_code); |
133 } | 135 } |
134 | 136 |
135 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { | 137 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { |
136 // Limit timeout to INFINITE. | 138 // Limit timeout to INFINITE. |
137 DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds()); | 139 DWORD timeout_ms = saturated_cast<DWORD>(timeout.InMilliseconds()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 186 |
185 return (::SetPriorityClass(Handle(), priority) != 0); | 187 return (::SetPriorityClass(Handle(), priority) != 0); |
186 } | 188 } |
187 | 189 |
188 int Process::GetPriority() const { | 190 int Process::GetPriority() const { |
189 DCHECK(IsValid()); | 191 DCHECK(IsValid()); |
190 return ::GetPriorityClass(Handle()); | 192 return ::GetPriorityClass(Handle()); |
191 } | 193 } |
192 | 194 |
193 } // namespace base | 195 } // namespace base |
OLD | NEW |