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

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

Issue 759903002: Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chrome build Created 6 years 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/kill_mac.cc ('k') | base/process/kill_win.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) 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 <signal.h> 7 #include <signal.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/wait.h> 9 #include <sys/wait.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 const pid_t child_; 456 const pid_t child_;
457 // Number of seconds to wait, if 0 then wait forever and do not attempt to 457 // Number of seconds to wait, if 0 then wait forever and do not attempt to
458 // kill |child_|. 458 // kill |child_|.
459 const unsigned timeout_; 459 const unsigned timeout_;
460 460
461 DISALLOW_COPY_AND_ASSIGN(BackgroundReaper); 461 DISALLOW_COPY_AND_ASSIGN(BackgroundReaper);
462 }; 462 };
463 463
464 } // namespace 464 } // namespace
465 465
466 void EnsureProcessTerminated(ProcessHandle process) { 466 void EnsureProcessTerminated(Process process) {
467 // If the child is already dead, then there's nothing to do. 467 // If the child is already dead, then there's nothing to do.
468 if (IsChildDead(process)) 468 if (IsChildDead(process.pid()))
469 return; 469 return;
470 470
471 const unsigned timeout = 2; // seconds 471 const unsigned timeout = 2; // seconds
472 BackgroundReaper* reaper = new BackgroundReaper(process, timeout); 472 BackgroundReaper* reaper = new BackgroundReaper(process.pid(), timeout);
473 PlatformThread::CreateNonJoinable(0, reaper); 473 PlatformThread::CreateNonJoinable(0, reaper);
474 } 474 }
475 475
476 void EnsureProcessGetsReaped(ProcessHandle process) { 476 void EnsureProcessGetsReaped(ProcessHandle process) {
477 // If the child is already dead, then there's nothing to do. 477 // If the child is already dead, then there's nothing to do.
478 if (IsChildDead(process)) 478 if (IsChildDead(process))
479 return; 479 return;
480 480
481 BackgroundReaper* reaper = new BackgroundReaper(process, 0); 481 BackgroundReaper* reaper = new BackgroundReaper(process, 0);
482 PlatformThread::CreateNonJoinable(0, reaper); 482 PlatformThread::CreateNonJoinable(0, reaper);
483 } 483 }
484 484
485 #endif // !defined(OS_MACOSX) 485 #endif // !defined(OS_MACOSX)
486 #endif // !defined(OS_NACL_NONSFI) 486 #endif // !defined(OS_NACL_NONSFI)
487 487
488 } // namespace base 488 } // namespace base
OLDNEW
« no previous file with comments | « base/process/kill_mac.cc ('k') | base/process/kill_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698