summaryrefslogtreecommitdiffstats
path: root/extensions/shell
diff options
context:
space:
mode:
authoragrieve <agrieve@chromium.org>2015-06-18 21:33:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-19 04:33:36 +0000
commitfd2d44abf30dcb70c083cbbbb2491e825ab61f41 (patch)
treed210be106238986c37f61024568eaf2a06378fe6 /extensions/shell
parent2f7c5984b86186dedeb17d551b9159df0462a8b5 (diff)
downloadchromium_src-fd2d44abf30dcb70c083cbbbb2491e825ab61f41.zip
chromium_src-fd2d44abf30dcb70c083cbbbb2491e825ab61f41.tar.gz
chromium_src-fd2d44abf30dcb70c083cbbbb2491e825ab61f41.tar.bz2
Take 2: Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc
Used to be defined in each app's ContentBrowserClient, but since content/ is the one that receives the FDs, it makes sense that it should be the one to send them. This also removes ChildProcessLauncher::AppendMappedFileCommandLineSwitches as it is no longer needed. Changes MemoryMappedFile::Region to be a POD so that it doesn't create require static initializers. BUG=394502 Review URL: https://codereview.chromium.org/1185973003 Cr-Commit-Position: refs/heads/master@{#335207}
Diffstat (limited to 'extensions/shell')
-rw-r--r--extensions/shell/browser/shell_content_browser_client.cc47
-rw-r--r--extensions/shell/browser/shell_content_browser_client.h16
2 files changed, 1 insertions, 62 deletions
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc
index 957b830..c9314ad 100644
--- a/extensions/shell/browser/shell_content_browser_client.cc
+++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -28,7 +28,6 @@
#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)
@@ -54,12 +53,7 @@ ShellContentBrowserClient* g_instance = nullptr;
ShellContentBrowserClient::ShellContentBrowserClient(
ShellBrowserMainDelegate* browser_main_delegate)
- :
-#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_parts_(nullptr),
browser_main_delegate_(browser_main_delegate) {
DCHECK(!g_instance);
g_instance = this;
@@ -200,21 +194,6 @@ void ShellContentBrowserClient::SiteInstanceDeleting(
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) {
@@ -254,30 +233,6 @@ void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
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());
diff --git a/extensions/shell/browser/shell_content_browser_client.h b/extensions/shell/browser/shell_content_browser_client.h
index d282397..16e51ca 100644
--- a/extensions/shell/browser/shell_content_browser_client.h
+++ b/extensions/shell/browser/shell_content_browser_client.h
@@ -52,21 +52,12 @@ class ShellContentBrowserClient : public content::ContentBrowserClient {
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
- void AppendMappedFileCommandLineSwitches(
- base::CommandLine* command_line) override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
content::BrowserPpapiHost* GetExternalBrowserPpapiHost(
int plugin_process_id) override;
void GetAdditionalAllowedSchemesForFileSystem(
std::vector<std::string>* additional_schemes) override;
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- void GetAdditionalMappedFilesForChildProcess(
- const base::CommandLine& command_line,
- int child_process_id,
- content::FileDescriptorInfo* mappings) override;
-#endif
-
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
protected:
@@ -82,13 +73,6 @@ class ShellContentBrowserClient : public content::ContentBrowserClient {
// Returns the extension or app associated with |site_instance| or NULL.
const Extension* GetExtension(content::SiteInstance* site_instance);
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- base::ScopedFD v8_natives_fd_;
- base::ScopedFD v8_snapshot_fd_;
- bool natives_fd_exists() { return v8_natives_fd_ != -1; }
- bool snapshot_fd_exists() { return v8_snapshot_fd_ != -1; }
-#endif
-
// Owned by content::BrowserMainLoop.
ShellBrowserMainParts* browser_main_parts_;