File: features.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (232 lines) | stat: -rw-r--r-- 10,421 bytes parent folder | download | duplicates (5)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This header contains field trial and variations definitions for policies,
// mechanisms and features in the performance_manager component.

#ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_FEATURES_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_FEATURES_H_

#include <string>

#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/time/time.h"
#include "build/build_config.h"

namespace performance_manager::features {

#if !BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_LINUX)
#define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() false
#else
#define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() true
#endif

// When enabled removes the rate limit on reporting tab processes to resourced.
#if BUILDFLAG(IS_CHROMEOS)
BASE_DECLARE_FEATURE(kUnthrottledTabProcessReporting);
#endif

// Enable background tab loading of pages (restored via session restore)
// directly from Performance Manager rather than via TabLoader.
BASE_DECLARE_FEATURE(kBackgroundTabLoadingFromPerformanceManager);

// Minimum site engagement score for a tab to be restored, if it doesn't
// communicate in the background. If 0, engagement score doesn't prevent any tab
// from being loaded.
BASE_DECLARE_FEATURE_PARAM(size_t, kBackgroundTabLoadingMinSiteEngagement);

// If false, the background tab loading policy won't set the main frame restored
// state before restoring a tab. This gives it the same bugs as TabLoader: the
// notification permission and features stored in SiteDataReader won't be used,
// because they're looked up by url which isn't available without the restored
// state. This minimizes behaviour differences between TabLoader and the
// Performance Manager policy, for performance comparisons.
BASE_DECLARE_FEATURE_PARAM(bool, kBackgroundTabLoadingRestoreMainFrameState);

// Make the Battery Saver Modes available to users. If this is enabled, it
// doesn't mean the mode is enabled, just that the user has the option of
// toggling it.
BASE_DECLARE_FEATURE(kBatterySaverModeAvailable);

// Flags to control HaTS surveys about Chrome performance.
BASE_DECLARE_FEATURE(kPerformanceControlsPPMSurvey);

// Defines the minimum and maximum delay before showing the PPM survey. It will
// be shown the next time the user opens the New Tab Page after a random time in
// this range.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta,
                           kPerformanceControlsPPMSurveyMinDelay);
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta,
                           kPerformanceControlsPPMSurveyMaxDelay);

// Controls whether survey responses will be tagged as "Selected For Uniform
// Sample". The subset of responses with this tag approximate the general
// population, no matter how many responses are received in individual segments.
BASE_DECLARE_FEATURE_PARAM(bool,
                           kPerformanceControlsPPMSurveyUniformSampleValue);

// Defines the names and boundaries of up to 3 segments for the PPM survey.
// There's no kPerformanceControlsPPMSurveySegmentMaxMemoryGB3 because there's
// never a 4th segment, so segment 3 has no maximum.
BASE_DECLARE_FEATURE_PARAM(std::string,
                           kPerformanceControlsPPMSurveySegmentName1);
BASE_DECLARE_FEATURE_PARAM(std::string,
                           kPerformanceControlsPPMSurveySegmentName2);
BASE_DECLARE_FEATURE_PARAM(std::string,
                           kPerformanceControlsPPMSurveySegmentName3);
BASE_DECLARE_FEATURE_PARAM(size_t,
                           kPerformanceControlsPPMSurveySegmentMaxMemoryGB1);
BASE_DECLARE_FEATURE_PARAM(size_t,
                           kPerformanceControlsPPMSurveySegmentMaxMemoryGB2);

// This enables performance intervention to run in demo mode. While in demo
// mode, performance intervention will ignore rate throttling and CPU thresholds
// to make it easier to trigger performance intervention for testing purposes.
BASE_DECLARE_FEATURE(kPerformanceInterventionDemoMode);

// This enables performance intervention to use the improved notification
// prompting algorithm to show the intervention more often.
BASE_DECLARE_FEATURE(kPerformanceInterventionNotificationImprovements);

// Minimum time needed before showing another performance intervention.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta, kMinimumTimeBetweenReshow);

// Number of recent samples to be taken into consideration when determining
// performance intervention acceptance rate.
BASE_DECLARE_FEATURE_PARAM(int, kAcceptanceRateWindowSize);

// Upper bounds for showing performance intervention and will be scaled down
// based on the acceptance rate.
BASE_DECLARE_FEATURE_PARAM(int, kScaleMaxTimesPerDay);
BASE_DECLARE_FEATURE_PARAM(int, kScaleMaxTimesPerWeek);

// The amount of time a user needs to wait before being shown performance
// intervention with a 0% acceptance rate
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta, kNoAcceptanceBackOff);

// This enables performance intervention to use the updated notification
// strings.
BASE_DECLARE_FEATURE(kPerformanceInterventionNotificationStringImprovements);

// The version string that is used on the performance detection dialog.
BASE_DECLARE_FEATURE_PARAM(int, kNotificationStringVersion);

#endif

BASE_DECLARE_FEATURE(kPMProcessPriorityPolicy);

extern const base::FeatureParam<bool> kInheritParentPriority;

extern const base::FeatureParam<bool> kRenderedOutOfViewIsNotVisible;

