Chromium Code Reviews| Index: content/browser/child_process_launcher.cc |
| diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc |
| index 48c5e94285e1b4e8f4ccf870196537f4edeffbad..b7e81788a5679cc04c4dd91a4ad3dc508ceab52f 100644 |
| --- a/content/browser/child_process_launcher.cc |
| +++ b/content/browser/child_process_launcher.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/bind.h" |
| #include "base/command_line.h" |
| #include "base/files/file_util.h" |
| +#include "base/i18n/icu_util.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/metrics/histogram.h" |
| @@ -43,6 +44,7 @@ |
| #if defined(OS_POSIX) |
| #include "base/posix/global_descriptors.h" |
| #include "content/browser/file_descriptor_info_impl.h" |
| +#include "gin/v8_initializer.h" |
| #endif |
| namespace content { |
| @@ -141,15 +143,43 @@ void LaunchOnLauncherThread(const NotifyCallback& callback, |
| #endif |
| #endif |
| -#if defined(OS_ANDROID) |
| - // Android WebView runs in single process, ensure that we never get here |
| - // when running in single process mode. |
| - CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| std::map<int, base::MemoryMappedFile::Region> regions; |
| + |
| + files_to_register->Share( |
|
jam
2015/06/11 16:11:34
should be behind OS_ANDROID
btw it would be good
agrieve
2015/06/11 17:30:35
Done (and kicked off a try job, good advice!)
|
| + kAndroidICUDataDescriptor, |
| + base::i18n::GetIcuDataFileHandle(®ions[kAndroidICUDataDescriptor])); |
| + |
| +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
| + files_to_register->Share(kV8NativesDataDescriptor, |
| + gin::V8Initializer::OpenNativesFileForChildProcesses( |
| + ®ions[kV8NativesDataDescriptor])); |
| + |
| + base::MemoryMappedFile::Region snapshot_region; |
| + base::PlatformFile snapshot_pf = |
| + gin::V8Initializer::OpenSnapshotFileForChildProcesses(&snapshot_region); |
| + // Failure to load the V8 snapshot is not necessarily an error. V8 can start |
| + // up (slower) without the snapshot. |
| + if (snapshot_pf != -1) { |
| + files_to_register->Share(kV8SnapshotDataDescriptor, snapshot_pf); |
| + regions.insert(std::make_pair(kV8SnapshotDataDescriptor, snapshot_region)); |
| + } |
| + |
| + if (process_type != switches::kZygoteProcess) { |
| + cmd_line->AppendSwitch(::switches::kV8NativesPassedByFD); |
| + if (snapshot_pf != -1) { |
| + cmd_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
| + } |
| + } |
| +#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) |
| GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
| *cmd_line, child_process_id, files_to_register.get()); |
| +#endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
| - GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); |
| +#if defined(OS_ANDROID) |
| + // Android WebView runs in single process, ensure that we never get here |
| + // when running in single process mode. |
| + CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
| StartChildProcess( |
| cmd_line->argv(), child_process_id, files_to_register.Pass(), regions, |
| @@ -161,11 +191,6 @@ void LaunchOnLauncherThread(const NotifyCallback& callback, |
| // child termination. |
| #if !defined(OS_MACOSX) |
| - GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
| - *cmd_line, child_process_id, files_to_register.get()); |
| - |
| - GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); |
| - |
| if (use_zygote) { |
| base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest( |
| cmd_line->argv(), files_to_register.Pass(), process_type); |