| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 if (renderer_path.empty()) { | 293 if (renderer_path.empty()) { |
| 294 // Need to reset the channel we created above or others might think the | 294 // Need to reset the channel we created above or others might think the |
| 295 // connection is live. | 295 // connection is live. |
| 296 channel_.reset(); | 296 channel_.reset(); |
| 297 return false; | 297 return false; |
| 298 } | 298 } |
| 299 CommandLine cmd_line(renderer_path); | 299 CommandLine cmd_line(renderer_path); |
| 300 if (logging::DialogsAreSuppressed()) | 300 if (logging::DialogsAreSuppressed()) |
| 301 cmd_line.AppendSwitch(switches::kNoErrorDialogs); | 301 cmd_line.AppendSwitch(switches::kNoErrorDialogs); |
| 302 | 302 |
| 303 // propagate the following switches to the renderer command line | 303 // Pass the process type first, so it shows first in process listings. |
| 304 // (along with any associated values) if present in the browser command line | 304 cmd_line.AppendSwitchWithValue(switches::kProcessType, |
| 305 switches::kRendererProcess); |
| 306 |
| 307 // Propagate the following switches to the renderer command line (along |
| 308 // with any associated values) if present in the browser command line. |
| 305 static const wchar_t* const switch_names[] = { | 309 static const wchar_t* const switch_names[] = { |
| 306 switches::kRendererAssertTest, | 310 switches::kRendererAssertTest, |
| 307 switches::kRendererCrashTest, | 311 switches::kRendererCrashTest, |
| 308 switches::kRendererStartupDialog, | 312 switches::kRendererStartupDialog, |
| 309 switches::kNoSandbox, | 313 switches::kNoSandbox, |
| 310 switches::kTestSandbox, | 314 switches::kTestSandbox, |
| 311 switches::kEnableSeccompSandbox, | 315 switches::kEnableSeccompSandbox, |
| 312 #if !defined (GOOGLE_CHROME_BUILD) | 316 #if !defined (GOOGLE_CHROME_BUILD) |
| 313 // This is an unsupported and not fully tested mode, so don't enable it for | 317 // This is an unsupported and not fully tested mode, so don't enable it for |
| 314 // official Chrome builds. | 318 // official Chrome builds. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 const bool has_cmd_prefix = | 369 const bool has_cmd_prefix = |
| 366 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); | 370 browser_command_line.HasSwitch(switches::kRendererCmdPrefix); |
| 367 if (has_cmd_prefix) { | 371 if (has_cmd_prefix) { |
| 368 // launch the renderer child with some prefix (usually "gdb --args") | 372 // launch the renderer child with some prefix (usually "gdb --args") |
| 369 const std::wstring prefix = | 373 const std::wstring prefix = |
| 370 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); | 374 browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); |
| 371 cmd_line.PrependWrapper(prefix); | 375 cmd_line.PrependWrapper(prefix); |
| 372 } | 376 } |
| 373 #endif // OS_POSIX | 377 #endif // OS_POSIX |
| 374 | 378 |
| 375 cmd_line.AppendSwitchWithValue(switches::kProcessType, | |
| 376 switches::kRendererProcess); | |
| 377 | |
| 378 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, | 379 cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, |
| 379 ASCIIToWide(channel_id)); | 380 ASCIIToWide(channel_id)); |
| 380 | 381 |
| 381 ChildProcessHost::SetCrashReporterCommandLine(&cmd_line); | 382 ChildProcessHost::SetCrashReporterCommandLine(&cmd_line); |
| 382 | 383 |
| 383 const std::wstring& profile_path = | 384 const std::wstring& profile_path = |
| 384 browser_command_line.GetSwitchValue(switches::kUserDataDir); | 385 browser_command_line.GetSwitchValue(switches::kUserDataDir); |
| 385 if (!profile_path.empty()) | 386 if (!profile_path.empty()) |
| 386 cmd_line.AppendSwitchWithValue(switches::kUserDataDir, | 387 cmd_line.AppendSwitchWithValue(switches::kUserDataDir, |
| 387 profile_path); | 388 profile_path); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 profile()->GetExtensionMessageService()->RemoveEventListener( | 959 profile()->GetExtensionMessageService()->RemoveEventListener( |
| 959 event_name, id()); | 960 event_name, id()); |
| 960 } | 961 } |
| 961 } | 962 } |
| 962 | 963 |
| 963 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { | 964 void BrowserRenderProcessHost::OnExtensionCloseChannel(int port_id) { |
| 964 if (profile()->GetExtensionMessageService()) { | 965 if (profile()->GetExtensionMessageService()) { |
| 965 profile()->GetExtensionMessageService()->CloseChannel(port_id); | 966 profile()->GetExtensionMessageService()->CloseChannel(port_id); |
| 966 } | 967 } |
| 967 } | 968 } |
| OLD | NEW |