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

Unified Diff: content/browser/renderer_host/sandbox_ipc_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/sandbox_ipc_linux.cc
diff --git a/content/browser/renderer_host/sandbox_ipc_linux.cc b/content/browser/renderer_host/sandbox_ipc_linux.cc
index ad1747e01736ec41d009c825a9562f8b3b8708d0..8a4ff8d6579d8623aaaddc642cfa99f8ee9612e4 100644
--- a/content/browser/renderer_host/sandbox_ipc_linux.cc
+++ b/content/browser/renderer_host/sandbox_ipc_linux.cc
@@ -127,10 +127,9 @@ static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) {
namespace content {
-SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd,
- int browser_socket,
+SandboxIPCHandler::SandboxIPCHandler(int browser_socket,
std::string sandbox_cmd)
- : lifeline_fd_(lifeline_fd), browser_socket_(browser_socket) {
+ : browser_socket_(browser_socket) {
if (!sandbox_cmd.empty()) {
sandbox_cmd_.push_back(sandbox_cmd);
sandbox_cmd_.push_back(base::kFindInodeSwitch);
@@ -140,23 +139,12 @@ SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd,
// positioning, so we pass the current setting through to WebKit.
WebFontInfo::setSubpixelPositioning(
gfx::GetDefaultWebkitSubpixelPositioning());
-
- CommandLine& command_line = *CommandLine::ForCurrentProcess();
- command_line.AppendSwitchASCII(switches::kProcessType,
- switches::kSandboxIPCProcess);
-
- // Update the process title. The argv was already cached by the call to
- // SetProcessTitleFromCommandLine in content_main_runner.cc, so we can pass
- // NULL here (we don't have the original argv at this point).
- SetProcessTitleFromCommandLine(NULL);
}
-void SandboxIPCProcess::Run() {
- struct pollfd pfds[2];
- pfds[0].fd = lifeline_fd_;
+void SandboxIPCHandler::Run() {
+ struct pollfd pfds[1];
+ pfds[0].fd = browser_socket_;
pfds[0].events = POLLIN;
- pfds[1].fd = browser_socket_;
- pfds[1].events = POLLIN;
int failed_polls = 0;
for (;;) {
@@ -166,7 +154,7 @@ void SandboxIPCProcess::Run() {
if (r < 0) {
PLOG(WARNING) << "poll";
if (failed_polls++ == 3) {
- LOG(FATAL) << "poll(2) failing. RenderSandboxHostLinux aborting.";
+ LOG(FATAL) << "poll(2) failing. SandboxIPCHandler aborting.";
return;
piman 2014/04/29 00:25:46 How do we ever exit the thread?
Jorge Lucangeli Obes 2014/04/29 20:51:10 Done.
}
continue;
@@ -175,17 +163,12 @@ void SandboxIPCProcess::Run() {
failed_polls = 0;
if (pfds[0].revents) {
- // our parent died so we should too.
- _exit(0);
- }
-
- if (pfds[1].revents) {
HandleRequestFromRenderer(browser_socket_);
}
}
}
-void SandboxIPCProcess::HandleRequestFromRenderer(int fd) {
+void SandboxIPCHandler::HandleRequestFromRenderer(int fd) {
std::vector<int> fds;
// A FontConfigIPC::METHOD_MATCH message could be kMaxFontFamilyLength
@@ -234,7 +217,7 @@ error:
}
}
-int SandboxIPCProcess::FindOrAddPath(const SkString& path) {
+int SandboxIPCHandler::FindOrAddPath(const SkString& path) {
int count = paths_.count();
for (int i = 0; i < count; ++i) {
if (path == *paths_[i])
@@ -244,7 +227,7 @@ int SandboxIPCProcess::FindOrAddPath(const SkString& path) {
return count;
}
-void SandboxIPCProcess::HandleFontMatchRequest(int fd,
+void SandboxIPCHandler::HandleFontMatchRequest(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -283,7 +266,7 @@ void SandboxIPCProcess::HandleFontMatchRequest(int fd,
SendRendererReply(fds, reply, -1);
}
-void SandboxIPCProcess::HandleFontOpenRequest(int fd,
+void SandboxIPCHandler::HandleFontOpenRequest(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -311,12 +294,12 @@ void SandboxIPCProcess::HandleFontOpenRequest(int fd,
}
}
-void SandboxIPCProcess::HandleGetFontFamilyForChar(int fd,
+void SandboxIPCHandler::HandleGetFontFamilyForChar(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
// The other side of this call is
- // chrome/renderer/renderer_sandbox_support_linux.cc
+ // content/common/child_process_sandbox_support_impl_linux.cc
EnsureWebKitInitialized();
WebUChar32 c;
@@ -341,7 +324,7 @@ void SandboxIPCProcess::HandleGetFontFamilyForChar(int fd,
SendRendererReply(fds, reply, -1);
}
-void SandboxIPCProcess::HandleGetStyleForStrike(int fd,
+void SandboxIPCHandler::HandleGetStyleForStrike(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -369,7 +352,7 @@ void SandboxIPCProcess::HandleGetStyleForStrike(int fd,
SendRendererReply(fds, reply, -1);
}
-void SandboxIPCProcess::HandleLocaltime(int fd,
+void SandboxIPCHandler::HandleLocaltime(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -401,7 +384,7 @@ void SandboxIPCProcess::HandleLocaltime(int fd,
SendRendererReply(fds, reply, -1);
}
-void SandboxIPCProcess::HandleGetChildWithInode(int fd,
+void SandboxIPCHandler::HandleGetChildWithInode(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -435,7 +418,7 @@ void SandboxIPCProcess::HandleGetChildWithInode(int fd,
SendRendererReply(fds, reply, -1);
}
-void SandboxIPCProcess::HandleMakeSharedMemorySegment(int fd,
+void SandboxIPCHandler::HandleMakeSharedMemorySegment(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -454,7 +437,7 @@ void SandboxIPCProcess::HandleMakeSharedMemorySegment(int fd,
SendRendererReply(fds, reply, shm_fd);
}
-void SandboxIPCProcess::HandleMatchWithFallback(int fd,
+void SandboxIPCHandler::HandleMatchWithFallback(int fd,
const Pickle& pickle,
PickleIterator iter,
std::vector<int>& fds) {
@@ -613,7 +596,7 @@ void SandboxIPCProcess::HandleMatchWithFallback(int fd,
}
}
-void SandboxIPCProcess::SendRendererReply(const std::vector<int>& fds,
+void SandboxIPCHandler::SendRendererReply(const std::vector<int>& fds,
const Pickle& reply,
int reply_fd) {
struct msghdr msg;
@@ -648,13 +631,13 @@ void SandboxIPCProcess::SendRendererReply(const std::vector<int>& fds,
PLOG(ERROR) << "sendmsg";
}
-SandboxIPCProcess::~SandboxIPCProcess() {
+SandboxIPCHandler::~SandboxIPCHandler() {
paths_.deleteAll();
if (webkit_platform_support_)
blink::shutdownWithoutV8();
}
-void SandboxIPCProcess::EnsureWebKitInitialized() {
+void SandboxIPCHandler::EnsureWebKitInitialized() {
if (webkit_platform_support_)
return;
webkit_platform_support_.reset(new BlinkPlatformImpl);

Powered by Google App Engine
This is Rietveld 408576698