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

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

Issue 255693002: Make SandboxIPCProcess a thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix compile. Created 6 years, 8 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 ff0b1af589caeb32d2583bc4481251c1418f7d27..50cf8c810c2e94c9ea6fc47f8f2773c4d946385d 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) {
}
// static
@@ -41,34 +37,18 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
renderer_socket_ = fds[0];
const int browser_socket = fds[1];
- int pipefds[2];
- CHECK(0 == pipe(pipefds));
- 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)
piman 2014/04/29 00:25:46 Has the zygote been launched at this point?
Jorge Lucangeli Obes 2014/04/30 17:58:20 I don't think that would be an issue. The browser
- 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, sandbox_path);
- handler.Run();
- _exit(0);
- }
+ ipc_handler_.reset(new SandboxIPCHandler(browser_socket, sandbox_path));
+ ipc_thread_.reset(
+ new base::DelegateSimpleThread(ipc_handler_.get(), "sandbox_ipc_thread"));
+ ipc_thread_->Start();
}
RenderSandboxHostLinux::~RenderSandboxHostLinux() {
if (initialized_) {
if (IGNORE_EINTR(close(renderer_socket_)) < 0)
PLOG(ERROR) << "close";
- if (IGNORE_EINTR(close(childs_lifeline_fd_)) < 0)
- PLOG(ERROR) << "close";
+
+ ipc_thread_->Join();
}
}

Powered by Google App Engine
This is Rietveld 408576698