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

Side by Side Diff: chrome/browser/chrome_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: 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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 // On Chrome OS need to pass primary user homedir (in multi-profiles session). 1222 // On Chrome OS need to pass primary user homedir (in multi-profiles session).
1223 base::FilePath homedir; 1223 base::FilePath homedir;
1224 PathService::Get(base::DIR_HOME, &homedir); 1224 PathService::Get(base::DIR_HOME, &homedir);
1225 command_line->AppendSwitchASCII(chromeos::switches::kHomedir, 1225 command_line->AppendSwitchASCII(chromeos::switches::kHomedir,
1226 homedir.value().c_str()); 1226 homedir.value().c_str());
1227 #endif 1227 #endif
1228 1228
1229 #if defined(OS_POSIX) && !defined(OS_MACOSX) 1229 #if defined(OS_POSIX) && !defined(OS_MACOSX)
1230 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 1230 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
1231 if (process_type != switches::kZygoteProcess) { 1231 if (process_type != switches::kZygoteProcess) {
1232 command_line->AppendSwitch(::switches::kV8NativesPassedByFD); 1232 if (v8_natives_fd_.get() != -1) {
1233 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); 1233 command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
1234 }
1235 if (v8_snapshot_fd_.get() != -1) {
1236 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
1237 }
1234 } 1238 }
1235 #endif // V8_USE_EXTERNAL_STARTUP_DATA 1239 #endif // V8_USE_EXTERNAL_STARTUP_DATA
1236 #endif // OS_POSIX && !OS_MACOSX 1240 #endif // OS_POSIX && !OS_MACOSX
1237 1241
1238 if (process_type == switches::kRendererProcess) { 1242 if (process_type == switches::kRendererProcess) {
1239 content::RenderProcessHost* process = 1243 content::RenderProcessHost* process =
1240 content::RenderProcessHost::FromID(child_process_id); 1244 content::RenderProcessHost::FromID(child_process_id);
1241 Profile* profile = 1245 Profile* profile =
1242 process ? Profile::FromBrowserContext(process->GetBrowserContext()) 1246 process ? Profile::FromBrowserContext(process->GetBrowserContext())
1243 : NULL; 1247 : NULL;
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 browser_context, storage_partition_path, additional_backends); 2222 browser_context, storage_partition_path, additional_backends);
2219 } 2223 }
2220 } 2224 }
2221 2225
2222 #if defined(OS_POSIX) && !defined(OS_MACOSX) 2226 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2223 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2227 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2224 const base::CommandLine& command_line, 2228 const base::CommandLine& command_line,
2225 int child_process_id, 2229 int child_process_id,
2226 FileDescriptorInfo* mappings) { 2230 FileDescriptorInfo* mappings) {
2227 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) 2231 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
2228 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { 2232 if (v8_natives_fd_.get() == -1) {
2229 int v8_natives_fd = -1; 2233 int v8_natives_fd = -1;
2230 int v8_snapshot_fd = -1; 2234 int v8_snapshot_fd = -1;
2231 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, 2235 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
2232 &v8_snapshot_fd)) { 2236 &v8_snapshot_fd)) {
2233 v8_natives_fd_.reset(v8_natives_fd); 2237 v8_natives_fd_.reset(v8_natives_fd);
2234 v8_snapshot_fd_.reset(v8_snapshot_fd); 2238 v8_snapshot_fd_.reset(v8_snapshot_fd);
2235 } 2239 }
2236 } 2240 }
2237 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); 2241 DCHECK(v8_natives_fd_.get() != -1);
2238 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); 2242 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
2239 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); 2243 if (v8_snapshot_fd_.get() != -1)
2244 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
2240 #endif // V8_USE_EXTERNAL_STARTUP_DATA 2245 #endif // V8_USE_EXTERNAL_STARTUP_DATA
2241 2246
2242 #if defined(OS_ANDROID) 2247 #if defined(OS_ANDROID)
2243 base::FilePath data_path; 2248 base::FilePath data_path;
2244 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); 2249 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
2245 DCHECK(!data_path.empty()); 2250 DCHECK(!data_path.empty());
2246 2251
2247 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ; 2252 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
2248 base::FilePath chrome_resources_pak = 2253 base::FilePath chrome_resources_pak =
2249 data_path.AppendASCII("chrome_100_percent.pak"); 2254 data_path.AppendASCII("chrome_100_percent.pak");
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 switches::kDisableWebRtcEncryption, 2451 switches::kDisableWebRtcEncryption,
2447 }; 2452 };
2448 to_command_line->CopySwitchesFrom(from_command_line, 2453 to_command_line->CopySwitchesFrom(from_command_line,
2449 kWebRtcDevSwitchNames, 2454 kWebRtcDevSwitchNames,
2450 arraysize(kWebRtcDevSwitchNames)); 2455 arraysize(kWebRtcDevSwitchNames));
2451 } 2456 }
2452 } 2457 }
2453 #endif // defined(ENABLE_WEBRTC) 2458 #endif // defined(ENABLE_WEBRTC)
2454 2459
2455 } // namespace chrome 2460 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698