OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // 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 "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 base::CommandLine* cmd_line = new base::CommandLine(renderer_path); | 959 base::CommandLine* cmd_line = new base::CommandLine(renderer_path); |
960 if (!renderer_prefix.empty()) | 960 if (!renderer_prefix.empty()) |
961 cmd_line->PrependWrapper(renderer_prefix); | 961 cmd_line->PrependWrapper(renderer_prefix); |
962 AppendRendererCommandLine(cmd_line); | 962 AppendRendererCommandLine(cmd_line); |
963 | 963 |
964 // Spawn the child process asynchronously to avoid blocking the UI thread. | 964 // Spawn the child process asynchronously to avoid blocking the UI thread. |
965 // As long as there's no renderer prefix, we can use the zygote process | 965 // As long as there's no renderer prefix, we can use the zygote process |
966 // at this stage. | 966 // at this stage. |
967 child_process_launcher_.reset(new ChildProcessLauncher( | 967 child_process_launcher_.reset(new ChildProcessLauncher( |
968 new RendererSandboxedProcessLauncherDelegate(channel_.get()), cmd_line, | 968 new RendererSandboxedProcessLauncherDelegate(channel_.get()), cmd_line, |
969 GetID(), this, child_token_, | 969 GetID(), this, field_trial_state_.get(), child_token_, |
970 base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); | 970 base::Bind(&RenderProcessHostImpl::OnMojoError, id_))); |
971 channel_->Pause(); | 971 channel_->Pause(); |
972 | 972 |
973 fast_shutdown_started_ = false; | 973 fast_shutdown_started_ = false; |
974 } | 974 } |
975 | 975 |
976 // Push any pending messages to the channel now. Note that if the child | 976 // Push any pending messages to the channel now. Note that if the child |
977 // process is still launching, the channel will be paused and outgoing | 977 // process is still launching, the channel will be paused and outgoing |
978 // messages will be queued internally by the channel. | 978 // messages will be queued internally by the channel. |
979 while (!queued_messages_.empty()) { | 979 while (!queued_messages_.empty()) { |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 gpu_data_manager->AppendRendererCommandLine(command_line); | 1572 gpu_data_manager->AppendRendererCommandLine(command_line); |
1573 | 1573 |
1574 // Slimming Paint v2 implies layer lists in the renderer. | 1574 // Slimming Paint v2 implies layer lists in the renderer. |
1575 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1575 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1576 switches::kEnableSlimmingPaintV2)) { | 1576 switches::kEnableSlimmingPaintV2)) { |
1577 command_line->AppendSwitch(cc::switches::kEnableLayerLists); | 1577 command_line->AppendSwitch(cc::switches::kEnableLayerLists); |
1578 } | 1578 } |
1579 } | 1579 } |
1580 | 1580 |
1581 void RenderProcessHostImpl::AppendRendererCommandLine( | 1581 void RenderProcessHostImpl::AppendRendererCommandLine( |
1582 base::CommandLine* command_line) const { | 1582 base::CommandLine* command_line) { |
1583 // Pass the process type first, so it shows first in process listings. | 1583 // Pass the process type first, so it shows first in process listings. |
1584 command_line->AppendSwitchASCII(switches::kProcessType, | 1584 command_line->AppendSwitchASCII(switches::kProcessType, |
1585 switches::kRendererProcess); | 1585 switches::kRendererProcess); |
1586 | 1586 |
1587 #if defined(OS_WIN) | 1587 #if defined(OS_WIN) |
1588 command_line->AppendArg(switches::kPrefetchArgumentRenderer); | 1588 command_line->AppendArg(switches::kPrefetchArgumentRenderer); |
1589 #endif // defined(OS_WIN) | 1589 #endif // defined(OS_WIN) |
1590 | 1590 |
1591 // Now send any options from our own command line we want to propagate. | 1591 // Now send any options from our own command line we want to propagate. |
1592 const base::CommandLine& browser_command_line = | 1592 const base::CommandLine& browser_command_line = |
(...skipping 18 matching lines...) Expand all Loading... |
1611 #endif | 1611 #endif |
1612 | 1612 |
1613 AppendCompositorCommandLineFlags(command_line); | 1613 AppendCompositorCommandLineFlags(command_line); |
1614 | 1614 |
1615 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, | 1615 command_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, |
1616 mojo_child_connection_->service_token()); | 1616 mojo_child_connection_->service_token()); |
1617 } | 1617 } |
1618 | 1618 |
1619 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( | 1619 void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( |
1620 const base::CommandLine& browser_cmd, | 1620 const base::CommandLine& browser_cmd, |
1621 base::CommandLine* renderer_cmd) const { | 1621 base::CommandLine* renderer_cmd) { |
1622 // Propagate the following switches to the renderer command line (along | 1622 // Propagate the following switches to the renderer command line (along |
1623 // with any associated values) if present in the browser command line. | 1623 // with any associated values) if present in the browser command line. |
1624 static const char* const kSwitchNames[] = { | 1624 static const char* const kSwitchNames[] = { |
1625 switches::kAgcStartupMinVolume, | 1625 switches::kAgcStartupMinVolume, |
1626 switches::kAecRefinedAdaptiveFilter, | 1626 switches::kAecRefinedAdaptiveFilter, |
1627 switches::kAllowLoopbackInPeerConnection, | 1627 switches::kAllowLoopbackInPeerConnection, |
1628 switches::kAndroidFontsPath, | 1628 switches::kAndroidFontsPath, |
1629 switches::kAudioBufferSize, | 1629 switches::kAudioBufferSize, |
1630 switches::kBlinkSettings, | 1630 switches::kBlinkSettings, |
1631 switches::kDefaultTileWidth, | 1631 switches::kDefaultTileWidth, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 #endif | 1824 #endif |
1825 #if defined(ENABLE_IPC_FUZZER) | 1825 #if defined(ENABLE_IPC_FUZZER) |
1826 switches::kIpcDumpDirectory, | 1826 switches::kIpcDumpDirectory, |
1827 switches::kIpcFuzzerTestcase, | 1827 switches::kIpcFuzzerTestcase, |
1828 #endif | 1828 #endif |
1829 switches::kUseMusInRenderer, | 1829 switches::kUseMusInRenderer, |
1830 }; | 1830 }; |
1831 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, | 1831 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, |
1832 arraysize(kSwitchNames)); | 1832 arraysize(kSwitchNames)); |
1833 | 1833 |
1834 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd); | 1834 field_trial_state_ = |
| 1835 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd); |
1835 | 1836 |
1836 if (browser_cmd.HasSwitch(switches::kTraceStartup) && | 1837 if (browser_cmd.HasSwitch(switches::kTraceStartup) && |
1837 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { | 1838 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { |
1838 // Pass kTraceStartup switch to renderer only if startup tracing has not | 1839 // Pass kTraceStartup switch to renderer only if startup tracing has not |
1839 // finished. | 1840 // finished. |
1840 renderer_cmd->AppendSwitchASCII( | 1841 renderer_cmd->AppendSwitchASCII( |
1841 switches::kTraceStartup, | 1842 switches::kTraceStartup, |
1842 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); | 1843 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); |
1843 } | 1844 } |
1844 | 1845 |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3032 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3032 | 3033 |
3033 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3034 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
3034 // enough information here so that we can determine what the bad message was. | 3035 // enough information here so that we can determine what the bad message was. |
3035 base::debug::Alias(&error); | 3036 base::debug::Alias(&error); |
3036 bad_message::ReceivedBadMessage(render_process_id, | 3037 bad_message::ReceivedBadMessage(render_process_id, |
3037 bad_message::RPH_MOJO_PROCESS_ERROR); | 3038 bad_message::RPH_MOJO_PROCESS_ERROR); |
3038 } | 3039 } |
3039 | 3040 |
3040 } // namespace content | 3041 } // namespace content |
OLD | NEW |