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

Unified Diff: gin/isolate_holder.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: Address review comments 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
Index: gin/isolate_holder.cc
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index 317b5822bd8f47f773a0927d1a2b18ef6c2ebcb8..85672a2c7f64d1c6d700c423f42aae89c5716ed4 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -194,6 +194,28 @@ bool IsolateHolder::LoadV8SnapshotFd(int natives_fd,
return MapV8Files(
NULL, NULL, natives_fd, snapshot_fd, natives_region, snapshot_region);
}
+
+// static
+bool IsolateHolder::OpenV8FilesForChildProcesses(
+ base::PlatformFile* natives_fd_out,
+ base::PlatformFile* snapshot_fd_out) {
+ base::FilePath data_path;
+ PathService::Get(kV8SnapshotBasePathKey, &data_path);
+ DCHECK(!data_path.empty());
+
+ int file_flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
+ base::FilePath natives_data_path = data_path.AppendASCII(kNativesFileName);
+ base::FilePath snapshot_data_path = data_path.AppendASCII(kSnapshotFileName);
+ base::File natives_data_file(natives_data_path, file_flags);
+ base::File snapshot_data_file(snapshot_data_path, file_flags);
+
+ if (!natives_data_file.IsValid() || !snapshot_data_file.IsValid())
+ return false;
+
+ *natives_fd_out = natives_data_file.TakePlatformFile();
+ *snapshot_fd_out = snapshot_data_file.TakePlatformFile();
+ return true;
+}
#endif // V8_USE_EXTERNAL_STARTUP_DATA
//static

Powered by Google App Engine
This is Rietveld 408576698