Index: ash/shell/content_client/shell_content_browser_client.cc |
diff --git a/ash/shell/content_client/shell_content_browser_client.cc b/ash/shell/content_client/shell_content_browser_client.cc |
index 633094783f4d573cba3c0daf66bc2c3110f13bbd..8ab62c1a8ba5707c90a8b4fbc5e6a943e0ecb16f 100644 |
--- a/ash/shell/content_client/shell_content_browser_client.cc |
+++ b/ash/shell/content_client/shell_content_browser_client.cc |
@@ -16,12 +16,7 @@ namespace ash { |
namespace shell { |
ShellContentBrowserClient::ShellContentBrowserClient() |
- : |
-#if defined(OS_POSIX) && !defined(OS_MACOSX) |
- v8_natives_fd_(-1), |
- v8_snapshot_fd_(-1), |
-#endif // OS_POSIX && !OS_MACOSX |
- shell_browser_main_parts_(nullptr) { |
+ : shell_browser_main_parts_(nullptr) { |
} |
ShellContentBrowserClient::~ShellContentBrowserClient() { |
@@ -50,10 +45,11 @@ void ShellContentBrowserClient::AppendMappedFileCommandLineSwitches( |
std::string process_type = |
command_line->GetSwitchValueASCII(switches::kProcessType); |
if (process_type != switches::kZygoteProcess) { |
- DCHECK(natives_fd_exists()); |
+ DCHECK(v8_files_.natives_fd.is_valid()); |
command_line->AppendSwitch(::switches::kV8NativesPassedByFD); |
- if (snapshot_fd_exists()) |
+ if (v8_files_.snapshot_fd.is_valid()) { |
command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
+ } |
} |
#endif // V8_USE_EXTERNAL_STARTUP_DATA |
#endif // OS_POSIX && !OS_MACOSX |
@@ -69,20 +65,22 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
#endif |
) { |
#if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
- if (!natives_fd_exists()) { |
- int v8_natives_fd = -1; |
- int v8_snapshot_fd = -1; |
- if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, |
- &v8_snapshot_fd)) { |
- v8_natives_fd_.reset(v8_natives_fd); |
- v8_snapshot_fd_.reset(v8_snapshot_fd); |
- } |
+ if (!v8_files_.natives_fd.is_valid()) { |
+ gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_files_); |
+ } |
+ DCHECK(v8_files_.natives_fd.is_valid()); |
+ mappings->Share(kV8NativesDataDescriptor, v8_files_.natives_fd.get()); |
+#if defined(OS_ANDROID) |
+ regions->insert( |
+ std::make_pair(kV8NativesDataDescriptor, v8_files_.natives_region)); |
+#endif |
+ if (v8_files_.snapshot_fd.is_valid()) { |
+ mappings->Share(kV8SnapshotDataDescriptor, v8_files_.snapshot_fd.get()); |
+#if defined(OS_ANDROID) |
+ regions->insert( |
+ std::make_pair(kV8SnapshotDataDescriptor, v8_files_.snapshot_region)); |
+#endif |
} |
- // V8 can't start up without the source of the natives, but it can |
- // start up (slower) without the snapshot. |
- DCHECK(natives_fd_exists()); |
- mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); |
- mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); |
#endif // V8_USE_EXTERNAL_STARTUP_DATA |
} |
#endif // OS_POSIX && !OS_MACOSX |