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

Side by Side Diff: ash/shell/content_client/shell_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: Reinstate asserts that the natives are passed to the renderer by fd 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shell/content_client/shell_content_browser_client.h" 5 #include "ash/shell/content_client/shell_content_browser_client.h"
6 6
7 #include "ash/shell/content_client/shell_browser_main_parts.h" 7 #include "ash/shell/content_client/shell_browser_main_parts.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/public/common/content_descriptors.h" 9 #include "content/public/common/content_descriptors.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 request_interceptors.Pass()); 43 request_interceptors.Pass());
44 } 44 }
45 45
46 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( 46 void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
47 base::CommandLine* command_line, 47 base::CommandLine* command_line,
48 int child_process_id) { 48 int child_process_id) {
49 #if defined(OS_POSIX) && !defined(OS_MACOSX) 49 #if defined(OS_POSIX) && !defined(OS_MACOSX)
50 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 50 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
51 std::string process_type = 51 std::string process_type =
52 command_line->GetSwitchValueASCII(switches::kProcessType); 52 command_line->GetSwitchValueASCII(switches::kProcessType);
53 if (process_type != switches::kZygoteProcess) { 53 if (process_type != switches::kZygoteProcess &&
54 process_type != switches::kGpuProcess) {
55 DCHECK(natives_fd_exists());
54 command_line->AppendSwitch(::switches::kV8NativesPassedByFD); 56 command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
55 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); 57 if (snapshot_fd_exists()) {
sky 2015/06/04 19:36:42 nit: no {}
Erik Corry Chromium.org 2015/06/05 13:15:16 Done.
58 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
59 }
56 } 60 }
57 #endif // V8_USE_EXTERNAL_STARTUP_DATA 61 #endif // V8_USE_EXTERNAL_STARTUP_DATA
58 #endif // OS_POSIX && !OS_MACOSX 62 #endif // OS_POSIX && !OS_MACOSX
59 } 63 }
60 64
61 #if defined(OS_POSIX) && !defined(OS_MACOSX) 65 #if defined(OS_POSIX) && !defined(OS_MACOSX)
62 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 66 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
63 const base::CommandLine& command_line, 67 const base::CommandLine& command_line,
64 int child_process_id, 68 int child_process_id,
65 content::FileDescriptorInfo* mappings) { 69 content::FileDescriptorInfo* mappings) {
66 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 70 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
67 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { 71 if (!natives_fd_exists()) {
68 int v8_natives_fd = -1; 72 int v8_natives_fd = -1;
69 int v8_snapshot_fd = -1; 73 int v8_snapshot_fd = -1;
70 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, 74 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
71 &v8_snapshot_fd)) { 75 &v8_snapshot_fd)) {
72 v8_natives_fd_.reset(v8_natives_fd); 76 v8_natives_fd_.reset(v8_natives_fd);
73 v8_snapshot_fd_.reset(v8_snapshot_fd); 77 v8_snapshot_fd_.reset(v8_snapshot_fd);
74 } 78 }
75 } 79 }
76 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); 80 // V8 can't start up without the source of the natives, but it can
81 // start up (slower) without the snapshot.
82 DCHECK(natives_fd_exists());
77 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); 83 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
78 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); 84 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
79 #endif // V8_USE_EXTERNAL_STARTUP_DATA 85 #endif // V8_USE_EXTERNAL_STARTUP_DATA
80 } 86 }
81 #endif // OS_POSIX && !OS_MACOSX 87 #endif // OS_POSIX && !OS_MACOSX
82 88
83 content::ShellBrowserContext* ShellContentBrowserClient::browser_context() { 89 content::ShellBrowserContext* ShellContentBrowserClient::browser_context() {
84 return shell_browser_main_parts_->browser_context(); 90 return shell_browser_main_parts_->browser_context();
85 } 91 }
86 92
87 } // namespace examples 93 } // namespace examples
88 } // namespace views 94 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698