summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjorgelo@chromium.org <jorgelo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 22:42:01 +0000
committerjorgelo@chromium.org <jorgelo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-22 22:42:01 +0000
commit0dd57a7c00a959bcd172d6a99b605a2a9cc2715f (patch)
tree83002df31bfff8c797f445b4444850a1373a3103
parentd3340bf51a890f48cfb211e6268a0c92aabadad4 (diff)
downloadchromium_src-0dd57a7c00a959bcd172d6a99b605a2a9cc2715f.zip
chromium_src-0dd57a7c00a959bcd172d6a99b605a2a9cc2715f.tar.gz
chromium_src-0dd57a7c00a959bcd172d6a99b605a2a9cc2715f.tar.bz2
SandboxIPCProcess: make shutdown mechanism explicit.
In order to move SandboxIPCProcess into a thread, we need a mechanism to make that thread exit. BUG=322185 TEST=content_shell loads webpages, browser shuts down correctly. Review URL: https://codereview.chromium.org/291173009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272350 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_sandbox_host_linux.cc8
-rw-r--r--content/browser/renderer_host/render_sandbox_host_linux.h2
-rw-r--r--content/browser/renderer_host/sandbox_ipc_linux.cc7
3 files changed, 13 insertions, 4 deletions
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc
index 846ec26..0314ce1 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -70,12 +70,16 @@ void RenderSandboxHostLinux::Init() {
}
}
+bool RenderSandboxHostLinux::ShutdownIPCChannel() {
+ return IGNORE_EINTR(close(childs_lifeline_fd_)) == 0;
+}
+
RenderSandboxHostLinux::~RenderSandboxHostLinux() {
if (initialized_) {
+ if (!ShutdownIPCChannel())
+ LOG(ERROR) << "ShutdownIPCChannel failed";
if (IGNORE_EINTR(close(renderer_socket_)) < 0)
PLOG(ERROR) << "close";
- if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0)
- PLOG(ERROR) << "close";
}
}
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.h b/content/browser/renderer_host/render_sandbox_host_linux.h
index 2119002..c056e8de 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.h
+++ b/content/browser/renderer_host/render_sandbox_host_linux.h
@@ -39,6 +39,8 @@ class CONTENT_EXPORT RenderSandboxHostLinux {
RenderSandboxHostLinux();
~RenderSandboxHostLinux();
+ bool ShutdownIPCChannel();
+
// Whether Init() has been called yet.
bool initialized_;
diff --git a/content/browser/renderer_host/sandbox_ipc_linux.cc b/content/browser/renderer_host/sandbox_ipc_linux.cc
index f156e30..7bcccc9 100644
--- a/content/browser/renderer_host/sandbox_ipc_linux.cc
+++ b/content/browser/renderer_host/sandbox_ipc_linux.cc
@@ -169,15 +169,18 @@ void SandboxIPCProcess::Run() {
failed_polls = 0;
+ // The browser process will close the other end of this pipe on shutdown,
+ // so we should exit.
if (pfds[0].revents) {
- // our parent died so we should too.
- _exit(0);
+ break;
}
if (pfds[1].revents) {
HandleRequestFromRenderer(browser_socket_);
}
}
+
+ VLOG(1) << "SandboxIPCProcess stopping.";
}
void SandboxIPCProcess::HandleRequestFromRenderer(int fd) {