OLD | NEW |
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/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 void SetContentCommandLineFlags(int max_render_process_count, | 44 void SetContentCommandLineFlags(int max_render_process_count, |
45 const std::string& plugin_descriptor) { | 45 const std::string& plugin_descriptor) { |
46 // May be called multiple times, to cover all possible program entry points. | 46 // May be called multiple times, to cover all possible program entry points. |
47 static bool already_initialized = false; | 47 static bool already_initialized = false; |
48 if (already_initialized) return; | 48 if (already_initialized) return; |
49 already_initialized = true; | 49 already_initialized = true; |
50 | 50 |
51 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); | 51 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess(); |
52 | 52 |
53 #if !defined(ANDROID_UPSTREAM_BRINGUP) | 53 |
54 // TODO(yfriedman): Upstream this when bringing up rendering code and | 54 // TODO(yfriedman): Upstream this when bringing up rendering code and |
55 // rendering modes. b/6668088 | 55 // rendering modes. b/6668088 |
56 // Set subflags for the --graphics-mode=XYZ omnibus flag. | 56 // Set subflags for the --graphics-mode=XYZ omnibus flag. |
57 std::string graphics_mode; | 57 std::string graphics_mode; |
58 if (parsed_command_line->HasSwitch(switches::kGraphicsMode)) { | 58 if (parsed_command_line->HasSwitch(switches::kGraphicsMode)) { |
59 graphics_mode = parsed_command_line->GetSwitchValueASCII( | 59 graphics_mode = parsed_command_line->GetSwitchValueASCII( |
60 switches::kGraphicsMode); | 60 switches::kGraphicsMode); |
61 } else { | 61 } else { |
62 // Default mode is threaded compositor mode | 62 // Default mode is threaded compositor mode |
63 graphics_mode = switches::kGraphicsModeValueCompositor; | 63 graphics_mode = switches::kGraphicsModeValueCompositor; |
64 parsed_command_line->AppendSwitchNative( | 64 parsed_command_line->AppendSwitchNative( |
65 switches::kGraphicsMode, graphics_mode.c_str()); | 65 switches::kGraphicsMode, graphics_mode.c_str()); |
66 } | 66 } |
67 | 67 |
68 if (graphics_mode == switches::kGraphicsModeValueBasic) { | 68 if (graphics_mode == switches::kGraphicsModeValueBasic) { |
69 // Intentionally blank. | 69 // Intentionally blank. |
70 } else if (graphics_mode == switches::kGraphicsModeValueCompositor) { | 70 } else if (graphics_mode == switches::kGraphicsModeValueCompositor) { |
71 SetCommandLineSwitch(switches::kForceCompositingMode); | 71 SetCommandLineSwitch(switches::kForceCompositingMode); |
72 SetCommandLineSwitch(switches::kEnableAcceleratedPlugins); | 72 SetCommandLineSwitch(switches::kEnableAcceleratedPlugins); |
73 SetCommandLineSwitch(switches::kEnableCompositingForFixedPosition); | 73 SetCommandLineSwitch(switches::kEnableCompositingForFixedPosition); |
74 SetCommandLineSwitch(switches::kEnableThreadedCompositing); | 74 SetCommandLineSwitch(switches::kEnableThreadedCompositing); |
75 // Per tile painting saves memory in background tabs (http://b/5669228). | 75 // Per tile painting saves memory in background tabs (http://b/5669228). |
76 SetCommandLineSwitch(switches::kEnablePerTilePainting); | 76 // ...but it now fails an SkAssert(), so disable it. b/6819634 |
| 77 // SetCommandLineSwitch(switches::kEnablePerTilePainting); |
77 } else { | 78 } else { |
78 LOG(FATAL) << "Invalid --graphics-mode flag: " << graphics_mode; | 79 LOG(FATAL) << "Invalid --graphics-mode flag: " << graphics_mode; |
79 } | 80 } |
80 #endif | |
81 | 81 |
82 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) { | 82 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) { |
83 std::string limit = parsed_command_line->GetSwitchValueASCII( | 83 std::string limit = parsed_command_line->GetSwitchValueASCII( |
84 switches::kRendererProcessLimit); | 84 switches::kRendererProcessLimit); |
85 int value; | 85 int value; |
86 if (base::StringToInt(limit, &value)) | 86 if (base::StringToInt(limit, &value)) |
87 max_render_process_count = value; | 87 max_render_process_count = value; |
88 } | 88 } |
89 | 89 |
90 if (max_render_process_count <= 0) { | 90 if (max_render_process_count <= 0) { |
(...skipping 27 matching lines...) Expand all Loading... |
118 "1"); | 118 "1"); |
119 | 119 |
120 // TODO(aelias): Enable these flags once they're merged in from upstream. | 120 // TODO(aelias): Enable these flags once they're merged in from upstream. |
121 // parsed_command_line->AppendSwitch(switches::kEnableTouchEvents); | 121 // parsed_command_line->AppendSwitch(switches::kEnableTouchEvents); |
122 // parsed_command_line->AppendSwitch(switches::kEnablePinch); | 122 // parsed_command_line->AppendSwitch(switches::kEnablePinch); |
123 | 123 |
124 SetPepperCommandLineFlags(plugin_descriptor); | 124 SetPepperCommandLineFlags(plugin_descriptor); |
125 } | 125 } |
126 | 126 |
127 } // namespace content | 127 } // namespace content |
OLD | NEW |