Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index fd3a7f22fe71ae0b451b6bf898700cf56445627f..fb2f37c7a042503bc01602852b8296bf6c7affc1 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -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); |
} |
} |