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

Side by Side Diff: extensions/shell/browser/shell_content_browser_client.cc

Issue 1182443003: Moved logic for mapping child process FDs for ICU and V8 into child_process_launcher.cc (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/shell/browser/shell_content_browser_client.h" 5 #include "extensions/shell/browser/shell_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "components/guest_view/browser/guest_view_message_filter.h" 8 #include "components/guest_view/browser/guest_view_message_filter.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 10 matching lines...) Expand all
21 #include "extensions/browser/info_map.h" 21 #include "extensions/browser/info_map.h"
22 #include "extensions/browser/io_thread_extension_message_filter.h" 22 #include "extensions/browser/io_thread_extension_message_filter.h"
23 #include "extensions/browser/process_map.h" 23 #include "extensions/browser/process_map.h"
24 #include "extensions/common/constants.h" 24 #include "extensions/common/constants.h"
25 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
26 #include "extensions/common/switches.h" 26 #include "extensions/common/switches.h"
27 #include "extensions/shell/browser/shell_browser_context.h" 27 #include "extensions/shell/browser/shell_browser_context.h"
28 #include "extensions/shell/browser/shell_browser_main_parts.h" 28 #include "extensions/shell/browser/shell_browser_main_parts.h"
29 #include "extensions/shell/browser/shell_extension_system.h" 29 #include "extensions/shell/browser/shell_extension_system.h"
30 #include "extensions/shell/browser/shell_speech_recognition_manager_delegate.h" 30 #include "extensions/shell/browser/shell_speech_recognition_manager_delegate.h"
31 #include "gin/v8_initializer.h"
32 #include "url/gurl.h" 31 #include "url/gurl.h"
33 32
34 #if !defined(DISABLE_NACL) 33 #if !defined(DISABLE_NACL)
35 #include "components/nacl/browser/nacl_browser.h" 34 #include "components/nacl/browser/nacl_browser.h"
36 #include "components/nacl/browser/nacl_host_message_filter.h" 35 #include "components/nacl/browser/nacl_host_message_filter.h"
37 #include "components/nacl/browser/nacl_process_host.h" 36 #include "components/nacl/browser/nacl_process_host.h"
38 #include "components/nacl/common/nacl_process_type.h" 37 #include "components/nacl/common/nacl_process_type.h"
39 #include "components/nacl/common/nacl_switches.h" 38 #include "components/nacl/common/nacl_switches.h"
40 #include "content/public/browser/browser_child_process_host.h" 39 #include "content/public/browser/browser_child_process_host.h"
41 #include "content/public/browser/child_process_data.h" 40 #include "content/public/browser/child_process_data.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 BrowserThread::PostTask( 192 BrowserThread::PostTask(
194 BrowserThread::IO, 193 BrowserThread::IO,
195 FROM_HERE, 194 FROM_HERE,
196 base::Bind(&InfoMap::UnregisterExtensionProcess, 195 base::Bind(&InfoMap::UnregisterExtensionProcess,
197 browser_main_parts_->extension_system()->info_map(), 196 browser_main_parts_->extension_system()->info_map(),
198 extension->id(), 197 extension->id(),
199 site_instance->GetProcess()->GetID(), 198 site_instance->GetProcess()->GetID(),
200 site_instance->GetId())); 199 site_instance->GetId()));
201 } 200 }
202 201
203 void ShellContentBrowserClient::AppendMappedFileCommandLineSwitches(
204 base::CommandLine* command_line) {
205 std::string process_type =
206 command_line->GetSwitchValueASCII(::switches::kProcessType);
207
208 #if defined(OS_POSIX) && !defined(OS_MACOSX)
209 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
210 DCHECK(natives_fd_exists());
211 command_line->AppendSwitch(::switches::kV8NativesPassedByFD);
212 if (snapshot_fd_exists())
213 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD);
214 #endif // V8_USE_EXTERNAL_STARTUP_DATA
215 #endif // OS_POSIX && !OS_MACOSX
216 }
217
218 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( 202 void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
219 base::CommandLine* command_line, 203 base::CommandLine* command_line,
220 int child_process_id) { 204 int child_process_id) {
221 std::string process_type = 205 std::string process_type =
222 command_line->GetSwitchValueASCII(::switches::kProcessType); 206 command_line->GetSwitchValueASCII(::switches::kProcessType);
223 if (process_type == ::switches::kRendererProcess) 207 if (process_type == ::switches::kRendererProcess)
224 AppendRendererSwitches(command_line); 208 AppendRendererSwitches(command_line);
225 } 209 }
226 210
227 content::SpeechRecognitionManagerDelegate* 211 content::SpeechRecognitionManagerDelegate*
(...skipping 19 matching lines...) Expand all
247 return nullptr; 231 return nullptr;
248 } 232 }
249 233
250 void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( 234 void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
251 std::vector<std::string>* additional_allowed_schemes) { 235 std::vector<std::string>* additional_allowed_schemes) {
252 ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( 236 ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
253 additional_allowed_schemes); 237 additional_allowed_schemes);
254 additional_allowed_schemes->push_back(kExtensionScheme); 238 additional_allowed_schemes->push_back(kExtensionScheme);
255 } 239 }
256 240
257 #if defined(OS_POSIX) && !defined(OS_MACOSX)
258 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
259 const base::CommandLine& command_line,
260 int child_process_id,
261 content::FileDescriptorInfo* mappings) {
262 #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
263 if (!natives_fd_exists()) {
264 int v8_natives_fd = -1;
265 int v8_snapshot_fd = -1;
266 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd,
267 &v8_snapshot_fd)) {
268 v8_natives_fd_.reset(v8_natives_fd);
269 v8_snapshot_fd_.reset(v8_snapshot_fd);
270 }
271 }
272 // V8 can't start up without the source of the natives, but it can
273 // start up (slower) without the snapshot.
274 DCHECK(natives_fd_exists());
275 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get());
276 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get());
277 #endif // V8_USE_EXTERNAL_STARTUP_DATA
278 }
279 #endif // OS_POSIX && !OS_MACOSX
280
281 content::DevToolsManagerDelegate* 241 content::DevToolsManagerDelegate*
282 ShellContentBrowserClient::GetDevToolsManagerDelegate() { 242 ShellContentBrowserClient::GetDevToolsManagerDelegate() {
283 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); 243 return new content::ShellDevToolsManagerDelegate(GetBrowserContext());
284 } 244 }
285 245
286 ShellBrowserMainParts* ShellContentBrowserClient::CreateShellBrowserMainParts( 246 ShellBrowserMainParts* ShellContentBrowserClient::CreateShellBrowserMainParts(
287 const content::MainFunctionParams& parameters, 247 const content::MainFunctionParams& parameters,
288 ShellBrowserMainDelegate* browser_main_delegate) { 248 ShellBrowserMainDelegate* browser_main_delegate) {
289 return new ShellBrowserMainParts(parameters, browser_main_delegate); 249 return new ShellBrowserMainParts(parameters, browser_main_delegate);
290 } 250 }
(...skipping 18 matching lines...) Expand all
309 269
310 const Extension* ShellContentBrowserClient::GetExtension( 270 const Extension* ShellContentBrowserClient::GetExtension(
311 content::SiteInstance* site_instance) { 271 content::SiteInstance* site_instance) {
312 ExtensionRegistry* registry = 272 ExtensionRegistry* registry =
313 ExtensionRegistry::Get(site_instance->GetBrowserContext()); 273 ExtensionRegistry::Get(site_instance->GetBrowserContext());
314 return registry->enabled_extensions().GetExtensionOrAppByURL( 274 return registry->enabled_extensions().GetExtensionOrAppByURL(
315 site_instance->GetSiteURL()); 275 site_instance->GetSiteURL());
316 } 276 }
317 277
318 } // namespace extensions 278 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698