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

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

Issue 670013002: More virtual/override updates in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/message_loop/message_pump_glib.h ('k') | no next file » | 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // A thread class which waits for the given child to exit and reaps it. 408 // A thread class which waits for the given child to exit and reaps it.
409 // If the child doesn't exit within a couple of seconds, kill it. 409 // If the child doesn't exit within a couple of seconds, kill it.
410 class BackgroundReaper : public PlatformThread::Delegate { 410 class BackgroundReaper : public PlatformThread::Delegate {
411 public: 411 public:
412 BackgroundReaper(pid_t child, unsigned timeout) 412 BackgroundReaper(pid_t child, unsigned timeout)
413 : child_(child), 413 : child_(child),
414 timeout_(timeout) { 414 timeout_(timeout) {
415 } 415 }
416 416
417 // Overridden from PlatformThread::Delegate: 417 // Overridden from PlatformThread::Delegate:
418 virtual void ThreadMain() override { 418 void ThreadMain() override {
419 WaitForChildToDie(); 419 WaitForChildToDie();
420 delete this; 420 delete this;
421 } 421 }
422 422
423 void WaitForChildToDie() { 423 void WaitForChildToDie() {
424 // Wait forever case. 424 // Wait forever case.
425 if (timeout_ == 0) { 425 if (timeout_ == 0) {
426 pid_t r = HANDLE_EINTR(waitpid(child_, NULL, 0)); 426 pid_t r = HANDLE_EINTR(waitpid(child_, NULL, 0));
427 if (r != child_) { 427 if (r != child_) {
428 DPLOG(ERROR) << "While waiting for " << child_ 428 DPLOG(ERROR) << "While waiting for " << child_
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(__native_client_nonsfi__) 486 #endif // !defined(__native_client_nonsfi__)
487 487
488 } // namespace base 488 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_glib.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698