| 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/android/build_info.h" |
| 7 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 12 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
| 13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/common/content_constants.h" | 15 #include "content/public/common/content_constants.h" |
| 15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 16 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_switches.h" |
| 17 #include "ui/base/ui_base_switches.h" | 18 #include "ui/base/ui_base_switches.h" |
| 18 #include "ui/native_theme/native_theme_switches.h" | 19 #include "ui/native_theme/native_theme_switches.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 22 namespace { |
| 23 |
| 24 // Android SDK API level for the Jelly Bean release. |
| 25 const int kAndroidJellyBeanApiLevel = 16; |
| 26 |
| 27 } // namespace |
| 21 | 28 |
| 22 void SetContentCommandLineFlags(bool single_process, | 29 void SetContentCommandLineFlags(bool single_process, |
| 23 const std::string& plugin_descriptor) { | 30 const std::string& plugin_descriptor) { |
| 24 // May be called multiple times, to cover all possible program entry points. | 31 // May be called multiple times, to cover all possible program entry points. |
| 25 static bool already_initialized = false; | 32 static bool already_initialized = false; |
| 26 if (already_initialized) | 33 if (already_initialized) |
| 27 return; | 34 return; |
| 28 already_initialized = true; | 35 already_initialized = true; |
| 29 | 36 |
| 30 base::CommandLine* parsed_command_line = | 37 base::CommandLine* parsed_command_line = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 72 |
| 66 // On legacy low-memory devices the behavior has not been studied with regard | 73 // On legacy low-memory devices the behavior has not been studied with regard |
| 67 // to having an extra process with similar priority as the foreground renderer | 74 // to having an extra process with similar priority as the foreground renderer |
| 68 // and given that the system will often be looking for a process to be killed | 75 // and given that the system will often be looking for a process to be killed |
| 69 // on such systems. | 76 // on such systems. |
| 70 if (base::SysInfo::IsLowEndDevice()) | 77 if (base::SysInfo::IsLowEndDevice()) |
| 71 parsed_command_line->AppendSwitch(switches::kInProcessGPU); | 78 parsed_command_line->AppendSwitch(switches::kInProcessGPU); |
| 72 | 79 |
| 73 parsed_command_line->AppendSwitch(switches::kDisableGpuShaderDiskCache); | 80 parsed_command_line->AppendSwitch(switches::kDisableGpuShaderDiskCache); |
| 74 | 81 |
| 82 // Web Notifications are only supported on Android JellyBean and beyond. |
| 83 if (base::android::BuildInfo::GetInstance()->sdk_int() < |
| 84 kAndroidJellyBeanApiLevel) { |
| 85 parsed_command_line->AppendSwitch(switches::kDisableNotifications); |
| 86 } |
| 87 |
| 75 parsed_command_line->AppendSwitch(switches::kEnableViewportMeta); | 88 parsed_command_line->AppendSwitch(switches::kEnableViewportMeta); |
| 76 parsed_command_line->AppendSwitch( | 89 parsed_command_line->AppendSwitch( |
| 77 switches::kMainFrameResizesAreOrientationChanges); | 90 switches::kMainFrameResizesAreOrientationChanges); |
| 78 | 91 |
| 79 // Disable anti-aliasing. | 92 // Disable anti-aliasing. |
| 80 parsed_command_line->AppendSwitch( | 93 parsed_command_line->AppendSwitch( |
| 81 cc::switches::kDisableCompositedAntialiasing); | 94 cc::switches::kDisableCompositedAntialiasing); |
| 82 | 95 |
| 83 parsed_command_line->AppendSwitch(switches::kUIPrioritizeInGpuProcess); | 96 parsed_command_line->AppendSwitch(switches::kUIPrioritizeInGpuProcess); |
| 84 | 97 |
| 85 parsed_command_line->AppendSwitch(switches::kEnableDelegatedRenderer); | 98 parsed_command_line->AppendSwitch(switches::kEnableDelegatedRenderer); |
| 86 | 99 |
| 87 if (!plugin_descriptor.empty()) { | 100 if (!plugin_descriptor.empty()) { |
| 88 parsed_command_line->AppendSwitchNative( | 101 parsed_command_line->AppendSwitchNative( |
| 89 switches::kRegisterPepperPlugins, plugin_descriptor); | 102 switches::kRegisterPepperPlugins, plugin_descriptor); |
| 90 } | 103 } |
| 91 | 104 |
| 92 // Disable profiler timing by default. | 105 // Disable profiler timing by default. |
| 93 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) { | 106 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) { |
| 94 parsed_command_line->AppendSwitchASCII( | 107 parsed_command_line->AppendSwitchASCII( |
| 95 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); | 108 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); |
| 96 } | 109 } |
| 97 } | 110 } |
| 98 | 111 |
| 99 } // namespace content | 112 } // namespace content |
| OLD | NEW |