Commit 43325a37 authored by piman@chromium.org's avatar piman@chromium.org

Also append GPU command-line flags to the browser in single-process mode

BUG=314909

Review URL: https://codereview.chromium.org/129633002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244059 0039d316-1c4b-4281-b951-d872f2087c98
parent 3afb8de3
......@@ -1032,19 +1032,8 @@ void GpuDataManagerImplPrivate::InitializeImpl(
UpdateGpuSwitchingManager(gpu_info);
UpdatePreliminaryBlacklistedFeatures();
CommandLine* command_line = CommandLine::ForCurrentProcess();
// We pass down the list to GPU command buffer through commandline
// switches at GPU process launch. However, in situations where we don't
// have a GPU process, we append the browser process commandline.
if (command_line->HasSwitch(switches::kSingleProcess) ||
command_line->HasSwitch(switches::kInProcessGPU)) {
if (!gpu_driver_bugs_.empty()) {
command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
IntSetToString(gpu_driver_bugs_));
}
}
#if defined(OS_ANDROID)
ApplyAndroidWorkarounds(gpu_info, command_line);
ApplyAndroidWorkarounds(gpu_info, CommandLine::ForCurrentProcess());
#endif // OS_ANDROID
}
......
......@@ -578,8 +578,12 @@ bool GpuProcessHost::Init() {
if (in_process_) {
DCHECK(g_gpu_main_thread_factory);
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableGpuWatchdog);
CommandLine* command_line = CommandLine::ForCurrentProcess();
command_line->AppendSwitch(switches::kDisableGpuWatchdog);
GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
DCHECK(gpu_data_manager);
gpu_data_manager->AppendGpuCommandLine(command_line);
in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id));
in_process_gpu_thread_->Start();
......
......@@ -450,6 +450,10 @@ RenderProcessHostImpl::~RenderProcessHostImpl() {
<< "RenderProcessHostImpl is destroyed by something other than itself";
#endif
// Make sure to clean up the in-process renderer before the channel, otherwise
// it may still run and have its IPCs fail, causing asserts.
in_process_renderer_.reset();
ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID());
if (gpu_observer_registered_) {
......@@ -891,6 +895,22 @@ StoragePartition* RenderProcessHostImpl::GetStoragePartition() const {
return storage_partition_impl_;
}
static void AppendGpuCommandLineFlags(CommandLine* command_line) {
if (content::IsThreadedCompositingEnabled())
command_line->AppendSwitch(switches::kEnableThreadedCompositing);
if (content::IsDelegatedRendererEnabled())
command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
if (content::IsDeadlineSchedulingEnabled())
command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
// Appending disable-gpu-feature switches due to software rendering list.
GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
DCHECK(gpu_data_manager);
gpu_data_manager->AppendRendererCommandLine(command_line);
}
void RenderProcessHostImpl::AppendRendererCommandLine(
CommandLine* command_line) const {
// Pass the process type first, so it shows first in process listings.
......@@ -916,22 +936,10 @@ void RenderProcessHostImpl::AppendRendererCommandLine(
field_trial_states);
}
if (content::IsThreadedCompositingEnabled())
command_line->AppendSwitch(switches::kEnableThreadedCompositing);
if (content::IsDelegatedRendererEnabled())
command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
if (content::IsDeadlineSchedulingEnabled())
command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
GetContentClient()->browser()->AppendExtraCommandLineSwitches(
command_line, GetID());
// Appending disable-gpu-feature switches due to software rendering list.
GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance();
DCHECK(gpu_data_manager);
gpu_data_manager->AppendRendererCommandLine(command_line);
AppendGpuCommandLineFlags(command_line);
}
void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
......@@ -1656,12 +1664,18 @@ void RenderProcessHost::SetRunRendererInProcess(bool value) {
g_run_renderer_in_process_ = value;
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (value && !command_line->HasSwitch(switches::kLang)) {
// Modify the current process' command line to include the browser locale,
// as the renderer expects this flag to be set.
const std::string locale =
GetContentClient()->browser()->GetApplicationLocale();
command_line->AppendSwitchASCII(switches::kLang, locale);
if (value) {
if (!command_line->HasSwitch(switches::kLang)) {
// Modify the current process' command line to include the browser locale,
// as the renderer expects this flag to be set.
const std::string locale =
GetContentClient()->browser()->GetApplicationLocale();
command_line->AppendSwitchASCII(switches::kLang, locale);
}
// TODO(piman): we should really send configuration through bools rather
// than by parsing strings, i.e. sending an IPC rather than command line
// args. crbug.com/314909
AppendGpuCommandLineFlags(command_line);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment