Chromium Code Reviews| Index: extensions/shell/browser/shell_content_browser_client.cc |
| diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc |
| index d542a6792f29c796bf50746926b6c28a182750a2..a4a4345f489a96122a1e4d6123b25236d0f30611 100644 |
| --- a/extensions/shell/browser/shell_content_browser_client.cc |
| +++ b/extensions/shell/browser/shell_content_browser_client.cc |
| @@ -28,7 +28,6 @@ |
| #include "extensions/shell/browser/shell_browser_main_parts.h" |
| #include "extensions/shell/browser/shell_extension_system.h" |
| #include "extensions/shell/browser/shell_speech_recognition_manager_delegate.h" |
| -#include "gin/v8_initializer.h" |
| #include "url/gurl.h" |
| #if !defined(DISABLE_NACL) |
| @@ -54,12 +53,7 @@ ShellContentBrowserClient* g_instance = nullptr; |
| ShellContentBrowserClient::ShellContentBrowserClient( |
| ShellBrowserMainDelegate* browser_main_delegate) |
| - : |
| -#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| - v8_natives_fd_(-1), |
| - v8_snapshot_fd_(-1), |
| -#endif // OS_POSIX && !OS_MACOSX |
| - browser_main_parts_(nullptr), |
| + : browser_main_parts_(nullptr), |
| browser_main_delegate_(browser_main_delegate) { |
| DCHECK(!g_instance); |
| g_instance = this; |
| @@ -202,15 +196,17 @@ void ShellContentBrowserClient::SiteInstanceDeleting( |
| void ShellContentBrowserClient::AppendMappedFileCommandLineSwitches( |
| base::CommandLine* command_line) { |
| - std::string process_type = |
| - command_line->GetSwitchValueASCII(::switches::kProcessType); |
| - |
| #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
| - DCHECK(natives_fd_exists()); |
| - command_line->AppendSwitch(::switches::kV8NativesPassedByFD); |
| - if (snapshot_fd_exists()) |
| - command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
| + std::string process_type = |
| + command_line->GetSwitchValueASCII(switches::kProcessType); |
| + if (process_type != switches::kZygoteProcess) { |
| + DCHECK(v8_files_.natives_fd.is_valid()); |
| + command_line->AppendSwitch(::switches::kV8NativesPassedByFD); |
| + if (v8_files_.snapshot_fd.is_valid()) { |
| + command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
| + } |
| + } |
| #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| #endif // OS_POSIX && !OS_MACOSX |
| } |
| @@ -264,20 +260,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) |
|
rmcilroy
2015/06/09 11:52:54
I don't think this needs to be #ifdef ANDROID - al
|
| + 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 |