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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: rebase + gclient sync Created 4 years, 2 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 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
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
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
1611 #endif 1611 #endif
1612 1612
1613 AppendCompositorCommandLineFlags(command_line); 1613 AppendCompositorCommandLineFlags(command_line);
1614 1614
1615 command_line->AppendSwitchASCII(switches::kServiceRequestChannelToken, 1615 command_line->AppendSwitchASCII(switches::kServiceRequestChannelToken,
1616 child_connection_->service_token()); 1616 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd); 1831 field_trial_state_ =
1832 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd);
1832 1833
1833 if (browser_cmd.HasSwitch(switches::kTraceStartup) && 1834 if (browser_cmd.HasSwitch(switches::kTraceStartup) &&
1834 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { 1835 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) {
1835 // Pass kTraceStartup switch to renderer only if startup tracing has not 1836 // Pass kTraceStartup switch to renderer only if startup tracing has not
1836 // finished. 1837 // finished.
1837 renderer_cmd->AppendSwitchASCII( 1838 renderer_cmd->AppendSwitchASCII(
1838 switches::kTraceStartup, 1839 switches::kTraceStartup,
1839 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); 1840 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup));
1840 } 1841 }
1841 1842
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3030 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3030 3031
3031 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3032 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3032 // enough information here so that we can determine what the bad message was. 3033 // enough information here so that we can determine what the bad message was.
3033 base::debug::Alias(&error); 3034 base::debug::Alias(&error);
3034 bad_message::ReceivedBadMessage(render_process_id, 3035 bad_message::ReceivedBadMessage(render_process_id,
3035 bad_message::RPH_MOJO_PROCESS_ERROR); 3036 bad_message::RPH_MOJO_PROCESS_ERROR);
3036 } 3037 }
3037 3038
3038 } // namespace content 3039 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698