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

Unified Diff: content/browser/android/content_startup_flags.cc

Issue 138313004: Render process count should not be forced from java unconditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix debug compile issue Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698