| Index: chrome/browser/chrome_content_browser_client.cc
|
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
| index f93dc783d6fd234fbcd4365e6d51bd3bca3cd561..c37f2da22839b104e8feb05cce1a42b03c1e92bb 100644
|
| --- a/chrome/browser/chrome_content_browser_client.cc
|
| +++ b/chrome/browser/chrome_content_browser_client.cc
|
| @@ -123,7 +123,6 @@
|
| #include "content/public/common/service_registry.h"
|
| #include "content/public/common/url_utils.h"
|
| #include "content/public/common/web_preferences.h"
|
| -#include "gin/v8_initializer.h"
|
| #include "net/base/mime_util.h"
|
| #include "net/cookies/canonical_cookie.h"
|
| #include "net/cookies/cookie_options.h"
|
| @@ -608,10 +607,6 @@ namespace chrome {
|
|
|
| ChromeContentBrowserClient::ChromeContentBrowserClient()
|
| :
|
| -#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| - v8_natives_fd_(-1),
|
| - v8_snapshot_fd_(-1),
|
| -#endif // OS_POSIX && !OS_MACOSX
|
| weak_factory_(this) {
|
| #if defined(ENABLE_PLUGINS)
|
| for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i)
|
| @@ -1187,13 +1182,11 @@ void ChromeContentBrowserClient::AppendMappedFileCommandLineSwitches(
|
| std::string process_type =
|
| command_line->GetSwitchValueASCII(switches::kProcessType);
|
| if (process_type != switches::kZygoteProcess) {
|
| - // We want to pass the natives by fd because after an update the file may
|
| - // be updated, but we want the newly launched renderers to get the old one,
|
| - // opened by the browser when it started.
|
| - 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
|
| @@ -2247,21 +2240,22 @@ void ChromeContentBrowserClient::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());
|
| - if (snapshot_fd_exists())
|
| - mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
|
| #endif // V8_USE_EXTERNAL_STARTUP_DATA
|
|
|
| #if defined(OS_ANDROID)
|
|
|