Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: content/browser/child_process_launcher.cc

Issue 1665513002: Pass both 32 and 64 bit snapshot and natives fds to child processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid non-POD global Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/app/content_main_runner.cc ('k') | content/public/common/content_descriptors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_launcher.cc
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 4398e2b390acd1c03e6748e5b0c008ddd1bb0eb8..e92554c8aa5a423b6b6f91d2f2e77b67cb414c03 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 = [&region, &regions, &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(&region, true));
+ maybe_register(
+ kV8NativesDataDescriptor64,
+ gin::V8Initializer::GetOpenNativesFileForChildProcesses(&region, false));
+ maybe_register(
+ kV8SnapshotDataDescriptor32,
+ gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(&region, true));
+ maybe_register(
+ kV8SnapshotDataDescriptor64,
+ gin::V8Initializer::GetOpenSnapshotFileForChildProcesses(&region, false));
+
+ snapshot_loaded = true;
+#else
base::PlatformFile natives_pf =
gin::V8Initializer::GetOpenNativesFileForChildProcesses(
&regions[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);
}
}
« no previous file with comments | « content/app/content_main_runner.cc ('k') | content/public/common/content_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698