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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/android/content_startup_flags.h" 5 #include "content/browser/android/content_startup_flags.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "cc/base/switches.h" 11 #include "cc/base/switches.h"
12 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/common/content_constants.h" 13 #include "content/public/common/content_constants.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "gpu/command_buffer/service/gpu_switches.h" 15 #include "gpu/command_buffer/service/gpu_switches.h"
16 #include "ui/base/ui_base_switches.h" 16 #include "ui/base/ui_base_switches.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 void SetContentCommandLineFlags(int max_render_process_count, 20 void SetContentCommandLineFlags(int max_render_process_count,
21 const std::string& plugin_descriptor) { 21 const std::string& plugin_descriptor) {
22 // May be called multiple times, to cover all possible program entry points. 22 // May be called multiple times, to cover all possible program entry points.
23 static bool already_initialized = false; 23 static bool already_initialized = false;
24 if (already_initialized) 24 if (already_initialized)
25 return; 25 return;
26 already_initialized = true; 26 already_initialized = true;
27 27
28 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); 28 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
29 29
30 int command_line_renderer_limit = -1;
30 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) { 31 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) {
31 std::string limit = parsed_command_line->GetSwitchValueASCII( 32 std::string limit = parsed_command_line->GetSwitchValueASCII(
32 switches::kRendererProcessLimit); 33 switches::kRendererProcessLimit);
33 int value; 34 int value;
34 if (base::StringToInt(limit, &value)) 35 if (base::StringToInt(limit, &value)) {
35 max_render_process_count = value; 36 command_line_renderer_limit = value;
37 if (value <= 0)
38 max_render_process_count = 0;
39 }
36 } 40 }
37 41
38 if (max_render_process_count <= 0) { 42 if (command_line_renderer_limit > 0) {
43 int limit = std::min(command_line_renderer_limit,
44 static_cast<int>(kMaxRendererProcessCount));
45 RenderProcessHost::SetMaxRendererProcessCount(limit);
46 } else if (max_render_process_count <= 0) {
39 // Need to ensure the command line flag is consistent as a lot of chrome 47 // Need to ensure the command line flag is consistent as a lot of chrome
40 // internal code checks this directly, but it wouldn't normally get set when 48 // internal code checks this directly, but it wouldn't normally get set when
41 // we are implementing an embedded WebView. 49 // we are implementing an embedded WebView.
42 parsed_command_line->AppendSwitch(switches::kSingleProcess); 50 parsed_command_line->AppendSwitch(switches::kSingleProcess);
43 } else { 51 } else {
44 max_render_process_count = 52 int default_maximum = RenderProcessHost::GetMaxRendererProcessCount();
45 std::min(max_render_process_count, 53 DCHECK(default_maximum <= static_cast<int>(kMaxRendererProcessCount));
46 static_cast<int>(content::kMaxRendererProcessCount)); 54 if (max_render_process_count < default_maximum)
47 content::RenderProcessHost::SetMaxRendererProcessCount( 55 RenderProcessHost::SetMaxRendererProcessCount(max_render_process_count);
48 max_render_process_count);
49 } 56 }
50 57
51 parsed_command_line->AppendSwitch(switches::kForceCompositingMode); 58 parsed_command_line->AppendSwitch(switches::kForceCompositingMode);
52 parsed_command_line->AppendSwitch(switches::kAllowWebUICompositing); 59 parsed_command_line->AppendSwitch(switches::kAllowWebUICompositing);
53 parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing); 60 parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing);
54 parsed_command_line->AppendSwitch( 61 parsed_command_line->AppendSwitch(
55 switches::kEnableCompositingForFixedPosition); 62 switches::kEnableCompositingForFixedPosition);
56 parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll); 63 parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll);
57 parsed_command_line->AppendSwitch( 64 parsed_command_line->AppendSwitch(
58 switches::kEnableAcceleratedScrollableFrames); 65 switches::kEnableAcceleratedScrollableFrames);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 99 }
93 100
94 // Disable profiler timing by default. 101 // Disable profiler timing by default.
95 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) { 102 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) {
96 parsed_command_line->AppendSwitchASCII( 103 parsed_command_line->AppendSwitchASCII(
97 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); 104 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
98 } 105 }
99 } 106 }
100 107
101 } // namespace content 108 } // namespace content
OLDNEW
« 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