diff options
author | tobiasjs <tobiasjs@chromium.org> | 2016-02-09 06:22:37 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-09 14:24:04 +0000 |
commit | c560d75783aca05249092dd11503b53f7b631be1 (patch) | |
tree | bc3decfc696a11c599a774cd36e1cc312b6e0ca2 /content/browser/child_process_launcher.cc | |
parent | 97f8a5d6ac8db14ee2704a414542c20cfdba5507 (diff) | |
download | chromium_src-c560d75783aca05249092dd11503b53f7b631be1.zip chromium_src-c560d75783aca05249092dd11503b53f7b631be1.tar.gz chromium_src-c560d75783aca05249092dd11503b53f7b631be1.tar.bz2 |
Pass both 32 and 64 bit snapshot and natives fds to child processes.
Child processes are in the best position to determine which files
to use, therefore it is simplest just to provide both 32 and 64
bit versions from the parent.
BUG=581380,455699
Review URL: https://codereview.chromium.org/1665513002
Cr-Commit-Position: refs/heads/master@{#374371}
Diffstat (limited to 'content/browser/child_process_launcher.cc')
-rw-r--r-- | content/browser/child_process_launcher.cc | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index 4398e2b..e92554c 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc @@ -156,6 +156,31 @@ void LaunchOnLauncherThread(const NotifyCallback& callback, #endif ); #if defined(V8_USE_EXTERNAL_STARTUP_DATA) + bool snapshot_loaded = false; +#if defined(OS_ANDROID) + base::MemoryMappedFile::Region region; + auto maybe_register = [®ion, ®ions, &files_to_register](int key, + int fd) { + if (fd != -1) { + files_to_register->Share(key, fd); + regions.insert(std::make_pair(key, region)); + } + }; + maybe_register( + kV8NativesDataDescriptor32, + gin::V8Initializer::GetOpenNativesFileForChildProcesses(®ion, true)); + maybe_register( + kV8NativesDataDescriptor64, + gin::V8Initializer::GetOpenNativesFileForChildProcesses(®ion, false)); + maybe_register( + kV8SnapshotDataDescriptor32, + gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, true)); + maybe_register( + kV8SnapshotDataDescriptor64, + gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(®ion, false)); + + snapshot_loaded = true; +#else base::PlatformFile natives_pf = gin::V8Initializer::GetOpenNativesFileForChildProcesses( ®ions[kV8NativesDataDescriptor]); @@ -169,13 +194,15 @@ void LaunchOnLauncherThread(const NotifyCallback& callback, // Failure to load the V8 snapshot is not necessarily an error. V8 can start // up (slower) without the snapshot. if (snapshot_pf != -1) { + snapshot_loaded = true; files_to_register->Share(kV8SnapshotDataDescriptor, snapshot_pf); regions.insert(std::make_pair(kV8SnapshotDataDescriptor, snapshot_region)); } +#endif if (process_type != switches::kZygoteProcess) { cmd_line->AppendSwitch(::switches::kV8NativesPassedByFD); - if (snapshot_pf != -1) { + if (snapshot_loaded) { cmd_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); } } |