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

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: 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 command_line->AppendSwitch(::switches::kV8NativesPassedByFD); 54 if (v8_natives_fd_.get() != -1) {
picksi 2015/06/02 11:44:37 "v8_[natives|snapshot]_fd_.get() != -1" appears a
Erik Corry Chromium.org 2015/06/02 14:29:47 Done.
55 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); 55 command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
56 }
57 if (v8_snapshot_fd_.get() != -1) {
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 (v8_natives_fd_.get() == -1) {
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 DCHECK(v8_natives_fd_.get() != -1);
rmcilroy 2015/06/01 14:06:31 nit - please add a comment saying why its OK if v8
Erik Corry Chromium.org 2015/06/02 11:18:52 Done.
77 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); 81 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
78 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); 82 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
79 #endif // V8_USE_EXTERNAL_STARTUP_DATA 83 #endif // V8_USE_EXTERNAL_STARTUP_DATA
80 } 84 }
81 #endif // OS_POSIX && !OS_MACOSX 85 #endif // OS_POSIX && !OS_MACOSX
82 86
83 content::ShellBrowserContext* ShellContentBrowserClient::browser_context() { 87 content::ShellBrowserContext* ShellContentBrowserClient::browser_context() {
84 return shell_browser_main_parts_->browser_context(); 88 return shell_browser_main_parts_->browser_context();
85 } 89 }
86 90
87 } // namespace examples 91 } // namespace examples
88 } // namespace views 92 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | content/app/content_main_runner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698