Chromium Code Reviews| Index: content/browser/zygote_host/zygote_host_impl_linux.cc |
| diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc |
| index 6ef54874282fb8d0e882d01b08297705504cb1b3..0275bf6330cffe22f5bcb2e1ef0449ea5293b6a4 100644 |
| --- a/content/browser/zygote_host/zygote_host_impl_linux.cc |
| +++ b/content/browser/zygote_host/zygote_host_impl_linux.cc |
| @@ -16,6 +16,7 @@ |
| #include "base/file_util.h" |
| #include "base/linux_util.h" |
| #include "base/logging.h" |
| +#include "base/memory/linked_ptr.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/metrics/histogram.h" |
| #include "base/path_service.h" |
| @@ -238,7 +239,7 @@ ssize_t ZygoteHostImpl::ReadReply(void* buf, size_t buf_len) { |
| pid_t ZygoteHostImpl::ForkRequest( |
| const std::vector<std::string>& argv, |
| - const base::GlobalDescriptors::Mapping& mapping, |
| + const std::vector<content::FileDescriptorInfo>& mapping, |
| const std::string& process_type) { |
| DCHECK(init_); |
| Pickle pickle; |
| @@ -253,10 +254,18 @@ pid_t ZygoteHostImpl::ForkRequest( |
| pickle.WriteInt(mapping.size()); |
| std::vector<int> fds; |
| - for (base::GlobalDescriptors::Mapping::const_iterator |
| + // Scoped pointers cannot be stored in containers, so we have to use a |
| + // link_ptr. |
|
Markus (顧孟勤)
2012/09/24 21:17:34
s/link/linked/
|
| + std::vector<linked_ptr<file_util::ScopedFD> > autodelete_fds; |
| + for (std::vector<content::FileDescriptorInfo>::const_iterator |
| i = mapping.begin(); i != mapping.end(); ++i) { |
| - pickle.WriteUInt32(i->first); |
| - fds.push_back(i->second); |
| + pickle.WriteUInt32(i->id); |
| + fds.push_back(i->fd.fd); |
| + if (i->fd.auto_close) { |
| + linked_ptr<file_util::ScopedFD> ptr( |
| + new file_util::ScopedFD(&(fds.back()))); |
| + autodelete_fds.push_back(ptr); |
|
Markus (顧孟勤)
2012/09/24 21:17:34
I think I understand what you are doing here, but
|
| + } |
| } |
| pid_t pid; |