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

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

Issue 944913002: Transfer v8 snapshot files as file descriptors to child processes on Posix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS Created 5 years, 10 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 | « content/shell/browser/shell_content_browser_client.h ('k') | gin/isolate_holder.cc » ('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 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());
+#endif // V8_USE_EXTERNAL_STARTUP_DATA
+
#if defined(OS_ANDROID)
int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
base::FilePath pak_file;
« no previous file with comments | « content/shell/browser/shell_content_browser_client.h ('k') | gin/isolate_holder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698