blob: d16f165d40553aaa61329542ea11e2e015df32cd [file] [log] [blame]
Matt Falkenhagen5cc652792018-06-21 10:34:331// Copyright 2018 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.
4
5#include "third_party/blink/public/common/features.h"
6
Aran Gilman5e9672bed2019-08-02 19:07:497#include "base/feature_list.h"
Scott Haseley8eefdcd2018-08-22 16:50:198#include "build/build_config.h"
Hiroki Nakagawa893ee502019-02-04 06:49:539#include "services/network/public/cpp/features.h"
Aran Gilman5e9672bed2019-08-02 19:07:4910#include "third_party/blink/public/common/forcedark/forcedark_switches.h"
Scott Haseley8eefdcd2018-08-22 16:50:1911
Matt Falkenhagen5cc652792018-06-21 10:34:3312namespace blink {
13namespace features {
14
Yao Xiao2c1171a2019-04-01 23:44:3215// Enable intervention for download that was initiated from or occurred in an ad
16// frame without user activation.
17const base::Feature kBlockingDownloadsInAdFrameWithoutUserActivation{
18 "BlockingDownloadsInAdFrameWithoutUserActivation",
Yao Xiao3f9e4272019-05-23 15:22:4619 base::FEATURE_ENABLED_BY_DEFAULT};
Yao Xiao2c1171a2019-04-01 23:44:3220
Stephen Chenney8c442a582020-06-25 18:18:3921// Enable defer commits to avoid flash of unstyled content, for same origin
22// navigation only.
Stephen Chenney1bcaec832019-10-10 18:31:0123const base::Feature kPaintHolding{"PaintHolding",
24 base::FEATURE_ENABLED_BY_DEFAULT};
Stephen Chenneyde6e5c82019-01-21 01:56:0425
Stephen Chenney8c442a582020-06-25 18:18:3926// Enable defer commits to avoid flash of unstyled content, for all navigation.
27const base::Feature kPaintHoldingCrossOrigin{"PaintHoldingCrossOrigin",
28 base::FEATURE_DISABLED_BY_DEFAULT};
29
Matt Falkenhagenc25fea42018-07-17 07:13:5230// Enable eagerly setting up a CacheStorage interface pointer and
31// passing it to service workers on startup as an optimization.
Ben Kelly2c1cdd62020-05-04 22:05:0432// TODO(crbug/1077916): Re-enable once the issue with COOP/COEP is fixed.
Matt Falkenhagenc25fea42018-07-17 07:13:5233const base::Feature kEagerCacheStorageSetupForServiceWorkers{
34 "EagerCacheStorageSetupForServiceWorkers",
Ben Kelly2c1cdd62020-05-04 22:05:0435 base::FEATURE_DISABLED_BY_DEFAULT};
Matt Falkenhagenc25fea42018-07-17 07:13:5236
Peter Kvitek197eaf72018-12-04 19:14:5637// Controls script streaming.
38const base::Feature kScriptStreaming{"ScriptStreaming",
39 base::FEATURE_ENABLED_BY_DEFAULT};
40
Leszek Swirskif75c1912019-05-29 10:08:2541// Allow streaming small (<30kB) scripts.
42const base::Feature kSmallScriptStreaming{"SmallScriptStreaming",
43 base::FEATURE_DISABLED_BY_DEFAULT};
44
Keishi Hattori9e106922019-04-15 09:06:0345// Enables user level memory pressure signal generation on Android.
46const base::Feature kUserLevelMemoryPressureSignal{
47 "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT};
48
Aditya Keerthi6a933902019-03-14 21:09:2749// Perform memory purges after freezing only if all pages are frozen.
50const base::Feature kFreezePurgeMemoryAllPagesFrozen{
51 "FreezePurgeMemoryAllPagesFrozen", base::FEATURE_DISABLED_BY_DEFAULT};
52
John Delaneyac24e572019-04-30 19:47:0253// Freezes the user-agent as part of https://github.com/WICG/ua-client-hints.
54const base::Feature kFreezeUserAgent{"FreezeUserAgent",
55 base::FEATURE_DISABLED_BY_DEFAULT};
56
Sam Fortiner3f07c632020-05-07 22:40:1857// When enabled, use the maximum possible bounds in compositing overlap testing
58// for fixed position elements.
Sam Fortiner740db832020-06-23 02:13:0559const base::Feature kMaxOverlapBoundsForFixed{"MaxOverlapBoundsForFixed",
60 base::FEATURE_ENABLED_BY_DEFAULT};
Sam Fortiner3f07c632020-05-07 22:40:1861
Vladimir Levin43758ecc2019-05-09 18:04:0362// Enable Display Locking JavaScript APIs.
63const base::Feature kDisplayLocking{"DisplayLocking",
64 base::FEATURE_DISABLED_BY_DEFAULT};
65
Sam Sebree2dd45c4f2019-12-13 05:51:4966const base::Feature kJSONModules{"JSONModules",
67 base::FEATURE_DISABLED_BY_DEFAULT};
68
Mason Freedd71a9642020-06-03 01:35:0769const base::Feature kForceSynchronousHTMLParsing{
70 "ForceSynchronousHTMLParsing", base::FEATURE_DISABLED_BY_DEFAULT};
71
Camillo Brunia19d7fc2020-03-17 07:53:3572// Enables top-level await in modules.
73const base::Feature kTopLevelAwait{"TopLevelAwait",
74 base::FEATURE_DISABLED_BY_DEFAULT};
75
Ian Kilpatricke68ef11a2018-07-04 03:52:1076// Enable LayoutNG.
Emil A Eklund69eeb562019-07-03 01:38:3077const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_ENABLED_BY_DEFAULT};
Ian Kilpatricke68ef11a2018-07-04 03:52:1078
Kent Tamura4187dc92020-06-18 04:39:3579// Enable LayoutNGRuby by default. This feature is for a kill switch.
80const base::Feature kLayoutNGRuby{"LayoutNGRuby",
81 base::FEATURE_ENABLED_BY_DEFAULT};
82
Koji Ishii14c52bd2020-06-11 17:00:5983const base::Feature kFragmentItem{"FragmentItem",
84 base::FEATURE_DISABLED_BY_DEFAULT};
85
Makoto Shimazu172eec02018-11-29 06:21:4486const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
Carlos IL9970a942020-02-14 01:16:5087 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:4488
Tarun Bansal422f9012019-01-23 16:55:5889// Used to control the collection of anchor element metrics (crbug.com/856683).
90// If kNavigationPredictor is enabled, then metrics of anchor elements
91// in the first viewport after the page load and the metrics of the clicked
92// anchor element will be extracted and recorded. Additionally, navigation
93// predictor may preconnect/prefetch to resources/origins to make the
94// future navigations faster.
Sofiya Semenovae4e076152019-07-29 20:10:2795const base::Feature kNavigationPredictor {
96 "NavigationPredictor",
97#if defined(OS_ANDROID)
98 base::FEATURE_ENABLED_BY_DEFAULT
99#else
100 base::FEATURE_DISABLED_BY_DEFAULT
101#endif
102};
Tarun Bansal422f9012019-01-23 16:55:58103
Yu Hanae4c3b72020-07-08 21:48:58104const base::Feature kParentNodeReplaceChildren {
105 "ParentNodeReplaceChildren", base::FEATURE_ENABLED_BY_DEFAULT};
106
Hiroki Nakagawa61ee0042019-01-22 06:30:26107// Enable browser-initiated dedicated worker script loading
108// (PlzDedicatedWorker). https://crbug.com/906991
109const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
110 base::FEATURE_DISABLED_BY_DEFAULT};
111
Minggang Wang7c57ca142020-07-01 04:49:44112// Enable to load top-level script pre-requested by the browser process for
113// dedicated worker (PlzDedicatedWorker) and shared worker using
114// WorkerMainScriptLoadParameters.
115const base::Feature kLoadMainScriptForPlzDedicatedWorkerByParams{
116 "LoadMainScriptForPlzDedicatedWorkerByParams",
117 base::FEATURE_ENABLED_BY_DEFAULT};
118
Daniel Murphy95792ef2018-10-04 01:29:55119// Enable Portals. https://crbug.com/865123.
Jeremy Romanf369a9d62020-06-24 19:59:54120// For the current origin trial (https://crbug.com/1040212), this is enabled on
121// Android only.
122const base::Feature kPortals {
123 "Portals",
124#if defined(OS_ANDROID)
125 base::FEATURE_ENABLED_BY_DEFAULT
126#else
127 base::FEATURE_DISABLED_BY_DEFAULT
128#endif
129};
Daniel Murphy95792ef2018-10-04 01:29:55130
Jeremy Roman20366e42019-10-22 17:48:08131// When kPortals is enabled, allow portals to load content that is third-party
132// (cross-origin) to the hosting page. Otherwise has no effect.
133//
Jeremy Roman20366e42019-10-22 17:48:08134// https://crbug.com/1013389
135const base::Feature kPortalsCrossOrigin{"PortalsCrossOrigin",
Jeremy Romanf369a9d62020-06-24 19:59:54136 base::FEATURE_DISABLED_BY_DEFAULT};
Jeremy Roman20366e42019-10-22 17:48:08137
Tarun Bansal8df12b52019-02-15 05:46:30138// Enable limiting previews loading hints to specific resource types.
139const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
140 "PreviewsResourceLoadingHintsSpecificResourceTypes",
141 base::FEATURE_DISABLED_BY_DEFAULT};
142
Aditya Keerthie84331b32019-03-20 15:25:52143// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
144// the "PurgeAndSuspend" experiment.
145//
146// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
147// reasons. Consider enabling by default if experiment results are positive.
148// https://crbug.com/926186
149const base::Feature kPurgeRendererMemoryWhenBackgrounded {
150 "PurgeRendererMemoryWhenBackgrounded",
151#if defined(OS_MACOSX) || defined(OS_ANDROID)
152 base::FEATURE_DISABLED_BY_DEFAULT
153#else
154 base::FEATURE_ENABLED_BY_DEFAULT
155#endif
156};
157
David Bokan911bded2018-11-27 23:23:32158// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44159// TODO(bokan): Temporarily disabled on desktop platforms to address issues
160// with non-overlay scrollbars. https://crbug.com/948059.
161const base::Feature kImplicitRootScroller {
162 "ImplicitRootScroller",
163#if defined(OS_ANDROID)
164 base::FEATURE_ENABLED_BY_DEFAULT
165#else
166 base::FEATURE_DISABLED_BY_DEFAULT
167#endif
168};
David Bokan911bded2018-11-27 23:23:32169
Cathie Cheneac70602019-10-10 02:55:29170// Enable CSSOM View Scroll Coordinates. https://crbug.com/721759.
171const base::Feature kCSSOMViewScrollCoordinates{
172 "CSSOMViewScrollCoordinates", base::FEATURE_DISABLED_BY_DEFAULT};
173
Darwin Huangf588cc8e2019-12-13 22:24:56174// Enables Raw Clipboard. https://crbug.com/897289.
175const base::Feature kRawClipboard{"RawClipboard",
176 base::FEATURE_DISABLED_BY_DEFAULT};
177
Makoto Shimazu172eec02018-11-29 06:21:44178// Enables usage of getDisplayMedia() that allows capture of web content, see
179// https://crbug.com/865060.
180const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
181 base::FEATURE_ENABLED_BY_DEFAULT};
182
183// Changes the default RTCPeerConnection constructor behavior to use Unified
184// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
185// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
186// argument).
187const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56188 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44189
Johannes Kronad5a4532019-01-09 11:17:46190// Determines if the SDP attrbute extmap-allow-mixed should be offered by
191// default or not. The default value can be overridden by passing
192// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
193// constructor.
194const base::Feature kRTCOfferExtmapAllowMixed{
195 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
196
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00197// Prevents workers from sending IsolateInBackgroundNotification to V8
198// and thus instructs V8 to favor performance over memory on workers.
199const base::Feature kV8OptimizeWorkersForPerformance{
Ulan Degenbaev7acd73ea2020-04-07 16:02:33200 "V8OptimizeWorkersForPerformance", base::FEATURE_ENABLED_BY_DEFAULT};
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00201
Antonio Gomesb4718572019-09-11 02:55:48202// Enables negotiation of experimental multiplex codec in SDP.
203const base::Feature kWebRtcMultiplexCodec{"WebRTC-MultiplexCodec",
204 base::FEATURE_DISABLED_BY_DEFAULT};
205
206// Causes WebRTC to replace host ICE candidate IP addresses with generated
207// names ending in ".local" and resolve them using mDNS.
208// http://crbug.com/878465
209const base::Feature kWebRtcHideLocalIpsWithMdns{
210 "WebRtcHideLocalIpsWithMdns", base::FEATURE_ENABLED_BY_DEFAULT};
211
OlivierLi95a0f6a52020-06-18 15:40:08212// When enabled, wake ups from throttleable TaskQueues are limited to 1 per
213// minute in a page that has been backgrounded for 5 minutes.
214//
215// Intensive wake up throttling is enforced in addition to other throttling
216// mechanisms:
217// - 1 wake up per second in a background page or hidden cross-origin frame
218// - 1% CPU time in a page that has been backgrounded for 10 seconds
219//
220// Feature tracking bug: https://crbug.com/1075553
221//
222// Note that the base::Feature should not be read from;
223// rather the provided accessors should be used, which also take into account
224// the managed policy override of the feature.
225const base::Feature kIntensiveWakeUpThrottling{
226 "IntensiveWakeUpThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
227
Francois Doray6cff4e02020-07-01 01:12:58228// Name of the parameter that controls the grace period during which there is no
229// intensive wake up throttling after a page is hidden. Defined here to allow
230// access from about_flags.cc. The FeatureParam is defined in
231// third_party/blink/renderer/platform/scheduler/common/features.cc.
232const char kIntensiveWakeUpThrottling_GracePeriodSeconds_Name[] =
233 "grace_period_seconds";
234
Antonio Gomesf3bcd512019-09-03 21:27:17235#if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
236// Run-time feature for the |rtc_use_h264| encoder/decoder.
237const base::Feature kWebRtcH264WithOpenH264FFmpeg{
238 "WebRTC-H264WithOpenH264FFmpeg", base::FEATURE_ENABLED_BY_DEFAULT};
239#endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
240
Makoto Shimazua8b3d742019-04-05 06:55:51241// Experiment of the delay from navigation to starting an update of a service
242// worker's script.
243const base::Feature kServiceWorkerUpdateDelay{
244 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
245
Scott Haseley8eefdcd2018-08-22 16:50:19246// Freeze scheduler task queues in background after allowed grace time.
247// "stop" is a legacy name.
248const base::Feature kStopInBackground {
249 "stop-in-background",
250#if defined(OS_ANDROID)
251 base::FEATURE_ENABLED_BY_DEFAULT
252#else
253 base::FEATURE_DISABLED_BY_DEFAULT
254#endif
255};
256
Takashi Sakamotoc19fc2b2019-04-10 06:30:52257// Freeze scheduler task queues in background on network idle.
258// This feature only works if stop-in-background is enabled.
259const base::Feature kFreezeBackgroundTabOnNetworkIdle{
260 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
261
Shubhie Panicker60bd4b02018-09-26 00:02:15262// Freeze non-timer task queues in background, after allowed grace time.
263// "stop" is a legacy name.
Dave Tapuska9140c552019-05-30 16:18:56264const base::Feature kStopNonTimersInBackground{
265 "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT};
Scott Haseley7757f6c2018-08-03 14:33:23266
Brandon Maslenda12cf82019-08-23 20:54:18267// Enable the Storage Access API. https://crbug.com/989663.
268const base::Feature kStorageAccessAPI{"StorageAccessAPI",
269 base::FEATURE_DISABLED_BY_DEFAULT};
270
David Bokane9370c22019-02-14 15:19:58271// Enable text snippets in URL fragments. https://crbug.com/919204.
272const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
Nick Burris62f8d5f02020-01-16 22:54:51273 base::FEATURE_ENABLED_BY_DEFAULT};
David Bokane9370c22019-02-14 15:19:58274
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42275// Writable files and native file system access. https://crbug.com/853326
276const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrink4cc3ec22019-09-04 16:28:20277 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44278
Jay Harris583f48922019-05-06 05:55:24279// File handling integration. https://crbug.com/829689
280const base::Feature kFileHandlingAPI{"FileHandlingAPI",
281 base::FEATURE_DISABLED_BY_DEFAULT};
282
kdillon66bf5b522019-01-02 22:08:30283// Allows for synchronous XHR requests during page dismissal
Katie Dillon8b357312019-09-19 13:23:23284const base::Feature kAllowSyncXHRInPageDismissal{
285 "AllowSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30286
Olivier Yiptongb60d2c42020-01-10 22:47:15287// Font enumeration and table access. https://crbug.com/535764 and
288// https://crbug.com/982054.
289const base::Feature kFontAccess{"FontAccess",
290 base::FEATURE_DISABLED_BY_DEFAULT};
291
Mason Freed6f146312020-06-27 05:12:55292// Allows Web Components v0 to be re-enabled.
293const base::Feature kWebComponentsV0{"WebComponentsV0",
294 base::FEATURE_DISABLED_BY_DEFAULT};
295
Dominic Farolino780df942019-09-04 06:49:44296// Prefetch request properties are updated to be privacy-preserving. See
297// crbug.com/988956.
298const base::Feature kPrefetchPrivacyChanges{"PrefetchPrivacyChanges",
299 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino693fd72d2019-08-05 11:09:44300
Carlos ILd3be52b2018-10-08 17:57:18301const char kMixedContentAutoupgradeModeParamName[] = "mode";
Carlos IL9970a942020-02-14 01:16:50302const char kMixedContentAutoupgradeModeAllPassive[] = "all-passive";
Carlos ILd3be52b2018-10-08 17:57:18303
Sasha McIntoshe889f9f2019-09-03 21:01:57304// Decodes jpeg 4:2:0 formatted images to YUV instead of RGBX and stores in this
305// format in the image decode cache. See crbug.com/919627 for details on the
306// feature.
Sasha McIntosh633b6312020-06-12 19:45:19307const base::Feature kDecodeJpeg420ImagesToYUV{
308 "DecodeJpeg420ImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
Sasha McIntoshe889f9f2019-09-03 21:01:57309
Madeleine Barowsky45be21a42018-12-07 18:39:30310// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
311// in the image decode cache. See crbug.com/900264 for details on the feature.
312const base::Feature kDecodeLossyWebPImagesToYUV{
Sasha McIntoshf670a6b2020-01-09 18:27:09313 "DecodeLossyWebPImagesToYUV", base::FEATURE_ENABLED_BY_DEFAULT};
Madeleine Barowsky45be21a42018-12-07 18:39:30314
Takashi Toyoshimaa91506d2019-03-28 05:44:42315// Enables cache-aware WebFonts loading. See https://crbug.com/570205.
316// The feature is disabled on Android for WebView API issue discussed at
317// https://crbug.com/942440.
318const base::Feature kWebFontsCacheAwareTimeoutAdaption {
319 "WebFontsCacheAwareTimeoutAdaption",
320#if defined(OS_ANDROID)
321 base::FEATURE_DISABLED_BY_DEFAULT
322#else
323 base::FEATURE_ENABLED_BY_DEFAULT
324#endif
325};
326
Ehsan Karamadbe95d122019-05-10 17:59:06327// Enabled to block programmatic focus in subframes when not triggered by user
328// activation (see htpps://crbug.com/954349).
329const base::Feature kBlockingFocusWithoutUserActivation{
330 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
331
Hongchan Choi370d3af2019-05-20 20:56:58332const base::Feature kAudioWorkletRealtimeThread{
333 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
334
Ryan Sturm139c3ac2019-07-12 18:52:53335// A feature to reduce the set of resources fetched by No-State Prefetch.
Robert Ogden2bb6a2522020-06-05 00:28:10336const base::Feature kLightweightNoStatePrefetch {
Ryan Sturmf223cb02019-10-04 18:02:00337 "LightweightNoStatePrefetch",
338#if defined(OS_ANDROID)
339 base::FEATURE_ENABLED_BY_DEFAULT
340#else
341 base::FEATURE_DISABLED_BY_DEFAULT
342#endif
343};
Ryan Sturm139c3ac2019-07-12 18:52:53344
Aran Gilman5e9672bed2019-08-02 19:07:49345// Automatically convert light-themed pages to use a Blink-generated dark theme
346const base::Feature kForceWebContentsDarkMode{
347 "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT};
348
Michael Crouseb7acd772020-02-20 02:56:26349// A feature to enable using the smallest image specified within image srcset
350// for users with Save Data enabled.
351const base::Feature kSaveDataImgSrcset{"SaveDataImgSrcset",
352 base::FEATURE_DISABLED_BY_DEFAULT};
353
Aran Gilman5e9672bed2019-08-02 19:07:49354// Which algorithm should be used for color inversion?
355const base::FeatureParam<ForceDarkInversionMethod>::Option
356 forcedark_inversion_method_options[] = {
357 {ForceDarkInversionMethod::kUseBlinkSettings,
358 "use_blink_settings_for_method"},
359 {ForceDarkInversionMethod::kHslBased, "hsl_based"},
Aran Gilman8b3ca41c2019-08-12 18:59:04360 {ForceDarkInversionMethod::kCielabBased, "cielab_based"},
361 {ForceDarkInversionMethod::kRgbBased, "rgb_based"}};
Aran Gilman5e9672bed2019-08-02 19:07:49362
363const base::FeatureParam<ForceDarkInversionMethod>
364 kForceDarkInversionMethodParam{&kForceWebContentsDarkMode,
365 "inversion_method",
366 ForceDarkInversionMethod::kUseBlinkSettings,
367 &forcedark_inversion_method_options};
368
369// Should images be inverted?
370const base::FeatureParam<ForceDarkImageBehavior>::Option
371 forcedark_image_behavior_options[] = {
372 {ForceDarkImageBehavior::kUseBlinkSettings,
373 "use_blink_settings_for_images"},
374 {ForceDarkImageBehavior::kInvertNone, "none"},
375 {ForceDarkImageBehavior::kInvertSelectively, "selective"}};
376
377const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{
378 &kForceWebContentsDarkMode, "image_behavior",
379 ForceDarkImageBehavior::kUseBlinkSettings,
380 &forcedark_image_behavior_options};
381
382// Do not invert text lighter than this.
383// Range: 0 (do not invert any text) to 256 (invert all text)
384// Can also set to -1 to let Blink's internal settings control the value
385const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{
386 &kForceWebContentsDarkMode, "text_lightness_threshold", -1};
387
388// Do not invert backgrounds darker than this.
389// Range: 0 (invert all backgrounds) to 256 (invert no backgrounds)
390// Can also set to -1 to let Blink's internal settings control the value
391const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{
392 &kForceWebContentsDarkMode, "background_lightness_threshold", -1};
393
Sergey Silkinc33244f2020-01-31 17:21:30394// Instructs WebRTC to honor the Min/Max Video Encode Accelerator dimensions.
Miguel Casas-Sanchezb6128392020-02-18 15:45:39395const base::Feature kWebRtcUseMinMaxVEADimensions {
396 "WebRtcUseMinMaxVEADimensions",
397 // TODO(crbug.com/1008491): enable other platforms.
398#if defined(OS_CHROMEOS)
399 base::FEATURE_ENABLED_BY_DEFAULT
400#else
401 base::FEATURE_DISABLED_BY_DEFAULT
402#endif
403};
Sergey Silkinc33244f2020-01-31 17:21:30404
Michael Lippautze670df9f2019-07-09 11:39:49405// Blink garbage collection.
406// Enables compaction of backing stores on Blink's heap.
407const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction",
408 base::FEATURE_ENABLED_BY_DEFAULT};
409// Enables concurrently marking Blink's heap.
410const base::Feature kBlinkHeapConcurrentMarking{
Omer Katz1757893c2020-02-17 12:09:19411 "BlinkHeapConcurrentMarking", base::FEATURE_ENABLED_BY_DEFAULT};
Anton Bikineev9b7b3722019-07-09 13:48:39412// Enables concurrently sweeping Blink's heap.
413const base::Feature kBlinkHeapConcurrentSweeping{
Anton Bikineev204cc752019-08-07 00:26:37414 "BlinkHeapConcurrentSweeping", base::FEATURE_ENABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49415// Enables incrementally marking Blink's heap.
416const base::Feature kBlinkHeapIncrementalMarking{
417 "BlinkHeapIncrementalMarking", base::FEATURE_ENABLED_BY_DEFAULT};
418// Enables a marking stress mode that schedules more garbage collections and
419// also adds additional verification passes.
420const base::Feature kBlinkHeapIncrementalMarkingStress{
421 "BlinkHeapIncrementalMarkingStress", base::FEATURE_DISABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49422
Yoav Weissddfb8d2e2019-07-15 22:34:03423// Enables removing AppCache delays when triggering requests when the HTML was
424// not fetched from AppCache.
425const base::Feature kVerifyHTMLFetchedFromAppCacheBeforeDelay{
426 "VerifyHTMLFetchedFromAppCacheBeforeDelay",
427 base::FEATURE_DISABLED_BY_DEFAULT};
428
Michael Spang8d2303e2019-07-26 01:56:32429// Controls whether we use ThreadPriority::DISPLAY for renderer
430// compositor & IO threads.
431const base::Feature kBlinkCompositorUseDisplayThreadPriority {
432 "BlinkCompositorUseDisplayThreadPriority",
Sunny Sachanandani16944252019-12-04 03:40:49433#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
Michael Spang8d2303e2019-07-26 01:56:32434 base::FEATURE_ENABLED_BY_DEFAULT
435#else
436 base::FEATURE_DISABLED_BY_DEFAULT
437#endif
438};
439
Yuki Shiinoa812f492019-08-23 06:47:46440// Ignores cross origin windows in the named property interceptor of Window.
441// https://crbug.com/538562
442const base::Feature kIgnoreCrossOriginWindowWhenNamedAccessOnWindow{
443 "IgnoreCrossOriginWindowWhenNamedAccessOnWindow",
444 base::FEATURE_DISABLED_BY_DEFAULT};
445
Tarun Bansal38792462019-09-04 16:08:11446// When enabled, loading priority of JavaScript requests is lowered when they
447// are force deferred by the intervention.
448const base::Feature kLowerJavaScriptPriorityWhenForceDeferred{
449 "LowerJavaScriptPriorityWhenForceDeferred",
Tarun Bansal755268fe2019-10-18 18:57:40450 base::FEATURE_DISABLED_BY_DEFAULT};
Tarun Bansal38792462019-09-04 16:08:11451
Tarun Bansalf32aaa22020-02-12 16:16:44452// When enabled, scripts in iframes are not force deferred by the DeferAllScript
453// intervention.
454const base::Feature kDisableForceDeferInChildFrames{
455 "DisableForceDeferInChildFrames", base::FEATURE_DISABLED_BY_DEFAULT};
456
rajendrantd5db55f2019-10-19 01:56:59457// Enables redirecting subresources in the page to better compressed and
458// optimized versions to provide data savings.
459const base::Feature kSubresourceRedirect{"SubresourceRedirect",
460 base::FEATURE_DISABLED_BY_DEFAULT};
461
Stefan Zagerfd18161c2019-10-22 20:44:31462// When 'enabled', all cross-origin iframes will get a compositing layer.
463const base::Feature kCompositeCrossOriginIframes{
464 "CompositeCrossOriginIframes", base::FEATURE_DISABLED_BY_DEFAULT};
Yutaka Hirano0b3c319b2019-10-25 17:19:15465
Chris Harrelson70be13d2020-06-03 21:06:52466// When enabled, enforces new interoperable semantics for 3D transforms.
467// See crbug.com/1008483.
468const base::Feature kTransformInterop{"TransformInterop",
469 base::FEATURE_DISABLED_BY_DEFAULT};
470
Yutaka Hirano0b3c319b2019-10-25 17:19:15471// When enabled, beacons (and friends) have ResourceLoadPriority::kLow,
472// not ResourceLoadPriority::kVeryLow.
473const base::Feature kSetLowPriorityForBeacon{"SetLowPriorityForBeacon",
474 base::FEATURE_DISABLED_BY_DEFAULT};
475
Ben Kelly776f59d2019-11-06 16:25:30476// When enabled allows the header name used in the blink
477// CacheStorageCodeCacheHint runtime feature to be modified. This runtime
478// feature disables generating full code cache for responses stored in
479// cache_storage during a service worker install event. The runtime feature
480// must be enabled via the blink runtime feature mechanism, however.
481const base::Feature kCacheStorageCodeCacheHintHeader{
482 "CacheStorageCodeCacheHintHeader", base::FEATURE_DISABLED_BY_DEFAULT};
483const base::FeatureParam<std::string> kCacheStorageCodeCacheHintHeaderName{
484 &kCacheStorageCodeCacheHintHeader, "name", "x-CacheStorageCodeCacheHint"};
485
Francois Doray563453432019-11-20 15:32:17486// When enabled, the beforeunload handler is dispatched when a frame is frozen.
487// This allows the browser to know whether discarding the frame could result in
488// lost user data, at the cost of extra CPU usage. The feature will be removed
489// once we have determine whether the CPU cost is acceptable.
490const base::Feature kDispatchBeforeUnloadOnFreeze{
491 "DispatchBeforeUnloadOnFreeze", base::FEATURE_ENABLED_BY_DEFAULT};
492
Sunny Sachanandani26463422019-12-05 21:35:40493// Enables the use of GpuMemoryBuffer images for low latency 2d canvas.
494// TODO(khushalsagar): Enable this if we're using SurfaceControl and GMBs allow
495// us to overlay these resources.
496const base::Feature kLowLatencyCanvas2dImageChromium {
497 "LowLatencyCanvas2dImageChromium",
498#if defined(OS_CHROMEOS)
499 base::FEATURE_ENABLED_BY_DEFAULT
500#else
501 base::FEATURE_DISABLED_BY_DEFAULT
502#endif // OS_CHROMEOS
503};
504
505// Enables the use of shared image swap chains for low latency 2d canvas.
506const base::Feature kLowLatencyCanvas2dSwapChain{
Sunny Sachanandanib954dc7c2019-12-12 02:50:51507 "LowLatencyCanvas2dSwapChain", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40508
509// Enables the use of shared image swap chains for low latency webgl canvas.
Sunny Sachanandanib954dc7c2019-12-12 02:50:51510const base::Feature kLowLatencyWebGLSwapChain{"LowLatencyWebGLSwapChain",
511 base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40512
Stephen Whitee17b0232020-04-27 23:48:49513// Enables Dawn-accelerated 2D canvas.
514const base::Feature kDawn2dCanvas{"Dawn2dCanvas",
515 base::FEATURE_DISABLED_BY_DEFAULT};
516
Xiaocheng Hud5197fd2020-02-06 07:26:08517const base::Feature kCSSReducedFontLoadingInvalidations{
Xiaocheng Hu75bafe52020-06-22 22:54:27518 "CSSReducedFontLoadingInvalidations", base::FEATURE_ENABLED_BY_DEFAULT};
Xiaocheng Hue5ff8e12020-06-16 21:47:35519const base::Feature kCSSReducedFontLoadingLayoutInvalidations{
520 "CSSReducedFontLoadingLayoutInvalidations",
521 base::FEATURE_DISABLED_BY_DEFAULT};
Xiaocheng Hud5197fd2020-02-06 07:26:08522
Egor Pasko28ec46952020-02-07 15:17:57523// When enabled, frees up CachedMetadata after consumption by script resources
524// and modules. Needed for the experiment in http://crbug.com/1045052.
525const base::Feature kDiscardCodeCacheAfterFirstUse{
526 "DiscardCodeCacheAfterFirstUse", base::FEATURE_DISABLED_BY_DEFAULT};
527
Yutaka Hiranobf410a42020-02-18 08:08:45528// The kill-switch for the fix for https://crbug.com/1051439.
529// TODO(crbug.com/1053369): Remove this around M84.
530const base::Feature kSuppressContentTypeForBeaconMadeWithArrayBufferView{
531 "SuppressContentTypeForBeaconMadeWithArrayBufferView",
532 base::FEATURE_ENABLED_BY_DEFAULT};
533
Ian Kilpatrickef7f4382020-06-02 12:38:10534const base::Feature kBlockFlowHandlesWebkitLineClamp{
Ian Kilpatrickbdec8902020-06-02 12:46:09535 "BlockFlowHandlesWebkitLineClamp", base::FEATURE_ENABLED_BY_DEFAULT};
Ian Kilpatrickef7f4382020-06-02 12:38:10536
Rune Lillesveen61f49ee2020-03-02 07:53:49537const base::Feature kBlockHTMLParserOnStyleSheets{
538 "BlockHTMLParserOnStyleSheets", base::FEATURE_DISABLED_BY_DEFAULT};
539
Mason Freed0ebaa772020-06-03 16:11:08540// Kill switch for the new <link disabled> behavior.
541// TODO(crbug.com/1087043): Remove this once the feature has
542// landed and no compat issues are reported.
543const base::Feature kLinkDisabledNewSpecBehavior{
544 "LinkDisabledNewSpecBehavior", base::FEATURE_ENABLED_BY_DEFAULT};
545
Xiaocheng Hud2e807d2020-03-04 21:15:21546// Slightly delays rendering if there are fonts being preloaded, so that
547// they don't miss the first paint if they can be loaded fast enough (e.g.,
548// from the disk cache)
549const base::Feature kFontPreloadingDelaysRendering{
550 "FontPreloadingDelaysRendering", base::FEATURE_DISABLED_BY_DEFAULT};
551
552// Set to be over 90th-percentile of HttpCache.AccessToDone.Used on all
553// platforms, and also to allow some time for IPC and scheduling.
554// TODO(xiaochengh): Tune it for the best performance.
555const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{
556 &kFontPreloadingDelaysRendering, "delay-in-ms", 100};
557
David Grogan17b34f4f2020-05-11 19:35:19558const base::Feature kFlexGaps{"FlexGaps", base::FEATURE_DISABLED_BY_DEFAULT};
David Grogan565f8bb2020-05-27 03:07:40559const base::Feature kFlexNG{"FlexNG", base::FEATURE_ENABLED_BY_DEFAULT};
David Grogan5b3cf162020-03-19 21:53:15560
Dominic Farolino0f55a082020-03-24 09:47:55561const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
562 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino7d3d6f12020-06-10 21:59:46563const base::Feature kDelayAsyncScriptExecution{
564 "DelayAsyncScriptExecution", base::FEATURE_DISABLED_BY_DEFAULT};
565const base::FeatureParam<DelayAsyncScriptDelayType>::Option
566 delay_async_script_execution_delay_types[] = {
567 {DelayAsyncScriptDelayType::kFinishedParsing, "finished_parsing"},
568 {DelayAsyncScriptDelayType::kFirstPaintOrFinishedParsing,
569 "first_paint_or_finished_parsing"}};
570const base::FeatureParam<DelayAsyncScriptDelayType>
571 kDelayAsyncScriptExecutionDelayParam{
572 &kDelayAsyncScriptExecution, "delay_type",
573 DelayAsyncScriptDelayType::kFinishedParsing,
574 &delay_async_script_execution_delay_types};
Dominic Farolino0f55a082020-03-24 09:47:55575
Adrienne Walkerb53b4372020-05-06 18:57:18576// The AppCache feature is a kill-switch for the entire AppCache feature,
577// both backend and API. If disabled, then it will turn off the backend and
578// api, regardless of the presence of valid origin trial tokens.
Adrienne Walkere6b51722020-04-01 17:56:38579const base::Feature kAppCache{"AppCache", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkerb53b4372020-05-06 18:57:18580// If AppCacheRequireOriginTrial is enabled, then the AppCache backend in the
581// browser will require origin trial tokens in order to load or store manifests
582// and their contents.
583const base::Feature kAppCacheRequireOriginTrial{
Adrienne Walkerdd9442e02020-06-10 16:23:40584 "AppCacheRequireOriginTrial", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkere6b51722020-04-01 17:56:38585
Wan-Teh Chang75fd5322020-04-08 01:32:18586// Enables the AV1 Image File Format (AVIF).
Wan-Teh Changb9d67a12020-06-26 01:19:13587const base::Feature kAVIF{"AVIF", base::FEATURE_ENABLED_BY_DEFAULT};
Wan-Teh Chang75fd5322020-04-08 01:32:18588
Xiaocheng Hu66795f02020-04-25 00:26:47589// Make all pending 'display: auto' web fonts enter the swap or failure period
Xiaocheng Hu9e2055c2020-04-09 20:35:28590// immediately before reaching the LCP time limit (~2500ms), so that web fonts
591// do not become a source of bad LCP.
592const base::Feature kAlignFontDisplayAutoTimeoutWithLCPGoal{
593 "AlignFontDisplayAutoTimeoutWithLCPGoal",
594 base::FEATURE_DISABLED_BY_DEFAULT};
595
Xiaocheng Hu66795f02020-04-25 00:26:47596// The amount of time allowed for 'display: auto' web fonts to load without
597// intervention, counted from navigation start.
598const base::FeatureParam<int>
599 kAlignFontDisplayAutoTimeoutWithLCPGoalTimeoutParam{
600 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "lcp-limit-in-ms", 2000};
601
602const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>::Option
603 align_font_display_auto_timeout_with_lcp_goal_modes[] = {
604 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
605 "failure"},
606 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, "swap"}};
607const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>
608 kAlignFontDisplayAutoTimeoutWithLCPGoalModeParam{
609 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "intervention-mode",
610 AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
611 &align_font_display_auto_timeout_with_lcp_goal_modes};
Xiaocheng Hu9e2055c2020-04-09 20:35:28612
Ben Kellyd52869b2020-04-20 17:17:43613// Enable throttling of fetch() requests from service workers in the
614// installing state.
615const base::Feature kThrottleInstallingServiceWorker{
616 "ThrottleInstallingServiceWorker", base::FEATURE_DISABLED_BY_DEFAULT};
617const base::FeatureParam<int> kInstallingServiceWorkerOutstandingThrottledLimit{
618 &kThrottleInstallingServiceWorker, "limit", 5};
619
Dave Tapuska95b71c82020-06-08 16:56:11620const base::Feature kInputPredictorTypeChoice{
621 "InputPredictorTypeChoice", base::FEATURE_DISABLED_BY_DEFAULT};
622
623const base::Feature kResamplingInputEvents{"ResamplingInputEvents",
624 base::FEATURE_DISABLED_BY_DEFAULT};
625
Dave Tapuskafea88942020-05-05 18:50:32626const base::Feature kResamplingScrollEvents{"ResamplingScrollEvents",
627 base::FEATURE_ENABLED_BY_DEFAULT};
628
Yoav Weiss200214d52020-05-13 23:58:42629// Enables the device-memory, resource-width, viewport-width and DPR client
630// hints to be sent to third-party origins if the first-party has opted in to
631// receiving client hints, regardless of Feature Policy.
632#if defined(OS_ANDROID)
633const base::Feature kAllowClientHintsToThirdParty{
634 "AllowClientHintsToThirdParty", base::FEATURE_ENABLED_BY_DEFAULT};
635#else
636const base::Feature kAllowClientHintsToThirdParty{
637 "AllowClientHintsToThirdParty", base::FEATURE_DISABLED_BY_DEFAULT};
638#endif
639
Dave Tapuskafea88942020-05-05 18:50:32640const char kScrollPredictorNameLsq[] = "lsq";
641const char kScrollPredictorNameKalman[] = "kalman";
642const char kScrollPredictorNameLinearFirst[] = "linear_first";
643const char kScrollPredictorNameLinearSecond[] = "linear_second";
644const char kScrollPredictorNameLinearResampling[] = "linear_resampling";
645const char kScrollPredictorNameEmpty[] = "empty";
646
647const base::Feature kFilteringScrollPrediction{
648 "FilteringScrollPrediction", base::FEATURE_DISABLED_BY_DEFAULT};
649
650const char kFilterNameEmpty[] = "empty_filter";
651const char kFilterNameOneEuro[] = "one_euro_filter";
652
653const base::Feature kKalmanHeuristics{"KalmanHeuristics",
654 base::FEATURE_DISABLED_BY_DEFAULT};
655
656const base::Feature kKalmanDirectionCutOff{"KalmanDirectionCutOff",
657 base::FEATURE_DISABLED_BY_DEFAULT};
658
659const base::Feature kSkipTouchEventFilter{"SkipTouchEventFilter",
660 base::FEATURE_ENABLED_BY_DEFAULT};
661const char kSkipTouchEventFilterTypeParamName[] = "type";
662const char kSkipTouchEventFilterTypeParamValueDiscrete[] = "discrete";
663const char kSkipTouchEventFilterTypeParamValueAll[] = "all";
664const char kSkipTouchEventFilterFilteringProcessParamName[] =
665 "skip_filtering_process";
666const char kSkipTouchEventFilterFilteringProcessParamValueBrowser[] = "browser";
667const char kSkipTouchEventFilterFilteringProcessParamValueBrowserAndRenderer[] =
668 "browser_and_renderer";
669
Patrick To2afc1162020-06-03 18:19:30670// Improves support for WebXR on computers with multiple GPUs.
671const base::Feature kWebXrMultiGpu{"WebXRMultiGpu",
672 base::FEATURE_DISABLED_BY_DEFAULT};
673
Anders Hartvoll Ruud80f8818812020-06-09 08:07:31674// Enables dependency support in blink::MatchedPropertiesCache, which allows
675// caching of previously uncachable objects.
676const base::Feature kCSSMatchedPropertiesCacheDependencies{
677 "CSSMatchedPropertiesCacheDependencies", base::FEATURE_DISABLED_BY_DEFAULT};
678
Benoit Lize04cbcd9d2020-06-18 09:44:27679// Whether ParkableStrings can be written out to disk.
680const base::Feature kParkableStringsToDisk{"ParkableStringsToDisk",
681 base::FEATURE_DISABLED_BY_DEFAULT};
682
Matt Falkenhagen5cc652792018-06-21 10:34:33683} // namespace features
684} // namespace blink