Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: base/process/kill_win.cc

Issue 874773002: Remove CloseProcessHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/process/process_handle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/kill.h" 5 #include "base/process/kill.h"
6 6
7 #include <io.h> 7 #include <io.h>
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 case kDebuggerTerminatedExitCode: // Debugger terminated process. 175 case kDebuggerTerminatedExitCode: // Debugger terminated process.
176 case kProcessKilledExitCode: // Task manager kill. 176 case kProcessKilledExitCode: // Task manager kill.
177 return TERMINATION_STATUS_PROCESS_WAS_KILLED; 177 return TERMINATION_STATUS_PROCESS_WAS_KILLED;
178 default: 178 default:
179 // All other exit codes indicate crashes. 179 // All other exit codes indicate crashes.
180 return TERMINATION_STATUS_PROCESS_CRASHED; 180 return TERMINATION_STATUS_PROCESS_CRASHED;
181 } 181 }
182 } 182 }
183 183
184 bool WaitForExitCode(ProcessHandle handle, int* exit_code) { 184 bool WaitForExitCode(ProcessHandle handle, int* exit_code) {
185 bool success = WaitForExitCodeWithTimeout( 185 // TODO(rvargas) crbug.com/417532: Remove this function.
186 handle, exit_code, base::TimeDelta::FromMilliseconds(INFINITE)); 186 Process process(handle);
187 CloseProcessHandle(handle); 187 return process.WaitForExit(exit_code);
188 return success;
189 } 188 }
190 189
191 bool WaitForExitCodeWithTimeout(ProcessHandle handle, 190 bool WaitForExitCodeWithTimeout(ProcessHandle handle,
192 int* exit_code, 191 int* exit_code,
193 base::TimeDelta timeout) { 192 base::TimeDelta timeout) {
194 if (::WaitForSingleObject( 193 if (::WaitForSingleObject(
195 handle, static_cast<DWORD>(timeout.InMilliseconds())) != WAIT_OBJECT_0) 194 handle, static_cast<DWORD>(timeout.InMilliseconds())) != WAIT_OBJECT_0)
196 return false; 195 return false;
197 DWORD temp_code; // Don't clobber out-parameters in case of failure. 196 DWORD temp_code; // Don't clobber out-parameters in case of failure.
198 if (!::GetExitCodeProcess(handle, &temp_code)) 197 if (!::GetExitCodeProcess(handle, &temp_code))
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 248 }
250 249
251 MessageLoop::current()->PostDelayedTask( 250 MessageLoop::current()->PostDelayedTask(
252 FROM_HERE, 251 FROM_HERE,
253 base::Bind(&TimerExpiredTask::TimedOut, 252 base::Bind(&TimerExpiredTask::TimedOut,
254 base::Owned(new TimerExpiredTask(process.Pass()))), 253 base::Owned(new TimerExpiredTask(process.Pass()))),
255 base::TimeDelta::FromMilliseconds(kWaitInterval)); 254 base::TimeDelta::FromMilliseconds(kWaitInterval));
256 } 255 }
257 256
258 } // namespace base 257 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/process/process_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698