summaryrefslogtreecommitdiffstats
path: root/content/shell/browser/shell_content_browser_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/shell/browser/shell_content_browser_client.cc')
-rw-r--r--content/shell/browser/shell_content_browser_client.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc
index 4a2e95c..ab722f4 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -206,19 +206,25 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) {
return false;
}
-void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
- base::CommandLine* command_line,
- int child_process_id) {
+void ShellContentBrowserClient::AppendMappedFileCommandLineSwitches(
+ base::CommandLine* command_line) {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
std::string process_type =
command_line->GetSwitchValueASCII(switches::kProcessType);
if (process_type != switches::kZygoteProcess) {
+ DCHECK(natives_fd_exists());
command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
- command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
+ if (snapshot_fd_exists())
+ command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
}
#endif // V8_USE_EXTERNAL_STARTUP_DATA
#endif // OS_POSIX && !OS_MACOSX
+}
+
+void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
+ base::CommandLine* command_line,
+ int child_process_id) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kRunLayoutTest))
command_line->AppendSwitch(switches::kRunLayoutTest);
@@ -343,7 +349,7 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
int child_process_id,
FileDescriptorInfo* mappings) {
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
- if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) {
+ if (!natives_fd_exists()) {
int v8_natives_fd = -1;
int v8_snapshot_fd = -1;
if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
@@ -352,7 +358,9 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
v8_snapshot_fd_.reset(v8_snapshot_fd);
}
}
- DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1);
+ // 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