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

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

Issue 1187213002: Revert of Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « extensions/shell/browser/shell_content_browser_client.h ('k') | gin/v8_initializer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/shell/browser/shell_content_browser_client.cc
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc
index c9314ad6b292e2cef7ffd9bc8e398db55b926c58..957b83087142cc75cf63e55cbbe5bb20567e3273 100644
--- a/extensions/shell/browser/shell_content_browser_client.cc
+++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -28,6 +28,7 @@
#include "extensions/shell/browser/shell_browser_main_parts.h"
#include "extensions/shell/browser/shell_extension_system.h"
#include "extensions/shell/browser/shell_speech_recognition_manager_delegate.h"
+#include "gin/v8_initializer.h"
#include "url/gurl.h"
#if !defined(DISABLE_NACL)
@@ -53,7 +54,12 @@
ShellContentBrowserClient::ShellContentBrowserClient(
ShellBrowserMainDelegate* browser_main_delegate)
- : browser_main_parts_(nullptr),
+ :
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ v8_natives_fd_(-1),
+ v8_snapshot_fd_(-1),
+#endif // OS_POSIX && !OS_MACOSX
+ browser_main_parts_(nullptr),
browser_main_delegate_(browser_main_delegate) {
DCHECK(!g_instance);
g_instance = this;
@@ -194,6 +200,21 @@
site_instance->GetId()));
}
+void ShellContentBrowserClient::AppendMappedFileCommandLineSwitches(
+ base::CommandLine* command_line) {
+ std::string process_type =
+ command_line->GetSwitchValueASCII(::switches::kProcessType);
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+ DCHECK(natives_fd_exists());
+ command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
+ if (snapshot_fd_exists())
+ command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
+#endif // V8_USE_EXTERNAL_STARTUP_DATA
+#endif // OS_POSIX && !OS_MACOSX
+}
+
void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
@@ -233,6 +254,30 @@
additional_allowed_schemes->push_back(kExtensionScheme);
}
+#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 (!natives_fd_exists()) {
+ int v8_natives_fd = -1;
+ int v8_snapshot_fd = -1;
+ if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
+ &v8_snapshot_fd)) {
+ v8_natives_fd_.reset(v8_natives_fd);
+ v8_snapshot_fd_.reset(v8_snapshot_fd);
+ }
+ }
+ // V8 can't start up without the source of the natives, but it can
+ // start up (slower) without the snapshot.
+ DCHECK(natives_fd_exists());
+ 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::DevToolsManagerDelegate*
ShellContentBrowserClient::GetDevToolsManagerDelegate() {
return new content::ShellDevToolsManagerDelegate(GetBrowserContext());
« no previous file with comments | « extensions/shell/browser/shell_content_browser_client.h ('k') | gin/v8_initializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698