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

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

Issue 983963002: Redefine base::Process:Terminate so that it can replace base::KillProcess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add const Created 5 years, 9 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 | « base/process/process.h ('k') | base/process/process_unittest.cc » ('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) 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 <sys/resource.h> 7 #include <sys/resource.h>
8 #include <sys/wait.h> 8 #include <sys/wait.h>
9 9
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 return process_ == GetCurrentProcessHandle(); 280 return process_ == GetCurrentProcessHandle();
281 } 281 }
282 282
283 void Process::Close() { 283 void Process::Close() {
284 process_ = kNullProcessHandle; 284 process_ = kNullProcessHandle;
285 // if the process wasn't terminated (so we waited) or the state 285 // if the process wasn't terminated (so we waited) or the state
286 // wasn't already collected w/ a wait from process_utils, we're gonna 286 // wasn't already collected w/ a wait from process_utils, we're gonna
287 // end up w/ a zombie when it does finally exit. 287 // end up w/ a zombie when it does finally exit.
288 } 288 }
289 289
290 void Process::Terminate(int result_code) { 290 bool Process::Terminate(int result_code, bool wait) const {
291 // result_code isn't supportable. 291 // result_code isn't supportable.
292 DCHECK(IsValid()); 292 DCHECK(IsValid());
293 // We don't wait here. It's the responsibility of other code to reap the 293 // We don't wait here. It's the responsibility of other code to reap the
294 // child. 294 // child.
295 KillProcess(process_, result_code, false); 295 // TODO(rvargas) crbug/417532: Move the implementation here.
296 return KillProcess(process_, result_code, wait);
296 } 297 }
297 298
298 bool Process::WaitForExit(int* exit_code) { 299 bool Process::WaitForExit(int* exit_code) {
299 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code); 300 return WaitForExitWithTimeout(TimeDelta::Max(), exit_code);
300 } 301 }
301 302
302 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) { 303 bool Process::WaitForExitWithTimeout(TimeDelta timeout, int* exit_code) {
303 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout); 304 return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout);
304 } 305 }
305 306
(...skipping 12 matching lines...) Expand all
318 return false; 319 return false;
319 } 320 }
320 #endif // !defined(OS_LINUX) 321 #endif // !defined(OS_LINUX)
321 322
322 int Process::GetPriority() const { 323 int Process::GetPriority() const {
323 DCHECK(IsValid()); 324 DCHECK(IsValid());
324 return getpriority(PRIO_PROCESS, process_); 325 return getpriority(PRIO_PROCESS, process_);
325 } 326 }
326 327
327 } // namspace base 328 } // namspace base
OLDNEW
« no previous file with comments | « base/process/process.h ('k') | base/process/process_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698