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

Unified Diff: chrome/common/process_watcher_posix.cc

Issue 115773: Prototype implementation of zygotes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/ipc_channel_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/process_watcher_posix.cc
===================================================================
--- chrome/common/process_watcher_posix.cc (revision 17632)
+++ chrome/common/process_watcher_posix.cc (working copy)
@@ -11,6 +11,7 @@
#include "base/eintr_wrapper.h"
#include "base/platform_thread.h"
+#include "base/zygote_manager.h"
// Return true if the given child is dead. This will also reap the process.
// Doesn't block.
@@ -69,8 +70,20 @@
// static
void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process) {
// If the child is already dead, then there's nothing to do
- if (IsChildDead(process))
+ const int result = HANDLE_EINTR(waitpid(process, NULL, WNOHANG));
+ if (result > 0)
return;
+ if (result == -1) {
+#if defined(OS_LINUX)
+ // If it wasn't our child, maybe it was the zygote manager's child
+ base::ZygoteManager* zm = base::ZygoteManager::Get();
+ if (zm) {
+ zm->EnsureProcessTerminated(process);
+ return;
+ }
+#endif // defined(OS_LINUX)
+ NOTREACHED();
+ }
BackgroundReaper* reaper = new BackgroundReaper(process);
PlatformThread::CreateNonJoinable(0, reaper);
« no previous file with comments | « chrome/common/ipc_channel_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698