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, field_trial_state_.get(), child_token_, | 969 GetID(), this, 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 #endif | 1821 #endif |
1822 #if defined(ENABLE_IPC_FUZZER) | 1822 #if defined(ENABLE_IPC_FUZZER) |
1823 switches::kIpcDumpDirectory, | 1823 switches::kIpcDumpDirectory, |
1824 switches::kIpcFuzzerTestcase, | 1824 switches::kIpcFuzzerTestcase, |
1825 #endif | 1825 #endif |
1826 switches::kUseMusInRenderer, | 1826 switches::kUseMusInRenderer, |
1827 }; | 1827 }; |
1828 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, | 1828 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, |
1829 arraysize(kSwitchNames)); | 1829 arraysize(kSwitchNames)); |
1830 | 1830 |
1831 field_trial_state_ = | 1831 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd); |
1832 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd); | |
1833 | 1832 |
1834 if (browser_cmd.HasSwitch(switches::kTraceStartup) && | 1833 if (browser_cmd.HasSwitch(switches::kTraceStartup) && |
1835 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { | 1834 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { |
1836 // Pass kTraceStartup switch to renderer only if startup tracing has not | 1835 // Pass kTraceStartup switch to renderer only if startup tracing has not |
1837 // finished. | 1836 // finished. |
1838 renderer_cmd->AppendSwitchASCII( | 1837 renderer_cmd->AppendSwitchASCII( |
1839 switches::kTraceStartup, | 1838 switches::kTraceStartup, |
1840 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); | 1839 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); |
1841 } | 1840 } |
1842 | 1841 |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3030 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3029 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3031 | 3030 |
3032 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3031 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
3033 // enough information here so that we can determine what the bad message was. | 3032 // enough information here so that we can determine what the bad message was. |
3034 base::debug::Alias(&error); | 3033 base::debug::Alias(&error); |
3035 bad_message::ReceivedBadMessage(render_process_id, | 3034 bad_message::ReceivedBadMessage(render_process_id, |
3036 bad_message::RPH_MOJO_PROCESS_ERROR); | 3035 bad_message::RPH_MOJO_PROCESS_ERROR); |
3037 } | 3036 } |
3038 | 3037 |
3039 } // namespace content | 3038 } // namespace content |
OLD | NEW |