Chromium Code Reviews| Index: content/shell/browser/shell_content_browser_client.cc |
| diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc |
| index 9990f5d04742d1540bce0cdbaec42546733bebc7..a73fc9eb20adc67794db671b11429e9357357bdf 100644 |
| --- a/content/shell/browser/shell_content_browser_client.cc |
| +++ b/content/shell/browser/shell_content_browser_client.cc |
| @@ -33,6 +33,7 @@ |
| #include "content/shell/common/shell_messages.h" |
| #include "content/shell/common/shell_switches.h" |
| #include "content/shell/common/webkit_test_helpers.h" |
| +#include "gin/public/isolate_holder.h" |
| #include "net/url_request/url_request_context_getter.h" |
| #include "url/gurl.h" |
| @@ -127,7 +128,12 @@ void ShellContentBrowserClient::SetSwapProcessesForRedirect(bool swap) { |
| } |
| ShellContentBrowserClient::ShellContentBrowserClient() |
| - : shell_browser_main_parts_(NULL) { |
| + : |
| +#if defined(OS_POSIX) && !defined(OS_MACOSX) |
| + v8_natives_fd_(-1), |
| + v8_snapshot_fd_(-1), |
| +#endif // OS_POSIX && !OS_MACOSX |
| + shell_browser_main_parts_(NULL) { |
| DCHECK(!g_browser_client); |
| g_browser_client = this; |
| } |
| @@ -317,6 +323,28 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| const base::CommandLine& command_line, |
| int child_process_id, |
| FileDescriptorInfo* mappings) { |
| +#if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
| + if (v8_snapshot_fd_.get() == -1 && v8_natives_fd_.get() == -1) { |
| + base::FilePath v8_data_path; |
| + PathService::Get(gin::IsolateHolder::kV8SnapshotBasePathKey, &v8_data_path); |
| + DCHECK(!v8_data_path.empty()); |
| + |
| + int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| + base::FilePath v8_natives_data_path = |
| + v8_data_path.AppendASCII(gin::IsolateHolder::kNativesFileName); |
| + base::FilePath v8_snapshot_data_path = |
| + v8_data_path.AppendASCII(gin::IsolateHolder::kSnapshotFileName); |
| + base::File v8_natives_data_file(v8_natives_data_path, file_flags); |
| + base::File v8_snapshot_data_file(v8_snapshot_data_path, file_flags); |
| + DCHECK(v8_natives_data_file.IsValid()); |
| + DCHECK(v8_snapshot_data_file.IsValid()); |
| + v8_natives_fd_.reset(v8_natives_data_file.TakePlatformFile()); |
| + v8_snapshot_fd_.reset(v8_snapshot_data_file.TakePlatformFile()); |
| + } |
| + mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); |
| + mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); |
|
rmcilroy
2015/02/20 22:53:25
I'm not keen on the duplication with chrome_conten
|
| +#endif // V8_USE_EXTERNAL_STARTUP_DATA |
| + |
| #if defined(OS_ANDROID) |
| int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; |
| base::FilePath pak_file; |