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

Unified Diff: ash/shell/content_client/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
Index: ash/shell/content_client/shell_content_browser_client.cc
diff --git a/ash/shell/content_client/shell_content_browser_client.cc b/ash/shell/content_client/shell_content_browser_client.cc
index f7787872c6553b6570cb119b5157fefb24b6fe16..0eea8d47aaaff8405863516acaba706ec9db551d 100644
--- a/ash/shell/content_client/shell_content_browser_client.cc
+++ b/ash/shell/content_client/shell_content_browser_client.cc
@@ -5,14 +5,21 @@
#include "ash/shell/content_client/shell_content_browser_client.h"
#include "ash/shell/content_client/shell_browser_main_parts.h"
+#include "content/public/common/content_descriptors.h"
#include "content/shell/browser/shell_browser_context.h"
+#include "gin/public/isolate_holder.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace ash {
namespace shell {
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_(nullptr) {
}
ShellContentBrowserClient::~ShellContentBrowserClient() {
@@ -34,6 +41,28 @@ net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
request_interceptors.Pass());
}
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
+ content::FileDescriptorInfo* mappings) {
+#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+ 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
+}
+#endif // OS_POSIX && !OS_MACOSX
+
content::ShellBrowserContext* ShellContentBrowserClient::browser_context() {
return shell_browser_main_parts_->browser_context();
}
« no previous file with comments | « ash/shell/content_client/shell_content_browser_client.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698