Commit 58a487b7 authored by mdempsky@chromium.org's avatar mdempsky@chromium.org

Remove SandboxIPCProcess's dependency on chrome-sandbox

Now that we use RecvMsgWithPid to find the PIDs for zygote children,
we no longer need to plumb the chrome-sandbox path down into and
through the renderer host code.

BUG=357670
NOTRY=true

Review URL: https://codereview.chromium.org/276763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269530 0039d316-1c4b-4281-b951-d872f2087c98
parent cd077070
......@@ -164,7 +164,7 @@ void SetupSandbox(const CommandLine& parsed_command_line) {
}
// Tickle the sandbox host and zygote host so they fork now.
RenderSandboxHostLinux::GetInstance()->Init(sandbox_binary.value());
RenderSandboxHostLinux::GetInstance()->Init();
ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value());
}
#endif
......
......@@ -25,7 +25,7 @@ RenderSandboxHostLinux* RenderSandboxHostLinux::GetInstance() {
return Singleton<RenderSandboxHostLinux>::get();
}
void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
void RenderSandboxHostLinux::Init() {
DCHECK(!initialized_);
initialized_ = true;
......@@ -64,7 +64,7 @@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
if (IGNORE_EINTR(close(pipefds[1])) < 0)
DPLOG(ERROR) << "close";
SandboxIPCProcess handler(child_lifeline_fd, browser_socket, sandbox_path);
SandboxIPCProcess handler(child_lifeline_fd, browser_socket);
handler.Run();
_exit(0);
}
......
......@@ -31,7 +31,7 @@ class CONTENT_EXPORT RenderSandboxHostLinux {
DCHECK(initialized_);
return pid_;
}
void Init(const std::string& sandbox_path);
void Init();
private:
friend struct DefaultSingletonTraits<RenderSandboxHostLinux>;
......
......@@ -129,15 +129,8 @@ static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) {
namespace content {
SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd,
int browser_socket,
std::string sandbox_cmd)
SandboxIPCProcess::SandboxIPCProcess(int lifeline_fd, int browser_socket)
: lifeline_fd_(lifeline_fd), browser_socket_(browser_socket) {
if (!sandbox_cmd.empty()) {
sandbox_cmd_.push_back(sandbox_cmd);
sandbox_cmd_.push_back(base::kFindInodeSwitch);
}
// FontConfig doesn't provide a standard property to control subpixel
// positioning, so we pass the current setting through to WebKit.
WebFontInfo::setSubpixelPositioning(
......@@ -220,8 +213,6 @@ void SandboxIPCProcess::HandleRequestFromRenderer(int fd) {
HandleGetFontFamilyForChar(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_LOCALTIME) {
HandleLocaltime(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_CHILD_WITH_INODE) {
HandleGetChildWithInode(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_GET_STYLE_FOR_STRIKE) {
HandleGetStyleForStrike(fd, pickle, iter, fds.get());
} else if (kind == LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT) {
......@@ -403,41 +394,6 @@ void SandboxIPCProcess::HandleLocaltime(
SendRendererReply(fds, reply, -1);
}
void SandboxIPCProcess::HandleGetChildWithInode(
int fd,
const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds) {
// The other side of this call is in zygote_main_linux.cc
if (sandbox_cmd_.empty()) {
LOG(ERROR) << "Not in the sandbox, this should not be called";
return;
}
uint64_t inode;
if (!pickle.ReadUInt64(&iter, &inode))
return;
base::ProcessId pid = 0;
std::string inode_output;
std::vector<std::string> sandbox_cmd = sandbox_cmd_;
sandbox_cmd.push_back(base::Int64ToString(inode));
CommandLine get_inode_cmd(sandbox_cmd);
if (base::GetAppOutput(get_inode_cmd, &inode_output))
base::StringToInt(inode_output, &pid);
if (!pid) {
// Even though the pid is invalid, we still need to reply to the zygote
// and not just return here.
LOG(ERROR) << "Could not get pid";
}
Pickle reply;
reply.WriteInt(pid);
SendRendererReply(fds, reply, -1);
}
void SandboxIPCProcess::HandleMakeSharedMemorySegment(
int fd,
const Pickle& pickle,
......
......@@ -26,9 +26,7 @@ class SandboxIPCProcess {
// point of view of the renderer, it's talking to the browser but this
// object actually services the requests.
// sandbox_cmd: the path of the sandbox executable.
SandboxIPCProcess(int lifeline_fd,
int browser_socket,
std::string sandbox_cmd);
SandboxIPCProcess(int lifeline_fd, int browser_socket);
~SandboxIPCProcess();
void Run();
......@@ -65,11 +63,6 @@ class SandboxIPCProcess {
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleGetChildWithInode(int fd,
const Pickle& pickle,
PickleIterator iter,
const std::vector<base::ScopedFD*>& fds);
void HandleMakeSharedMemorySegment(int fd,
const Pickle& pickle,
PickleIterator iter,
......@@ -86,7 +79,6 @@ class SandboxIPCProcess {
const int lifeline_fd_;
const int browser_socket_;
std::vector<std::string> sandbox_cmd_;
scoped_ptr<BlinkPlatformImpl> webkit_platform_support_;
SkTDArray<SkString*> paths_;
......
......@@ -30,7 +30,7 @@ class LinuxSandbox {
enum LinuxSandboxIPCMethods {
METHOD_GET_FONT_FAMILY_FOR_CHAR = 32,
METHOD_LOCALTIME = 33,
METHOD_GET_CHILD_WITH_INODE = 34,
DEPRECATED_METHOD_GET_CHILD_WITH_INODE = 34,
METHOD_GET_STYLE_FOR_STRIKE = 35,
METHOD_MAKE_SHARED_MEMORY_SEGMENT = 36,
METHOD_MATCH_WITH_FALLBACK = 37,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment