| 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 0ead4ce1c33d9005adfed3a95abc88a823ec7b46..c2f1c908c0a50bb9b22f587f4729009e8a8d13a7 100644
|
| --- a/content/browser/zygote_host/zygote_host_impl_linux.cc
|
| +++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
|
| @@ -287,10 +287,9 @@ ssize_t ZygoteHostImpl::ReadReply(void* buf, size_t buf_len) {
|
| return HANDLE_EINTR(read(control_fd_, buf, buf_len));
|
| }
|
|
|
| -pid_t ZygoteHostImpl::ForkRequest(
|
| - const std::vector<std::string>& argv,
|
| - const std::vector<FileDescriptorInfo>& mapping,
|
| - const std::string& process_type) {
|
| +pid_t ZygoteHostImpl::ForkRequest(const std::vector<std::string>& argv,
|
| + scoped_ptr<FileDescriptorInfo> mapping,
|
| + const std::string& process_type) {
|
| DCHECK(init_);
|
| Pickle pickle;
|
|
|
| @@ -309,26 +308,20 @@ pid_t ZygoteHostImpl::ForkRequest(
|
|
|
| // Fork requests contain one file descriptor for the PID oracle, and one
|
| // more for each file descriptor mapping for the child process.
|
| - const size_t num_fds_to_send = 1 + mapping.size();
|
| + const size_t num_fds_to_send = 1 + mapping->GetMappingSize();
|
| pickle.WriteInt(num_fds_to_send);
|
|
|
| std::vector<int> fds;
|
| - ScopedVector<base::ScopedFD> autoclose_fds;
|
|
|
| // First FD to send is peer_sock.
|
| + // TODO(morrita): Ideally, this should be part of the mapping so that
|
| + // FileDescriptorInfo can manages its lifetime.
|
| fds.push_back(peer_sock.get());
|
| - autoclose_fds.push_back(new base::ScopedFD(peer_sock.Pass()));
|
|
|
| // The rest come from mapping.
|
| - for (std::vector<FileDescriptorInfo>::const_iterator
|
| - i = mapping.begin(); i != mapping.end(); ++i) {
|
| - pickle.WriteUInt32(i->id);
|
| - fds.push_back(i->fd.fd);
|
| - if (i->fd.auto_close) {
|
| - // Auto-close means we need to close the FDs after they have been passed
|
| - // to the other process.
|
| - autoclose_fds.push_back(new base::ScopedFD(i->fd.fd));
|
| - }
|
| + for (size_t i = 0; i < mapping->GetMappingSize(); ++i) {
|
| + pickle.WriteUInt32(mapping->GetIDAt(i));
|
| + fds.push_back(mapping->GetFDAt(i));
|
| }
|
|
|
| // Sanity check that we've populated |fds| correctly.
|
| @@ -339,7 +332,8 @@ pid_t ZygoteHostImpl::ForkRequest(
|
| base::AutoLock lock(control_lock_);
|
| if (!SendMessage(pickle, &fds))
|
| return base::kNullProcessHandle;
|
| - autoclose_fds.clear();
|
| + mapping.reset();
|
| + peer_sock.reset();
|
|
|
| {
|
| char buf[sizeof(kZygoteChildPingMessage) + 1];
|
|
|