Revert 248827 "android: Migrate old content readback to use asyn..."
[chromium-blink-merge.git] / content / browser / android / content_startup_flags.cc
blob3f1fd85f77151a31cfc271114bd20820b66f7974
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
3 // found in the LICENSE file.
5 #include "content/browser/android/content_startup_flags.h"
7 #include "base/base_switches.h"
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "cc/base/switches.h"
12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/common/content_constants.h"
14 #include "content/public/common/content_switches.h"
15 #include "gpu/command_buffer/service/gpu_switches.h"
16 #include "ui/base/ui_base_switches.h"
18 namespace content {
20 void SetContentCommandLineFlags(int max_render_process_count,
21 const std::string& plugin_descriptor) {
22 // May be called multiple times, to cover all possible program entry points.
23 static bool already_initialized = false;
24 if (already_initialized)
25 return;
26 already_initialized = true;
28 CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
30 if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) {
31 std::string limit = parsed_command_line->GetSwitchValueASCII(
32 switches::kRendererProcessLimit);
33 int value;
34 if (base::StringToInt(limit, &value))
35 max_render_process_count = value;
38 if (max_render_process_count <= 0) {
39 // 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
41 // we are implementing an embedded WebView.
42 parsed_command_line->AppendSwitch(switches::kSingleProcess);
43 } else {
44 max_render_process_count =
45 std::min(max_render_process_count,
46 static_cast<int>(content::kMaxRendererProcessCount));
47 content::RenderProcessHost::SetMaxRendererProcessCount(
48 max_render_process_count);
51 parsed_command_line->AppendSwitch(switches::kForceCompositingMode);
52 parsed_command_line->AppendSwitch(switches::kAllowWebUICompositing);
53 parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing);
54 parsed_command_line->AppendSwitch(
55 switches::kEnableCompositingForFixedPosition);
56 parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll);
57 parsed_command_line->AppendSwitch(
58 switches::kEnableAcceleratedScrollableFrames);
59 parsed_command_line->AppendSwitch(
60 switches::kEnableCompositedScrollingForFrames);
61 parsed_command_line->AppendSwitch(switches::kEnableBeginFrameScheduling);
62 parsed_command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
64 parsed_command_line->AppendSwitch(switches::kDisableGestureDebounce);
65 parsed_command_line->AppendSwitch(switches::kEnableGestureTapHighlight);
66 parsed_command_line->AppendSwitch(switches::kEnablePinch);
67 parsed_command_line->AppendSwitch(switches::kEnableOverlayFullscreenVideo);
68 parsed_command_line->AppendSwitch(switches::kEnableOverlayScrollbar);
69 parsed_command_line->AppendSwitch(switches::kEnableOverscrollNotifications);
70 parsed_command_line->AppendSwitchASCII(switches::kTouchAckTimeoutDelayMs,
71 "200");
73 // Run the GPU service as a thread in the browser instead of as a
74 // standalone process.
75 parsed_command_line->AppendSwitch(switches::kInProcessGPU);
76 parsed_command_line->AppendSwitch(switches::kDisableGpuShaderDiskCache);
78 parsed_command_line->AppendSwitch(switches::kEnableViewport);
79 parsed_command_line->AppendSwitch(switches::kEnableViewportMeta);
80 parsed_command_line->AppendSwitch(
81 switches::kMainFrameResizesAreOrientationChanges);
83 // Disable anti-aliasing.
84 parsed_command_line->AppendSwitch(
85 cc::switches::kDisableCompositedAntialiasing);
87 parsed_command_line->AppendSwitch(switches::kUIPrioritizeInGpuProcess);
89 if (!plugin_descriptor.empty()) {
90 parsed_command_line->AppendSwitchNative(
91 switches::kRegisterPepperPlugins, plugin_descriptor);
94 // Disable profiler timing by default.
95 if (!parsed_command_line->HasSwitch(switches::kProfilerTiming)) {
96 parsed_command_line->AppendSwitchASCII(
97 switches::kProfilerTiming, switches::kProfilerTimingDisabledValue);
101 } // namespace content