Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2962)

Unified Diff: content/shell/browser/shell_content_browser_client.cc

Issue 1019483002: Add support to extension_shell and ash_shell to use external V8 snapshot files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac and Win builds Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | extensions/shell/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 90cc70cfd2a1e47d4c3096abfa2a8dc017a69b43..56cd08d58d65064536d12f25487777fc0334b910 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -352,23 +352,16 @@ void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
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());
+ if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) {
+ int v8_natives_fd = -1;
+ int v8_snapshot_fd = -1;
+ if (gin::IsolateHolder::OpenV8FilesForChildProcesses(&v8_natives_fd,
+ &v8_snapshot_fd)) {
+ v8_natives_fd_.reset(v8_natives_fd);
+ v8_snapshot_fd_.reset(v8_snapshot_fd);
+ }
}
+ DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1);
mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
#endif // V8_USE_EXTERNAL_STARTUP_DATA
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | extensions/shell/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698