File: features.cc

package info (click to toggle)
chromium 138.0.7204.157-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,864 kB
  • sloc: cpp: 34,936,859; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,967; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (291 lines) | stat: -rw-r--r-- 11,641 bytes parent folder | download | duplicates (3)
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
// 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.

#include "components/performance_manager/public/features.h"

#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)
BASE_FEATURE(kBackgroundTabLoadingFromPerformanceManager,
             "BackgroundTabLoadingFromPerformanceManager",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE_PARAM(size_t,
                   kBackgroundTabLoadingMinSiteEngagement,
                   &kBackgroundTabLoadingFromPerformanceManager,
                   "min_site_engagement",
                   0);

BASE_FEATURE_PARAM(bool,
                   kBackgroundTabLoadingRestoreMainFrameState,
                   &kBackgroundTabLoadingFromPerformanceManager,
                   "restore_main_frame_state",
                   true);

BASE_FEATURE(kPerformanceControlsPPMSurvey,
             "PerformanceControlsPPMSurvey",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE_PARAM(base::TimeDelta,
                   kPerformanceControlsPPMSurveyMinDelay,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_min_delay",
                   base::Minutes(2));

BASE_FEATURE_PARAM(base::TimeDelta,
                   kPerformanceControlsPPMSurveyMaxDelay,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_max_delay",
                   base::Minutes(60));

BASE_FEATURE_PARAM(bool,
                   kPerformanceControlsPPMSurveyUniformSampleValue,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_uniform_sample",
                   true);

// Depending on platform, clients will be split into 1-3 segments based on the
// amount of physical RAM they have. "ppm_survey_segment_name1" through
// "ppm_survey_segment_name3" give the names of the segments, which will be
// included in the PPM survey string data.
//
// "ppm_survey_segment_max_memory_gb1" and "ppm_survey_segment_max_memory_gb2"
// define the upper bounds of segments 1 and 2. The lower bound of segment 1 is
// always 0 GB; if "ppm_survey_segment_max_memory_gb1" is 0, it has no upper
// bound so it's the only defined segment ("ppm_survey_segment_name2", etc, are
// ignored). Otherwise "ppm_survey_segment_max_memory_gb1" is the upper bound
// (inclusive) of segment 1 and the lower bound (exclusive) of segment 2.
//
// Likewise, if "ppm_survey_segment_max_memory_gb2" is 0, segment 2 has no upper
// bound so this platform has only 2 defined segments. Otherwise
// "ppm_survey_segment_max_memory_gb2" is the upper bound (inclusive) of segment
// 2 and the lower bound (exclusive) of segment 3. Segment 3 is the last segment
// that can be defined so it never has an upper bound.
//
// Comparing the client's physical RAM to the boundaries of each defined segment
// determines which one the client falls into. The default parameters give the
// trivial case with only 1 segment containing all users.
//
// If the name parameter of the client's segment is an empty string, that
// segment has already received enough survey responses so clients in that
// segment should not see the survey.
BASE_FEATURE_PARAM(std::string,
                   kPerformanceControlsPPMSurveySegmentName1,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_segment_name1",
                   // All clients fall into this segment when
                   // "ppm_survey_segment_max_memory_gb1" is 0.
                   "Default");
BASE_FEATURE_PARAM(std::string,
                   kPerformanceControlsPPMSurveySegmentName2,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_segment_name2",
                   // Default is "Invalid" since this should never be used when
                   // "ppm_survey_segment_max_memory_gb1" is 0.
                   "Invalid1");
BASE_FEATURE_PARAM(std::string,
                   kPerformanceControlsPPMSurveySegmentName3,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_segment_name3",
                   // Default is "Invalid" since this should never be used when
                   // "ppm_survey_segment_max_memory_gb1" is 0.
                   "Invalid2");
BASE_FEATURE_PARAM(size_t,
                   kPerformanceControlsPPMSurveySegmentMaxMemoryGB1,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_segment_max_memory_gb1",
                   0);
BASE_FEATURE_PARAM(size_t,
                   kPerformanceControlsPPMSurveySegmentMaxMemoryGB2,
                   &kPerformanceControlsPPMSurvey,
                   "ppm_survey_segment_max_memory_gb2",
                   0);

BASE_FEATURE(kPerformanceInterventionDemoMode,
             "PerformanceInterventionDemoMode",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kPerformanceInterventionNotificationImprovements,
             "PerformanceInterventionNotificationImprovements",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE_PARAM(base::TimeDelta,
                   kMinimumTimeBetweenReshow,
                   &kPerformanceInterventionNotificationImprovements,
                   "minimum_time_reshow",
                   base::Hours(1));

BASE_FEATURE_PARAM(int,
                   kAcceptanceRateWindowSize,
                   &kPerformanceInterventionNotificationImprovements,
                   "window_size",
                   10);

BASE_FEATURE_PARAM(int,
                   kScaleMaxTimesPerDay,
                   &kPerformanceInterventionNotificationImprovements,
                   "scale_max_times_per_day",
                   5);

BASE_FEATURE_PARAM(int,
                   kScaleMaxTimesPerWeek,
                   &kPerformanceInterventionNotificationImprovements,
                   "scale_max_times_per_week",
                   25);

BASE_FEATURE_PARAM(base::TimeDelta,
                   kNoAcceptanceBackOff,
                   &kPerformanceInterventionNotificationImprovements,
                   "no_acceptance_back_off",
                   base::Days(30));

BASE_FEATURE(kPerformanceInterventionNotificationStringImprovements,
             "PerformanceInterventionNotificationStringImprovements",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE_PARAM(int,
                   kNotificationStringVersion,
                   &kPerformanceInterventionNotificationStringImprovements,
                   "string_version",
                   1);

#if BUILDFLAG(IS_CHROMEOS)
BASE_FEATURE(kUnthrottledTabProcessReporting,
             "UnthrottledTabProcessReporting",
             base::FEATURE_ENABLED_BY_DEFAULT);
#endif  // BUILDFLAG(IS_CHROMEOS)

#endif

BASE_FEATURE(kPMProcessPriorityPolicy,
             "PMProcessPriorityPolicy",
             base::FEATURE_ENABLED_BY_DEFAULT);

const base::FeatureParam<bool> kInheritParentPriority{
    &kPMProcessPriorityPolicy, "inherit_parent_priority", true};

const base::FeatureParam<bool> kRenderedOutOfViewIsNotVisible{
    &kPMProcessPriorityPolicy, "rendered_out_of_view_is_not_visible", false};

const base::FeatureParam<bool> kNonSpareRendererHighInitialPriority{
    &kPMProcessPriorityPolicy, "non_spare_renderer_high_initial_priority",
    false};

BASE_FEATURE(kPMLoadingPageVoter,
             "PMLoadingPageVoter",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kBFCachePerformanceManagerPolicy,
             "BFCachePerformanceManagerPolicy",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kUrgentPageDiscarding,
             "UrgentPageDiscarding",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kCPUMeasurementInFreezingPolicy,
             "CPUMeasurementInFreezingPolicy",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kMemoryMeasurementInFreezingPolicy,
             "MemoryMeasurementInFreezingPolicy",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kDiscardFrozenBrowsingInstancesWithGrowingPMF,
             "DiscardFrozenBrowsingInstancesWithGrowingPMF",
             base::FEATURE_ENABLED_BY_DEFAULT);

// Note: These params are associated with `kCPUMeasurementInFreezingPolicy`
// instead of `kFreezingOnBatterySaver` or
// `kDiscardFrozenBrowsingInstancesWithGrowingPMF`, to allow retrieving the
// value without activating these two features.
BASE_FEATURE_PARAM(int,
                   kFreezingMemoryGrowthThresholdToDiscardKb,
                   &kCPUMeasurementInFreezingPolicy,
                   "freezing_memory_growth_threshold_to_discard_kb",
                   /* 100 MB */ 100 * 1024);

BASE_FEATURE_PARAM(double,
                   kFreezingHighCPUProportion,
                   &kCPUMeasurementInFreezingPolicy,
                   "freezing_high_cpu_proportion",
                   0.05);
BASE_FEATURE_PARAM(base::TimeDelta,
                   kFreezingVisibleProtectionTime,
                   &kCPUMeasurementInFreezingPolicy,
                   "freezing_visible_protection_time",
                   base::Minutes(5));
BASE_FEATURE_PARAM(base::TimeDelta,
                   kFreezingAudioProtectionTime,
                   &kCPUMeasurementInFreezingPolicy,
                   "freezing_audio_protection_time",
                   base::Minutes(5));

BASE_FEATURE(kFreezingOnBatterySaver,
             "FreezingOnBatterySaver",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kFreezingOnBatterySaverForTesting,
             "FreezingOnBatterySaverForTesting",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kFreezingFollowsDiscardOptOut,
             "FreezingFollowsDiscardOptOut",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kRecordFreezingEligibilityUKM,
             "RecordFreezingEligibilityUKM",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kInfiniteTabsFreezing,
             "InfiniteTabsFreezing",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE_PARAM(int,
                   kInfiniteTabsFreezing_NumProtectedTabs,
                   &kInfiniteTabsFreezing,
                   "num_protected_tabs",
                   5);

BASE_FEATURE_PARAM(base::TimeDelta,
                   kInfiniteTabsFreezing_UnfreezeInterval,
                   &kInfiniteTabsFreezing,
                   "unfreeze_interval",
                   base::Minutes(1));

BASE_FEATURE_PARAM(base::TimeDelta,
                   kInfiniteTabsFreezing_UnfreezeDuration,
                   &kInfiniteTabsFreezing,
                   "unfreeze_duration",
                   base::Seconds(5));

BASE_FEATURE(kResourceAttributionIncludeOrigins,
             "ResourceAttributionIncludeOrigins",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kSeamlessRenderFrameSwap,
             "SeamlessRenderFrameSwap",
             base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kUnimportantFramesPriority,
             "UnimportantFramesPriority",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kThrottleUnimportantFrameRate,
             "ThrottleUnimportantFrameRate",
             base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kKeepDefaultSearchEngineRendererAlive,
             "KeepDefaultSearchEngineRendererAlive",
             base::FEATURE_DISABLED_BY_DEFAULT);

}  // namespace performance_manager::features