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

Side by Side Diff: content/browser/android/content_startup_flags.cc

Issue 356453003: Don't share renderers between unrelated tabs on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move declaration of more services to a separate CL. Created 6 years, 6 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 | Annotate | Revision Log
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 #include "ui/native_theme/native_theme_switches.h" 17 #include "ui/native_theme/native_theme_switches.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 void SetContentCommandLineFlags(int max_render_process_count, 21 void SetContentCommandLineFlags(bool in_process,
22 const std::string& plugin_descriptor) { 22 const std::string& plugin_descriptor) {
23 // May be called multiple times, to cover all possible program entry points. 23 // May be called multiple times, to cover all possible program entry points.
24 static bool already_initialized = false; 24 static bool already_initialized = false;
25 if (already_initialized) 25 if (already_initialized)
26 return; 26 return;
27 already_initialized = true; 27 already_initialized = true;
28 28
29 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); 29 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
30 30
31 int command_line_renderer_limit = -1; 31 int command_line_renderer_limit = -1;
32 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) { 32 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) {
33 std::string limit = parsed_command_line->GetSwitchValueASCII( 33 std::string limit = parsed_command_line->GetSwitchValueASCII(
34 switches::kRendererProcessLimit); 34 switches::kRendererProcessLimit);
35 int value; 35 int value;
36 if (base::StringToInt(limit, &value)) { 36 if (base::StringToInt(limit, &value)) {
37 command_line_renderer_limit = value; 37 command_line_renderer_limit = std::max(0, value);
38 if (value <= 0)
39 max_render_process_count = 0;
40 } 38 }
41 } 39 }
42 40
43 if (command_line_renderer_limit > 0) { 41 if (command_line_renderer_limit > 0) {
44 int limit = std::min(command_line_renderer_limit, 42 int limit = std::min(command_line_renderer_limit,
45 static_cast<int>(kMaxRendererProcessCount)); 43 static_cast<int>(kMaxRendererProcessCount));
46 RenderProcessHost::SetMaxRendererProcessCount(limit); 44 RenderProcessHost::SetMaxRendererProcessCount(limit);
47 } else if (max_render_process_count <= 0) { 45 }
46
47 if (in_process) {
klobag.chromium 2014/06/27 16:25:42 hmm what happen is command_line_renderer_limit > 0
ppi 2014/06/27 16:40:32 Nothing in particular. It already can happen - the
ppi 2014/07/16 13:26:54 Oh, I see there is a change in behavior. If both c
48 // Need to ensure the command line flag is consistent as a lot of chrome 48 // Need to ensure the command line flag is consistent as a lot of chrome
49 // internal code checks this directly, but it wouldn't normally get set when 49 // internal code checks this directly, but it wouldn't normally get set when
50 // we are implementing an embedded WebView. 50 // we are implementing an embedded WebView.
51 parsed_command_line->AppendSwitch(switches::kSingleProcess); 51 parsed_command_line->AppendSwitch(switches::kSingleProcess);
52 } else {
53 int default_maximum = RenderProcessHost::GetMaxRendererProcessCount();
54 DCHECK(default_maximum <= static_cast<int>(kMaxRendererProcessCount));
55 if (max_render_process_count < default_maximum)
56 RenderProcessHost::SetMaxRendererProcessCount(max_render_process_count);
57 } 52 }
58 53
59 parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing); 54 parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing);
60 parsed_command_line->AppendSwitch( 55 parsed_command_line->AppendSwitch(
61 switches::kEnableCompositingForFixedPosition); 56 switches::kEnableCompositingForFixedPosition);
62 parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll); 57 parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll);
63 parsed_command_line->AppendSwitch(switches::kEnableBeginFrameScheduling); 58 parsed_command_line->AppendSwitch(switches::kEnableBeginFrameScheduling);
64 59
65 parsed_command_line->AppendSwitch(switches::kEnableGestureTapHighlight); 60 parsed_command_line->AppendSwitch(switches::kEnableGestureTapHighlight);
66 parsed_command_line->AppendSwitch(switches::kEnablePinch); 61 parsed_command_line->AppendSwitch(switches::kEnablePinch);
(...skipping 25 matching lines...) Expand all
92 } 87 }
93 88
94 // Disable profiler timing by default. 89 // Disable profiler timing by default.
95 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) { 90 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) {
96 parsed_command_line->AppendSwitchASCII( 91 parsed_command_line->AppendSwitchASCII(
97 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); 92 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
98 } 93 }
99 } 94 }
100 95
101 } // namespace content 96 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698