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

Unified Diff: chromecast/browser/cast_content_browser_client.cc

Issue 1164483003: Allow startup with missing V8 snapshot file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix misplaced ifdef for Windows 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
Index: chromecast/browser/cast_content_browser_client.cc
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index e385d963ace8039ba67ad84f28644afdcd444b2e..2f38b12273c1593de866e13009d3b407c94ddb37 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -146,21 +146,28 @@ bool CastContentBrowserClient::IsHandledURL(const GURL& url) {
return false;
}
-void CastContentBrowserClient::AppendExtraCommandLineSwitches(
- base::CommandLine* command_line,
- int child_process_id) {
-
+void CastContentBrowserClient::AppendMappedFileCommandLineSwitches(
+ base::CommandLine* command_line) {
std::string process_type =
command_line->GetSwitchValueNative(switches::kProcessType);
- base::CommandLine* browser_command_line =
- base::CommandLine::ForCurrentProcess();
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
if (process_type != switches::kZygoteProcess) {
+ DCHECK(natives_fd_exists());
command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
- command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
+ if (snapshot_fd_exists())
+ command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
}
+}
+
#endif // V8_USE_EXTERNAL_STARTUP_DATA
+void CastContentBrowserClient::AppendExtraCommandLineSwitches(
+ base::CommandLine* command_line,
+ int child_process_id) {
+ std::string process_type =
+ command_line->GetSwitchValueNative(switches::kProcessType);
+ base::CommandLine* browser_command_line =
+ base::CommandLine::ForCurrentProcess();
// IsCrashReporterEnabled() is set when InitCrashReporter() is called, and
// controlled by GetBreakpadClient()->EnableBreakpadForProcess(), therefore
@@ -316,7 +323,7 @@ void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
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) {
+ if (!natives_fd_exists()) {
int v8_natives_fd = -1;
int v8_snapshot_fd = -1;
if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
@@ -325,7 +332,9 @@ void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
v8_snapshot_fd_.reset(v8_snapshot_fd);
}
}
- DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1);
+ // 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
« no previous file with comments | « chromecast/browser/cast_content_browser_client.h ('k') | components/html_viewer/ax_provider_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698