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

Unified Diff: content/zygote/zygote_linux.cc

Issue 19231006: chrome: respect --child-clean-exit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch is now working. Created 7 years, 5 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 | « content/child/child_thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/zygote/zygote_linux.cc
diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc
index 893002281218e863a33bfeca97cab5f949d23efe..b8cec023c64bb9cf265ee13b7fb41490da85653e 100644
--- a/content/zygote/zygote_linux.cc
+++ b/content/zygote/zygote_linux.cc
@@ -5,6 +5,7 @@
#include "content/zygote/zygote_linux.h"
#include <fcntl.h>
+#include <pthread.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
@@ -24,6 +25,7 @@
#include "content/common/set_process_title.h"
#include "content/common/zygote_commands_linux.h"
#include "content/public/common/content_descriptors.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/sandbox_linux.h"
#include "content/public/common/zygote_fork_delegate_linux.h"
@@ -110,7 +112,12 @@ bool Zygote::HandleRequestFromBrowser(int fd) {
if (len == 0 || (len == -1 && errno == ECONNRESET)) {
// EOF from the browser. We should die.
- _exit(0);
+ if (CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kChildCleanExit))
+ // Wait for all children to exit first.
Markus (顧孟勤) 2013/07/18 23:26:47 This comment is super confusing. This might very w
asharif1 2013/07/19 03:01:32 I will try to clarify this comment in the next pat
+ pthread_exit(NULL);
jln (very slow on Chromium) 2013/07/18 23:26:05 What are you trying to do here ? You're exiting t
asharif1 2013/07/19 03:01:32 Although this process seems single-threaded, close
+ else
+ _exit(0);
return false;
}
@@ -175,7 +182,10 @@ void Zygote::HandleReapRequest(int fd,
actual_child = child;
}
- base::EnsureProcessTerminated(actual_child);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kChildCleanExit))
+ base::EnsureProcessGetsReaped(actual_child);
+ else
+ base::EnsureProcessTerminated(actual_child);
}
void Zygote::HandleGetTerminationStatus(int fd,
« no previous file with comments | « content/child/child_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698