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

Unified Diff: content/browser/zygote_host/zygote_host_impl_linux.cc

Issue 148443006: Linux: tear down Zygote at browser shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/browser/zygote_host/zygote_host_impl_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/zygote_host/zygote_host_impl_linux.cc
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
index 044dedc9efa578aaf4a8249f0d914b99c5085bda..daae1068cf1ace9e665f6d5e04f0117e8dd34d90 100644
--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -59,8 +59,7 @@ ZygoteHostImpl::ZygoteHostImpl()
sandbox_status_(0) {}
ZygoteHostImpl::~ZygoteHostImpl() {
- if (init_)
- close(control_fd_);
+ TearDown();
}
// static
@@ -217,6 +216,18 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
// We don't wait for the reply. We'll read it in ReadReply.
}
+void ZygoteHostImpl::TearDown() {
+ if (init_) {
+ // Closing the IPC channel will act as a notification to exit
+ // to the Zygote.
+ if (IGNORE_EINTR(close(control_fd_))) {
+ PLOG(ERROR) << "Could not close Zygote control channel.";
+ NOTREACHED();
+ }
piman 2014/01/28 02:20:44 nit: maybe reset control_fd_ to -1 for added defen
jln (very slow on Chromium) 2014/01/28 02:52:45 Done. I hadn't done it because "init_" is checked
+ init_ = false;
+ }
+}
+
bool ZygoteHostImpl::SendMessage(const Pickle& data,
const std::vector<int>* fds) {
CHECK(data.size() <= kZygoteMaxMessageLength)
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698