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 e3ae8430cec806a0579d1fb3054a56e0a57932a8..9491eb7a0b05a3be2fb7c465eac5491cf60db450 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -2409,23 +2409,16 @@ void ChromeContentBrowserClient::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 |