| Index: content/browser/android/content_startup_flags.cc
|
| diff --git a/content/browser/android/content_startup_flags.cc b/content/browser/android/content_startup_flags.cc
|
| index 3f1fd85f77151a31cfc271114bd20820b66f7974..209455db5ef759ea2392fde12c59073886bb1757 100644
|
| --- a/content/browser/android/content_startup_flags.cc
|
| +++ b/content/browser/android/content_startup_flags.cc
|
| @@ -27,25 +27,32 @@ void SetContentCommandLineFlags(int max_render_process_count,
|
|
|
| CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
|
|
|
| + int command_line_renderer_limit = -1;
|
| if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) {
|
| std::string limit = parsed_command_line->GetSwitchValueASCII(
|
| switches::kRendererProcessLimit);
|
| int value;
|
| - if (base::StringToInt(limit, &value))
|
| - max_render_process_count = value;
|
| + if (base::StringToInt(limit, &value)) {
|
| + command_line_renderer_limit = value;
|
| + if (value <= 0)
|
| + max_render_process_count = 0;
|
| + }
|
| }
|
|
|
| - if (max_render_process_count <= 0) {
|
| + if (command_line_renderer_limit > 0) {
|
| + int limit = std::min(command_line_renderer_limit,
|
| + static_cast<int>(kMaxRendererProcessCount));
|
| + RenderProcessHost::SetMaxRendererProcessCount(limit);
|
| + } else if (max_render_process_count <= 0) {
|
| // Need to ensure the command line flag is consistent as a lot of chrome
|
| // internal code checks this directly, but it wouldn't normally get set when
|
| // we are implementing an embedded WebView.
|
| parsed_command_line->AppendSwitch(switches::kSingleProcess);
|
| } else {
|
| - max_render_process_count =
|
| - std::min(max_render_process_count,
|
| - static_cast<int>(content::kMaxRendererProcessCount));
|
| - content::RenderProcessHost::SetMaxRendererProcessCount(
|
| - max_render_process_count);
|
| + int default_maximum = RenderProcessHost::GetMaxRendererProcessCount();
|
| + DCHECK(default_maximum <= static_cast<int>(kMaxRendererProcessCount));
|
| + if (max_render_process_count < default_maximum)
|
| + RenderProcessHost::SetMaxRendererProcessCount(max_render_process_count);
|
| }
|
|
|
| parsed_command_line->AppendSwitch(switches::kForceCompositingMode);
|
|
|