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

Unified Diff: content/browser/renderer_host/render_sandbox_host_linux.cc

Issue 286903021: Make SandboxIPCProcess a thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Close FDs in ::~SandboxIPCHandler(). Created 6 years, 7 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
Index: content/browser/renderer_host/render_sandbox_host_linux.cc
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc
index 0314ce1846836a3f1bf556faead40ad568861d48..10f3fea0b6b2ab2e074619fa1f61eb431d014bed 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -8,16 +8,12 @@
#include "base/memory/singleton.h"
#include "base/posix/eintr_wrapper.h"
-#include "content/browser/renderer_host/sandbox_ipc_linux.h"
namespace content {
// Runs on the main thread at startup.
RenderSandboxHostLinux::RenderSandboxHostLinux()
- : initialized_(false),
- renderer_socket_(0),
- childs_lifeline_fd_(0),
- pid_(0) {
+ : initialized_(false), renderer_socket_(0), childs_lifeline_fd_(0) {
}
// static
@@ -53,21 +49,11 @@ void RenderSandboxHostLinux::Init() {
const int child_lifeline_fd = pipefds[0];
childs_lifeline_fd_ = pipefds[1];
- // We need to be monothreaded before we fork().
-#if !defined(THREAD_SANITIZER)
- DCHECK_EQ(1, base::GetNumberOfThreads(base::GetCurrentProcessHandle()));
-#endif // !defined(THREAD_SANITIZER)
- pid_ = fork();
- if (pid_ == 0) {
- if (IGNORE_EINTR(close(fds[0])) < 0)
- DPLOG(ERROR) << "close";
- if (IGNORE_EINTR(close(pipefds[1])) < 0)
- DPLOG(ERROR) << "close";
-
- SandboxIPCProcess handler(child_lifeline_fd, browser_socket);
- handler.Run();
- _exit(0);
- }
+ ipc_handler_.reset(
+ new SandboxIPCHandler(child_lifeline_fd, browser_socket));
+ ipc_thread_.reset(
+ new base::DelegateSimpleThread(ipc_handler_.get(), "sandbox_ipc_thread"));
+ ipc_thread_->Start();
}
bool RenderSandboxHostLinux::ShutdownIPCChannel() {
@@ -80,6 +66,8 @@ RenderSandboxHostLinux::~RenderSandboxHostLinux() {
LOG(ERROR) << "ShutdownIPCChannel failed";
if (IGNORE_EINTR(close(renderer_socket_)) < 0)
PLOG(ERROR) << "close";
+
+ ipc_thread_->Join();
}
}
« no previous file with comments | « content/browser/renderer_host/render_sandbox_host_linux.h ('k') | content/browser/renderer_host/sandbox_ipc_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698