blob: 8f7e29cbdb8b5461036d7bbf0e2f7cc482d3b208 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/android/content_startup_flags.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "cc/base/switches.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ui/base/ui_base_switches.h"
namespace content {
void SetContentCommandLineFlags(int max_render_process_count,
const std::string& plugin_descriptor) {
// May be called multiple times, to cover all possible program entry points.
static bool already_initialized = false;
if (already_initialized)
return;
already_initialized = true;
CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
if (parsed_command_line->HasSwitch(switches::kRendererProcessLimit)) {
std::string limit = parsed_command_line->GetSwitchValueASCII(
switches::kRendererProcessLimit);
int value;
if (base::StringToInt(limit, &value))
max_render_process_count = value;
}
if (max_render_process_count <= 0) {
// Need to ensure the command line flag is consistent as a lot of chrome
// internal code checks this directly, but it wouldn't normally get set when
// we are implementing an embedded WebView.
parsed_command_line->AppendSwitch(switches::kSingleProcess);
} else {
max_render_process_count =
std::min(max_render_process_count,
static_cast<int>(content::kMaxRendererProcessCount));
content::RenderProcessHost::SetMaxRendererProcessCount(
max_render_process_count);
}
parsed_command_line->AppendSwitch(switches::kForceCompositingMode);
parsed_command_line->AppendSwitch(switches::kAllowWebUICompositing);
parsed_command_line->AppendSwitch(switches::kEnableThreadedCompositing);
parsed_command_line->AppendSwitch(
switches::kEnableCompositingForFixedPosition);
parsed_command_line->AppendSwitch(switches::kEnableAcceleratedOverflowScroll);
parsed_command_line->AppendSwitch(
switches::kEnableAcceleratedScrollableFrames);
parsed_command_line->AppendSwitch(
switches::kEnableCompositedScrollingForFrames);
parsed_command_line->AppendSwitch(switches::kEnableBeginFrameScheduling);
parsed_command_line->AppendSwitch(switches::kEnableDeadlineScheduling);
parsed_command_line->AppendSwitch(switches::kDisableGestureDebounce);
parsed_command_line->AppendSwitch(switches::kEnableGestureTapHighlight);
parsed_command_line->AppendSwitch(switches::kEnablePinch);
parsed_command_line->AppendSwitch(switches::kEnableOverlayFullscreenVideo);
parsed_command_line->AppendSwitch(switches::kEnableOverlayScrollbars);
parsed_command_line->AppendSwitch(switches::kEnableOverscrollNotifications);
// Run the GPU service as a thread in the browser instead of as a
// standalone process.
parsed_command_line->AppendSwitch(switches::kInProcessGPU);
parsed_command_line->AppendSwitch(switches::kDisableGpuShaderDiskCache);
parsed_command_line->AppendSwitch(switches::kEnableViewport);
parsed_command_line->AppendSwitch(switches::kEnableViewportMeta);
parsed_command_line->AppendSwitch(
switches::kMainFrameResizesAreOrientationChanges);
// Disable anti-aliasing.
parsed_command_line->AppendSwitch(
cc::switches::kDisableCompositedAntialiasing);
if (!plugin_descriptor.empty()) {
parsed_command_line->AppendSwitchNative(
switches::kRegisterPepperPlugins, plugin_descriptor);
}
}
} // namespace content
|