| Index: content/browser/zygote_host/zygote_host_impl_linux.cc
|
| ===================================================================
|
| --- content/browser/zygote_host/zygote_host_impl_linux.cc (revision 163632)
|
| +++ content/browser/zygote_host/zygote_host_impl_linux.cc (working copy)
|
| @@ -39,8 +39,10 @@
|
| #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
|
| #endif
|
|
|
| +namespace content {
|
| +
|
| // static
|
| -content::ZygoteHost* content::ZygoteHost::GetInstance() {
|
| +ZygoteHost* ZygoteHost::GetInstance() {
|
| return ZygoteHostImpl::GetInstance();
|
| }
|
|
|
| @@ -82,7 +84,7 @@
|
| CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
|
| #endif
|
| base::FileHandleMappingVector fds_to_map;
|
| - fds_to_map.push_back(std::make_pair(fds[1], content::kZygoteSocketPairFd));
|
| + fds_to_map.push_back(std::make_pair(fds[1], kZygoteSocketPairFd));
|
|
|
| const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
|
| if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) {
|
| @@ -117,8 +119,7 @@
|
| cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches,
|
| arraysize(kForwardSwitches));
|
|
|
| - content::GetContentClient()->browser()->AppendExtraCommandLineSwitches(
|
| - &cmd_line, -1);
|
| + GetContentClient()->browser()->AppendExtraCommandLineSwitches(&cmd_line, -1);
|
|
|
| sandbox_binary_ = sandbox_cmd.c_str();
|
|
|
| @@ -154,13 +155,13 @@
|
| // Start up the sandbox host process and get the file descriptor for the
|
| // renderers to talk to it.
|
| const int sfd = RenderSandboxHostLinux::GetInstance()->GetRendererSocket();
|
| - fds_to_map.push_back(std::make_pair(sfd, content::kZygoteRendererSocketFd));
|
| + fds_to_map.push_back(std::make_pair(sfd, kZygoteRendererSocketFd));
|
|
|
| int dummy_fd = -1;
|
| if (using_suid_sandbox_) {
|
| dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0);
|
| CHECK(dummy_fd >= 0);
|
| - fds_to_map.push_back(std::make_pair(dummy_fd, content::kZygoteIdFd));
|
| + fds_to_map.push_back(std::make_pair(dummy_fd, kZygoteIdFd));
|
| }
|
|
|
| base::ProcessHandle process = -1;
|
| @@ -175,12 +176,12 @@
|
| // But first, wait for the zygote to tell us it's running.
|
| // The sending code is in content/browser/zygote_main_linux.cc.
|
| std::vector<int> fds_vec;
|
| - const int kExpectedLength = sizeof(content::kZygoteHelloMessage);
|
| + const int kExpectedLength = sizeof(kZygoteHelloMessage);
|
| char buf[kExpectedLength];
|
| const ssize_t len = UnixDomainSocket::RecvMsg(fds[0], buf, sizeof(buf),
|
| &fds_vec);
|
| CHECK(len == kExpectedLength) << "Incorrect zygote magic length";
|
| - CHECK(0 == strcmp(buf, content::kZygoteHelloMessage))
|
| + CHECK(0 == strcmp(buf, kZygoteHelloMessage))
|
| << "Incorrect zygote hello";
|
|
|
| std::string inode_output;
|
| @@ -214,7 +215,7 @@
|
| control_fd_ = fds[0];
|
|
|
| Pickle pickle;
|
| - pickle.WriteInt(content::kZygoteCommandGetSandboxStatus);
|
| + pickle.WriteInt(kZygoteCommandGetSandboxStatus);
|
| if (!SendMessage(pickle, NULL))
|
| LOG(FATAL) << "Cannot communicate with zygote";
|
| // We don't wait for the reply. We'll read it in ReadReply.
|
| @@ -222,9 +223,9 @@
|
|
|
| bool ZygoteHostImpl::SendMessage(const Pickle& data,
|
| const std::vector<int>* fds) {
|
| - CHECK(data.size() <= content::kZygoteMaxMessageLength)
|
| + CHECK(data.size() <= kZygoteMaxMessageLength)
|
| << "Trying to send too-large message to zygote (sending " << data.size()
|
| - << " bytes, max is " << content::kZygoteMaxMessageLength << ")";
|
| + << " bytes, max is " << kZygoteMaxMessageLength << ")";
|
| CHECK(!fds || fds->size() <= UnixDomainSocket::kMaxFileDescriptors)
|
| << "Trying to send message with too many file descriptors to zygote "
|
| << "(sending " << fds->size() << ", max is "
|
| @@ -253,12 +254,12 @@
|
|
|
| pid_t ZygoteHostImpl::ForkRequest(
|
| const std::vector<std::string>& argv,
|
| - const std::vector<content::FileDescriptorInfo>& mapping,
|
| + const std::vector<FileDescriptorInfo>& mapping,
|
| const std::string& process_type) {
|
| DCHECK(init_);
|
| Pickle pickle;
|
|
|
| - pickle.WriteInt(content::kZygoteCommandFork);
|
| + pickle.WriteInt(kZygoteCommandFork);
|
| pickle.WriteString(process_type);
|
| pickle.WriteInt(argv.size());
|
| for (std::vector<std::string>::const_iterator
|
| @@ -271,7 +272,7 @@
|
| // Scoped pointers cannot be stored in containers, so we have to use a
|
| // linked_ptr.
|
| std::vector<linked_ptr<file_util::ScopedFD> > autodelete_fds;
|
| - for (std::vector<content::FileDescriptorInfo>::const_iterator
|
| + for (std::vector<FileDescriptorInfo>::const_iterator
|
| i = mapping.begin(); i != mapping.end(); ++i) {
|
| pickle.WriteUInt32(i->id);
|
| fds.push_back(i->fd.fd);
|
| @@ -446,7 +447,7 @@
|
| DCHECK(init_);
|
| Pickle pickle;
|
|
|
| - pickle.WriteInt(content::kZygoteCommandReap);
|
| + pickle.WriteInt(kZygoteCommandReap);
|
| pickle.WriteInt(process);
|
| if (!SendMessage(pickle, NULL))
|
| LOG(ERROR) << "Failed to send Reap message to zygote";
|
| @@ -457,12 +458,12 @@
|
| int* exit_code) {
|
| DCHECK(init_);
|
| Pickle pickle;
|
| - pickle.WriteInt(content::kZygoteCommandGetTerminationStatus);
|
| + pickle.WriteInt(kZygoteCommandGetTerminationStatus);
|
| pickle.WriteInt(handle);
|
|
|
| // Set this now to handle the early termination cases.
|
| if (exit_code)
|
| - *exit_code = content::RESULT_CODE_NORMAL_EXIT;
|
| + *exit_code = RESULT_CODE_NORMAL_EXIT;
|
|
|
| static const unsigned kMaxMessageLength = 128;
|
| char buf[kMaxMessageLength];
|
| @@ -510,3 +511,5 @@
|
| return sandbox_status_;
|
| return 0;
|
| }
|
| +
|
| +} // namespace content
|
|
|