Index: content/browser/child_process_launcher.cc |
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc |
index 5f44a0de39e6cdb64e90589802f847578cbea879..4ccd2b4329d1bfa60a4e74e5010e0fd4548b8930 100644 |
--- a/content/browser/child_process_launcher.cc |
+++ b/content/browser/child_process_launcher.cc |
@@ -201,17 +201,17 @@ class ChildProcessLauncher::Context |
#elif defined(OS_POSIX) |
std::string process_type = |
cmd_line->GetSwitchValueASCII(switches::kProcessType); |
- std::vector<FileDescriptorInfo> files_to_register; |
- files_to_register.push_back( |
- FileDescriptorInfo(kPrimaryIPCChannel, |
- base::FileDescriptor(ipcfd, false))); |
+ scoped_ptr<FileDescriptorInfo> files_to_register = |
+ make_scoped_ptr(new FileDescriptorInfo()); |
+ files_to_register->Share(kPrimaryIPCChannel, ipcfd); |
base::StatsTable* stats_table = base::StatsTable::current(); |
if (stats_table && |
base::SharedMemory::IsHandleValid( |
stats_table->GetSharedMemoryHandle())) { |
- files_to_register.push_back( |
- FileDescriptorInfo(kStatsTableSharedMemFd, |
- stats_table->GetSharedMemoryHandle())); |
+ base::FileDescriptor fd = stats_table->GetSharedMemoryHandle(); |
+ DCHECK(fd.auto_close); |
+ files_to_register->Transfer(kStatsTableSharedMemFd, |
+ base::ScopedFD(fd.fd)); |
} |
#endif |
@@ -220,13 +220,17 @@ class ChildProcessLauncher::Context |
// when running in single process mode. |
CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
- GetContentClient()->browser()-> |
- GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id, |
- &files_to_register); |
+ GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
+ *cmd_line, child_process_id, files_to_register.get()); |
- StartChildProcess(cmd_line->argv(), child_process_id, files_to_register, |
+ StartChildProcess( |
+ cmd_line->argv(), |
+ child_process_id, |
+ files_to_register.Pass(), |
base::Bind(&ChildProcessLauncher::Context::OnChildProcessStarted, |
- this_object, client_thread_id, begin_launch_time)); |
+ this_object, |
+ client_thread_id, |
+ begin_launch_time)); |
#elif defined(OS_POSIX) |
base::ProcessHandle handle = base::kNullProcessHandle; |
@@ -235,24 +239,20 @@ class ChildProcessLauncher::Context |
base::ScopedFD ipcfd_closer(ipcfd); |
#if !defined(OS_MACOSX) |
- GetContentClient()->browser()-> |
- GetAdditionalMappedFilesForChildProcess(*cmd_line, child_process_id, |
- &files_to_register); |
+ GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
+ *cmd_line, child_process_id, files_to_register.get()); |
if (use_zygote) { |
- handle = ZygoteHostImpl::GetInstance()->ForkRequest(cmd_line->argv(), |
- files_to_register, |
- process_type); |
+ handle = ZygoteHostImpl::GetInstance()->ForkRequest( |
+ cmd_line->argv(), files_to_register.Pass(), process_type); |
} else |
// Fall through to the normal posix case below when we're not zygoting. |
#endif // !defined(OS_MACOSX) |
{ |
// Convert FD mapping to FileHandleMappingVector |
- base::FileHandleMappingVector fds_to_map; |
- for (size_t i = 0; i < files_to_register.size(); ++i) { |
- fds_to_map.push_back(std::make_pair( |
- files_to_register[i].fd.fd, |
- files_to_register[i].id + |
- base::GlobalDescriptors::kBaseDescriptor)); |
+ base::FileHandleMappingVector fds_to_map = |
+ files_to_register->descriptors(); |
+ for (size_t i = 0; i < fds_to_map.size(); ++i) { |
+ fds_to_map[i].second += base::GlobalDescriptors::kBaseDescriptor; |
mdempsky
2014/09/22 18:30:51
I know FileHandleMappingVector predates your CL, b
Hajime Morrita
2014/09/22 22:59:26
Agreed. I cannot kill FileHandleMappingVector so l
|
} |
#if !defined(OS_MACOSX) |