Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / browser / android / content_startup_flags.cc
index 3f1fd85..0fe9f82 100644 (file)
@@ -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);
@@ -86,6 +93,8 @@ void SetContentCommandLineFlags(int max_render_process_count,
 
   parsed_command_line->AppendSwitch(switches::kUIPrioritizeInGpuProcess);
 
+  parsed_command_line->AppendSwitch(switches::kEnableDelegatedRenderer);
+
   if (!plugin_descriptor.empty()) {
     parsed_command_line->AppendSwitchNative(
       switches::kRegisterPepperPlugins, plugin_descriptor);