extern const base::FeatureParam<bool> kNonSpareRendererHighInitialPriority;

BASE_DECLARE_FEATURE(kPMLoadingPageVoter);

// Policy that evicts the BFCache of pages that become non visible or the
// BFCache of all pages when the system is under memory pressure.
BASE_DECLARE_FEATURE(kBFCachePerformanceManagerPolicy);

// Whether tabs are discarded under high memory pressure.
BASE_DECLARE_FEATURE(kUrgentPageDiscarding);

// This represents the duration that CPU must be over the threshold before
// logging the delayed metrics.
extern const base::FeatureParam<base::TimeDelta> kDelayBeforeLogging;

// If Chrome CPU utilization is over the specified percent then we will log it.
extern const base::FeatureParam<int> kThresholdChromeCPUPercent;

// When enabled, the freezing policy measures background CPU usage.
BASE_DECLARE_FEATURE(kCPUMeasurementInFreezingPolicy);

// When enabled, the freezing policy measures memory usage. This exists to
// quantify the overhead of memory measurement in a holdback study.
BASE_DECLARE_FEATURE(kMemoryMeasurementInFreezingPolicy);

// When enabled, frozen browsing instances in which an origin's private memory
// footprint grows above a threshold are discarded. Depends on
// `kMemoryMeasurementInFreezingPolicy`.
BASE_DECLARE_FEATURE(kDiscardFrozenBrowsingInstancesWithGrowingPMF);

// Per-origin private memory footprint increase above which a frozen browsing
// instance is discarded.
BASE_DECLARE_FEATURE_PARAM(int, kFreezingMemoryGrowthThresholdToDiscardKb);

// Proportion of background CPU usage for a group of frames/workers that belong
// to the same [browsing instance, origin] that is considered "high".
BASE_DECLARE_FEATURE_PARAM(double, kFreezingHighCPUProportion);

// Time for which a page cannot be frozen after being visible.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta, kFreezingVisibleProtectionTime);

// Time for which a page cannot be frozen after being audible.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta, kFreezingAudioProtectionTime);

// When enabled, browsing instances with high CPU usage in background are frozen
// when Battery Saver is active. Depends on `kCPUMeasurementInFreezingPolicy`.
BASE_DECLARE_FEATURE(kFreezingOnBatterySaver);

// This is the similar to `kFreezingOnBatterySaver`, with some changes to
// facilitate testing:
// - Pretend that Battery Saver is active even if it's not.
// - Pretend that all tabs have high CPU usage in background.
BASE_DECLARE_FEATURE(kFreezingOnBatterySaverForTesting);

// When enabled, the freezing policy won't freeze pages that are opted out of
// tab discarding.
BASE_DECLARE_FEATURE(kFreezingFollowsDiscardOptOut);

// When enabled, the freezing eligibility UKM event may be recorded.
BASE_DECLARE_FEATURE(kRecordFreezingEligibilityUKM);

// When enabled, eligible tabs which are not in the N most recently used are
// frozen. This prevents CPU usage from growing proportionally with the number
// of tabs, and aims to make the browser support "infinite tabs" with good
// performance. A tab is eligible if it doesn't have a `CannotFreezeReason`
// other than `CannotFreezeReason::kRecentlyVisible`. N is configurable with
// `kInfiniteTabsFreezing_NumProtectedTabs`. Tabs frozen by this feature are
// periodically unfrozen, to allow showing notifications, refreshing content,
// maintaining connections... (see `kInfiniteTabsFreezing_UnfreezeInterval` and
// `kInfiniteTabsFreezing_UnfreezeDuration`).
BASE_DECLARE_FEATURE(kInfiniteTabsFreezing);

// Number of most recently visible tabs protected from "infinite tabs" freezing.
BASE_DECLARE_FEATURE_PARAM(int, kInfiniteTabsFreezing_NumProtectedTabs);

// Interval at which tabs frozen to support "infinite tabs" are temporarily
// unfrozen.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta,
                           kInfiniteTabsFreezing_UnfreezeInterval);

// Duration for which tabs frozen to support "infinite tabs" are temporarily
// unfrozen.
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta,
                           kInfiniteTabsFreezing_UnfreezeDuration);

// When enabled, Resource Attribution measurements will include contexts for
// individual origins.
BASE_DECLARE_FEATURE(kResourceAttributionIncludeOrigins);

// When enabled, change the ordering of frame swap in render (crbug/357649043).
BASE_DECLARE_FEATURE(kSeamlessRenderFrameSwap);

// When enabled, visible unimportant frames receives a lesser priority than
// non unimportant frames.
BASE_DECLARE_FEATURE(kUnimportantFramesPriority);

// When enabled, the begin frame rate of visible unimportant frames would be
// reduced to half of normal frame rate.
BASE_DECLARE_FEATURE(kThrottleUnimportantFrameRate);

// When enabled, keep the default search engine render process host alive
// (crbug.com/365958798).
BASE_DECLARE_FEATURE(kKeepDefaultSearchEngineRendererAlive);

}  // namespace performance_manager::features

#endif  // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_FEATURES_H_