blob: 862d584afb58522effbca83a8501cc523e9799ec [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
Hiroki Nakagawa61ee0042019-01-22 06:30:26104// Enable browser-initiated dedicated worker script loading
105// (PlzDedicatedWorker). https://crbug.com/906991
106const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
107 base::FEATURE_DISABLED_BY_DEFAULT};
108
Daniel Murphy95792ef2018-10-04 01:29:55109// Enable Portals. https://crbug.com/865123.
Jeremy Romanf369a9d62020-06-24 19:59:54110// For the current origin trial (https://crbug.com/1040212), this is enabled on
111// Android only.
112const base::Feature kPortals {
113 "Portals",
114#if defined(OS_ANDROID)
115 base::FEATURE_ENABLED_BY_DEFAULT
116#else
117 base::FEATURE_DISABLED_BY_DEFAULT
118#endif
119};
Daniel Murphy95792ef2018-10-04 01:29:55120
Jeremy Roman20366e42019-10-22 17:48:08121// When kPortals is enabled, allow portals to load content that is third-party
122// (cross-origin) to the hosting page. Otherwise has no effect.
123//
Jeremy Roman20366e42019-10-22 17:48:08124// https://crbug.com/1013389
125const base::Feature kPortalsCrossOrigin{"PortalsCrossOrigin",
Jeremy Romanf369a9d62020-06-24 19:59:54126 base::FEATURE_DISABLED_BY_DEFAULT};
Jeremy Roman20366e42019-10-22 17:48:08127
Tarun Bansal8df12b52019-02-15 05:46:30128// Enable limiting previews loading hints to specific resource types.
129const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
130 "PreviewsResourceLoadingHintsSpecificResourceTypes",
131 base::FEATURE_DISABLED_BY_DEFAULT};
132
Aditya Keerthie84331b32019-03-20 15:25:52133// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
134// the "PurgeAndSuspend" experiment.
135//
136// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
137// reasons. Consider enabling by default if experiment results are positive.
138// https://crbug.com/926186
139const base::Feature kPurgeRendererMemoryWhenBackgrounded {
140 "PurgeRendererMemoryWhenBackgrounded",
141#if defined(OS_MACOSX) || defined(OS_ANDROID)
142 base::FEATURE_DISABLED_BY_DEFAULT
143#else
144 base::FEATURE_ENABLED_BY_DEFAULT
145#endif
146};
147
David Bokan911bded2018-11-27 23:23:32148// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44149// TODO(bokan): Temporarily disabled on desktop platforms to address issues
150// with non-overlay scrollbars. https://crbug.com/948059.
151const base::Feature kImplicitRootScroller {
152 "ImplicitRootScroller",
153#if defined(OS_ANDROID)
154 base::FEATURE_ENABLED_BY_DEFAULT
155#else
156 base::FEATURE_DISABLED_BY_DEFAULT
157#endif
158};
David Bokan911bded2018-11-27 23:23:32159
Cathie Cheneac70602019-10-10 02:55:29160// Enable CSSOM View Scroll Coordinates. https://crbug.com/721759.
161const base::Feature kCSSOMViewScrollCoordinates{
162 "CSSOMViewScrollCoordinates", base::FEATURE_DISABLED_BY_DEFAULT};
163
Darwin Huangf588cc8e2019-12-13 22:24:56164// Enables Raw Clipboard. https://crbug.com/897289.
165const base::Feature kRawClipboard{"RawClipboard",
166 base::FEATURE_DISABLED_BY_DEFAULT};
167
Makoto Shimazu172eec02018-11-29 06:21:44168// Enables usage of getDisplayMedia() that allows capture of web content, see
169// https://crbug.com/865060.
170const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
171 base::FEATURE_ENABLED_BY_DEFAULT};
172
173// Changes the default RTCPeerConnection constructor behavior to use Unified
174// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
175// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
176// argument).
177const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56178 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44179
Johannes Kronad5a4532019-01-09 11:17:46180// Determines if the SDP attrbute extmap-allow-mixed should be offered by
181// default or not. The default value can be overridden by passing
182// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
183// constructor.
184const base::Feature kRTCOfferExtmapAllowMixed{
185 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
186
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00187// Prevents workers from sending IsolateInBackgroundNotification to V8
188// and thus instructs V8 to favor performance over memory on workers.
189const base::Feature kV8OptimizeWorkersForPerformance{
Ulan Degenbaev7acd73ea2020-04-07 16:02:33190 "V8OptimizeWorkersForPerformance", base::FEATURE_ENABLED_BY_DEFAULT};
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00191
Antonio Gomesb4718572019-09-11 02:55:48192// Enables negotiation of experimental multiplex codec in SDP.
193const base::Feature kWebRtcMultiplexCodec{"WebRTC-MultiplexCodec",
194 base::FEATURE_DISABLED_BY_DEFAULT};
195
196// Causes WebRTC to replace host ICE candidate IP addresses with generated
197// names ending in ".local" and resolve them using mDNS.
198// http://crbug.com/878465
199const base::Feature kWebRtcHideLocalIpsWithMdns{
200 "WebRtcHideLocalIpsWithMdns", base::FEATURE_ENABLED_BY_DEFAULT};
201
OlivierLi95a0f6a52020-06-18 15:40:08202// When enabled, wake ups from throttleable TaskQueues are limited to 1 per
203// minute in a page that has been backgrounded for 5 minutes.
204//
205// Intensive wake up throttling is enforced in addition to other throttling
206// mechanisms:
207// - 1 wake up per second in a background page or hidden cross-origin frame
208// - 1% CPU time in a page that has been backgrounded for 10 seconds
209//
210// Feature tracking bug: https://crbug.com/1075553
211//
212// Note that the base::Feature should not be read from;
213// rather the provided accessors should be used, which also take into account
214// the managed policy override of the feature.
215const base::Feature kIntensiveWakeUpThrottling{
216 "IntensiveWakeUpThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
217
Antonio Gomesf3bcd512019-09-03 21:27:17218#if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
219// Run-time feature for the |rtc_use_h264| encoder/decoder.
220const base::Feature kWebRtcH264WithOpenH264FFmpeg{
221 "WebRTC-H264WithOpenH264FFmpeg", base::FEATURE_ENABLED_BY_DEFAULT};
222#endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
223
Makoto Shimazua8b3d742019-04-05 06:55:51224// Experiment of the delay from navigation to starting an update of a service
225// worker's script.
226const base::Feature kServiceWorkerUpdateDelay{
227 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
228
Scott Haseley8eefdcd2018-08-22 16:50:19229// Freeze scheduler task queues in background after allowed grace time.
230// "stop" is a legacy name.
231const base::Feature kStopInBackground {
232 "stop-in-background",
233#if defined(OS_ANDROID)
234 base::FEATURE_ENABLED_BY_DEFAULT
235#else
236 base::FEATURE_DISABLED_BY_DEFAULT
237#endif
238};
239
Takashi Sakamotoc19fc2b2019-04-10 06:30:52240// Freeze scheduler task queues in background on network idle.
241// This feature only works if stop-in-background is enabled.
242const base::Feature kFreezeBackgroundTabOnNetworkIdle{
243 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
244
Shubhie Panicker60bd4b02018-09-26 00:02:15245// Freeze non-timer task queues in background, after allowed grace time.
246// "stop" is a legacy name.
Dave Tapuska9140c552019-05-30 16:18:56247const base::Feature kStopNonTimersInBackground{
248 "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT};
Scott Haseley7757f6c2018-08-03 14:33:23249
Brandon Maslenda12cf82019-08-23 20:54:18250// Enable the Storage Access API. https://crbug.com/989663.
251const base::Feature kStorageAccessAPI{"StorageAccessAPI",
252 base::FEATURE_DISABLED_BY_DEFAULT};
253
David Bokane9370c22019-02-14 15:19:58254// Enable text snippets in URL fragments. https://crbug.com/919204.
255const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
Nick Burris62f8d5f02020-01-16 22:54:51256 base::FEATURE_ENABLED_BY_DEFAULT};
David Bokane9370c22019-02-14 15:19:58257
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42258// Writable files and native file system access. https://crbug.com/853326
259const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrink4cc3ec22019-09-04 16:28:20260 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44261
Jay Harris583f48922019-05-06 05:55:24262// File handling integration. https://crbug.com/829689
263const base::Feature kFileHandlingAPI{"FileHandlingAPI",
264 base::FEATURE_DISABLED_BY_DEFAULT};
265
kdillon66bf5b522019-01-02 22:08:30266// Allows for synchronous XHR requests during page dismissal
Katie Dillon8b357312019-09-19 13:23:23267const base::Feature kAllowSyncXHRInPageDismissal{
268 "AllowSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30269
Olivier Yiptongb60d2c42020-01-10 22:47:15270// Font enumeration and table access. https://crbug.com/535764 and
271// https://crbug.com/982054.
272const base::Feature kFontAccess{"FontAccess",
273 base::FEATURE_DISABLED_BY_DEFAULT};
274
Mason Freed6f146312020-06-27 05:12:55275// Allows Web Components v0 to be re-enabled.
276const base::Feature kWebComponentsV0{"WebComponentsV0",
277 base::FEATURE_DISABLED_BY_DEFAULT};
278
Dominic Farolino780df942019-09-04 06:49:44279// Prefetch request properties are updated to be privacy-preserving. See
280// crbug.com/988956.
281const base::Feature kPrefetchPrivacyChanges{"PrefetchPrivacyChanges",
282 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino693fd72d2019-08-05 11:09:44283
Carlos ILd3be52b2018-10-08 17:57:18284const char kMixedContentAutoupgradeModeParamName[] = "mode";
Carlos IL9970a942020-02-14 01:16:50285const char kMixedContentAutoupgradeModeAllPassive[] = "all-passive";
Carlos ILd3be52b2018-10-08 17:57:18286
Sasha McIntoshe889f9f2019-09-03 21:01:57287// Decodes jpeg 4:2:0 formatted images to YUV instead of RGBX and stores in this
288// format in the image decode cache. See crbug.com/919627 for details on the
289// feature.
Sasha McIntosh633b6312020-06-12 19:45:19290const base::Feature kDecodeJpeg420ImagesToYUV{
291 "DecodeJpeg420ImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
Sasha McIntoshe889f9f2019-09-03 21:01:57292
Madeleine Barowsky45be21a42018-12-07 18:39:30293// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
294// in the image decode cache. See crbug.com/900264 for details on the feature.
295const base::Feature kDecodeLossyWebPImagesToYUV{
Sasha McIntoshf670a6b2020-01-09 18:27:09296 "DecodeLossyWebPImagesToYUV", base::FEATURE_ENABLED_BY_DEFAULT};
Madeleine Barowsky45be21a42018-12-07 18:39:30297
Takashi Toyoshimaa91506d2019-03-28 05:44:42298// Enables cache-aware WebFonts loading. See https://crbug.com/570205.
299// The feature is disabled on Android for WebView API issue discussed at
300// https://crbug.com/942440.
301const base::Feature kWebFontsCacheAwareTimeoutAdaption {
302 "WebFontsCacheAwareTimeoutAdaption",
303#if defined(OS_ANDROID)
304 base::FEATURE_DISABLED_BY_DEFAULT
305#else
306 base::FEATURE_ENABLED_BY_DEFAULT
307#endif
308};
309
Ehsan Karamadbe95d122019-05-10 17:59:06310// Enabled to block programmatic focus in subframes when not triggered by user
311// activation (see htpps://crbug.com/954349).
312const base::Feature kBlockingFocusWithoutUserActivation{
313 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
314
Hongchan Choi370d3af2019-05-20 20:56:58315const base::Feature kAudioWorkletRealtimeThread{
316 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
317
Ryan Sturm139c3ac2019-07-12 18:52:53318// A feature to reduce the set of resources fetched by No-State Prefetch.
Robert Ogden2bb6a2522020-06-05 00:28:10319const base::Feature kLightweightNoStatePrefetch {
Ryan Sturmf223cb02019-10-04 18:02:00320 "LightweightNoStatePrefetch",
321#if defined(OS_ANDROID)
322 base::FEATURE_ENABLED_BY_DEFAULT
323#else
324 base::FEATURE_DISABLED_BY_DEFAULT
325#endif
326};
Ryan Sturm139c3ac2019-07-12 18:52:53327
Aran Gilman5e9672bed2019-08-02 19:07:49328// Automatically convert light-themed pages to use a Blink-generated dark theme
329const base::Feature kForceWebContentsDarkMode{
330 "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT};
331
Michael Crouseb7acd772020-02-20 02:56:26332// A feature to enable using the smallest image specified within image srcset
333// for users with Save Data enabled.
334const base::Feature kSaveDataImgSrcset{"SaveDataImgSrcset",
335 base::FEATURE_DISABLED_BY_DEFAULT};
336
Aran Gilman5e9672bed2019-08-02 19:07:49337// Which algorithm should be used for color inversion?
338const base::FeatureParam<ForceDarkInversionMethod>::Option
339 forcedark_inversion_method_options[] = {
340 {ForceDarkInversionMethod::kUseBlinkSettings,
341 "use_blink_settings_for_method"},
342 {ForceDarkInversionMethod::kHslBased, "hsl_based"},
Aran Gilman8b3ca41c2019-08-12 18:59:04343 {ForceDarkInversionMethod::kCielabBased, "cielab_based"},
344 {ForceDarkInversionMethod::kRgbBased, "rgb_based"}};
Aran Gilman5e9672bed2019-08-02 19:07:49345
346const base::FeatureParam<ForceDarkInversionMethod>
347 kForceDarkInversionMethodParam{&kForceWebContentsDarkMode,
348 "inversion_method",
349 ForceDarkInversionMethod::kUseBlinkSettings,
350 &forcedark_inversion_method_options};
351
352// Should images be inverted?
353const base::FeatureParam<ForceDarkImageBehavior>::Option
354 forcedark_image_behavior_options[] = {
355 {ForceDarkImageBehavior::kUseBlinkSettings,
356 "use_blink_settings_for_images"},
357 {ForceDarkImageBehavior::kInvertNone, "none"},
358 {ForceDarkImageBehavior::kInvertSelectively, "selective"}};
359
360const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{
361 &kForceWebContentsDarkMode, "image_behavior",
362 ForceDarkImageBehavior::kUseBlinkSettings,
363 &forcedark_image_behavior_options};
364
365// Do not invert text lighter than this.
366// Range: 0 (do not invert any text) to 256 (invert all text)
367// Can also set to -1 to let Blink's internal settings control the value
368const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{
369 &kForceWebContentsDarkMode, "text_lightness_threshold", -1};
370
371// Do not invert backgrounds darker than this.
372// Range: 0 (invert all backgrounds) to 256 (invert no backgrounds)
373// Can also set to -1 to let Blink's internal settings control the value
374const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{
375 &kForceWebContentsDarkMode, "background_lightness_threshold", -1};
376
Sergey Silkinc33244f2020-01-31 17:21:30377// Instructs WebRTC to honor the Min/Max Video Encode Accelerator dimensions.
Miguel Casas-Sanchezb6128392020-02-18 15:45:39378const base::Feature kWebRtcUseMinMaxVEADimensions {
379 "WebRtcUseMinMaxVEADimensions",
380 // TODO(crbug.com/1008491): enable other platforms.
381#if defined(OS_CHROMEOS)
382 base::FEATURE_ENABLED_BY_DEFAULT
383#else
384 base::FEATURE_DISABLED_BY_DEFAULT
385#endif
386};
Sergey Silkinc33244f2020-01-31 17:21:30387
Michael Lippautze670df9f2019-07-09 11:39:49388// Blink garbage collection.
389// Enables compaction of backing stores on Blink's heap.
390const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction",
391 base::FEATURE_ENABLED_BY_DEFAULT};
392// Enables concurrently marking Blink's heap.
393const base::Feature kBlinkHeapConcurrentMarking{
Omer Katz1757893c2020-02-17 12:09:19394 "BlinkHeapConcurrentMarking", base::FEATURE_ENABLED_BY_DEFAULT};
Anton Bikineev9b7b3722019-07-09 13:48:39395// Enables concurrently sweeping Blink's heap.
396const base::Feature kBlinkHeapConcurrentSweeping{
Anton Bikineev204cc752019-08-07 00:26:37397 "BlinkHeapConcurrentSweeping", base::FEATURE_ENABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49398// Enables incrementally marking Blink's heap.
399const base::Feature kBlinkHeapIncrementalMarking{
400 "BlinkHeapIncrementalMarking", base::FEATURE_ENABLED_BY_DEFAULT};
401// Enables a marking stress mode that schedules more garbage collections and
402// also adds additional verification passes.
403const base::Feature kBlinkHeapIncrementalMarkingStress{
404 "BlinkHeapIncrementalMarkingStress", base::FEATURE_DISABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49405
Yoav Weissddfb8d2e2019-07-15 22:34:03406// Enables removing AppCache delays when triggering requests when the HTML was
407// not fetched from AppCache.
408const base::Feature kVerifyHTMLFetchedFromAppCacheBeforeDelay{
409 "VerifyHTMLFetchedFromAppCacheBeforeDelay",
410 base::FEATURE_DISABLED_BY_DEFAULT};
411
Michael Spang8d2303e2019-07-26 01:56:32412// Controls whether we use ThreadPriority::DISPLAY for renderer
413// compositor & IO threads.
414const base::Feature kBlinkCompositorUseDisplayThreadPriority {
415 "BlinkCompositorUseDisplayThreadPriority",
Sunny Sachanandani16944252019-12-04 03:40:49416#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
Michael Spang8d2303e2019-07-26 01:56:32417 base::FEATURE_ENABLED_BY_DEFAULT
418#else
419 base::FEATURE_DISABLED_BY_DEFAULT
420#endif
421};
422
Yuki Shiinoa812f492019-08-23 06:47:46423// Ignores cross origin windows in the named property interceptor of Window.
424// https://crbug.com/538562
425const base::Feature kIgnoreCrossOriginWindowWhenNamedAccessOnWindow{
426 "IgnoreCrossOriginWindowWhenNamedAccessOnWindow",
427 base::FEATURE_DISABLED_BY_DEFAULT};
428
Tarun Bansal38792462019-09-04 16:08:11429// When enabled, loading priority of JavaScript requests is lowered when they
430// are force deferred by the intervention.
431const base::Feature kLowerJavaScriptPriorityWhenForceDeferred{
432 "LowerJavaScriptPriorityWhenForceDeferred",
Tarun Bansal755268fe2019-10-18 18:57:40433 base::FEATURE_DISABLED_BY_DEFAULT};
Tarun Bansal38792462019-09-04 16:08:11434
Tarun Bansalf32aaa22020-02-12 16:16:44435// When enabled, scripts in iframes are not force deferred by the DeferAllScript
436// intervention.
437const base::Feature kDisableForceDeferInChildFrames{
438 "DisableForceDeferInChildFrames", base::FEATURE_DISABLED_BY_DEFAULT};
439
rajendrantd5db55f2019-10-19 01:56:59440// Enables redirecting subresources in the page to better compressed and
441// optimized versions to provide data savings.
442const base::Feature kSubresourceRedirect{"SubresourceRedirect",
443 base::FEATURE_DISABLED_BY_DEFAULT};
444
Stefan Zagerfd18161c2019-10-22 20:44:31445// When 'enabled', all cross-origin iframes will get a compositing layer.
446const base::Feature kCompositeCrossOriginIframes{
447 "CompositeCrossOriginIframes", base::FEATURE_DISABLED_BY_DEFAULT};
Yutaka Hirano0b3c319b2019-10-25 17:19:15448
Chris Harrelson70be13d2020-06-03 21:06:52449// When enabled, enforces new interoperable semantics for 3D transforms.
450// See crbug.com/1008483.
451const base::Feature kTransformInterop{"TransformInterop",
452 base::FEATURE_DISABLED_BY_DEFAULT};
453
Yutaka Hirano0b3c319b2019-10-25 17:19:15454// When enabled, beacons (and friends) have ResourceLoadPriority::kLow,
455// not ResourceLoadPriority::kVeryLow.
456const base::Feature kSetLowPriorityForBeacon{"SetLowPriorityForBeacon",
457 base::FEATURE_DISABLED_BY_DEFAULT};
458
Ben Kelly776f59d2019-11-06 16:25:30459// When enabled allows the header name used in the blink
460// CacheStorageCodeCacheHint runtime feature to be modified. This runtime
461// feature disables generating full code cache for responses stored in
462// cache_storage during a service worker install event. The runtime feature
463// must be enabled via the blink runtime feature mechanism, however.
464const base::Feature kCacheStorageCodeCacheHintHeader{
465 "CacheStorageCodeCacheHintHeader", base::FEATURE_DISABLED_BY_DEFAULT};
466const base::FeatureParam<std::string> kCacheStorageCodeCacheHintHeaderName{
467 &kCacheStorageCodeCacheHintHeader, "name", "x-CacheStorageCodeCacheHint"};
468
Francois Doray563453432019-11-20 15:32:17469// When enabled, the beforeunload handler is dispatched when a frame is frozen.
470// This allows the browser to know whether discarding the frame could result in
471// lost user data, at the cost of extra CPU usage. The feature will be removed
472// once we have determine whether the CPU cost is acceptable.
473const base::Feature kDispatchBeforeUnloadOnFreeze{
474 "DispatchBeforeUnloadOnFreeze", base::FEATURE_ENABLED_BY_DEFAULT};
475
Sunny Sachanandani26463422019-12-05 21:35:40476// Enables the use of GpuMemoryBuffer images for low latency 2d canvas.
477// TODO(khushalsagar): Enable this if we're using SurfaceControl and GMBs allow
478// us to overlay these resources.
479const base::Feature kLowLatencyCanvas2dImageChromium {
480 "LowLatencyCanvas2dImageChromium",
481#if defined(OS_CHROMEOS)
482 base::FEATURE_ENABLED_BY_DEFAULT
483#else
484 base::FEATURE_DISABLED_BY_DEFAULT
485#endif // OS_CHROMEOS
486};
487
488// Enables the use of shared image swap chains for low latency 2d canvas.
489const base::Feature kLowLatencyCanvas2dSwapChain{
Sunny Sachanandanib954dc7c2019-12-12 02:50:51490 "LowLatencyCanvas2dSwapChain", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40491
492// Enables the use of shared image swap chains for low latency webgl canvas.
Sunny Sachanandanib954dc7c2019-12-12 02:50:51493const base::Feature kLowLatencyWebGLSwapChain{"LowLatencyWebGLSwapChain",
494 base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40495
Stephen Whitee17b0232020-04-27 23:48:49496// Enables Dawn-accelerated 2D canvas.
497const base::Feature kDawn2dCanvas{"Dawn2dCanvas",
498 base::FEATURE_DISABLED_BY_DEFAULT};
499
Xiaocheng Hud5197fd2020-02-06 07:26:08500const base::Feature kCSSReducedFontLoadingInvalidations{
Xiaocheng Hu75bafe52020-06-22 22:54:27501 "CSSReducedFontLoadingInvalidations", base::FEATURE_ENABLED_BY_DEFAULT};
Xiaocheng Hue5ff8e12020-06-16 21:47:35502const base::Feature kCSSReducedFontLoadingLayoutInvalidations{
503 "CSSReducedFontLoadingLayoutInvalidations",
504 base::FEATURE_DISABLED_BY_DEFAULT};
Xiaocheng Hud5197fd2020-02-06 07:26:08505
Egor Pasko28ec46952020-02-07 15:17:57506// When enabled, frees up CachedMetadata after consumption by script resources
507// and modules. Needed for the experiment in http://crbug.com/1045052.
508const base::Feature kDiscardCodeCacheAfterFirstUse{
509 "DiscardCodeCacheAfterFirstUse", base::FEATURE_DISABLED_BY_DEFAULT};
510
Yutaka Hiranobf410a42020-02-18 08:08:45511// The kill-switch for the fix for https://crbug.com/1051439.
512// TODO(crbug.com/1053369): Remove this around M84.
513const base::Feature kSuppressContentTypeForBeaconMadeWithArrayBufferView{
514 "SuppressContentTypeForBeaconMadeWithArrayBufferView",
515 base::FEATURE_ENABLED_BY_DEFAULT};
516
Ian Kilpatrickef7f4382020-06-02 12:38:10517const base::Feature kBlockFlowHandlesWebkitLineClamp{
Ian Kilpatrickbdec8902020-06-02 12:46:09518 "BlockFlowHandlesWebkitLineClamp", base::FEATURE_ENABLED_BY_DEFAULT};
Ian Kilpatrickef7f4382020-06-02 12:38:10519
Rune Lillesveen61f49ee2020-03-02 07:53:49520const base::Feature kBlockHTMLParserOnStyleSheets{
521 "BlockHTMLParserOnStyleSheets", base::FEATURE_DISABLED_BY_DEFAULT};
522
Mason Freed0ebaa772020-06-03 16:11:08523// Kill switch for the new <link disabled> behavior.
524// TODO(crbug.com/1087043): Remove this once the feature has
525// landed and no compat issues are reported.
526const base::Feature kLinkDisabledNewSpecBehavior{
527 "LinkDisabledNewSpecBehavior", base::FEATURE_ENABLED_BY_DEFAULT};
528
Xiaocheng Hud2e807d2020-03-04 21:15:21529// Slightly delays rendering if there are fonts being preloaded, so that
530// they don't miss the first paint if they can be loaded fast enough (e.g.,
531// from the disk cache)
532const base::Feature kFontPreloadingDelaysRendering{
533 "FontPreloadingDelaysRendering", base::FEATURE_DISABLED_BY_DEFAULT};
534
535// Set to be over 90th-percentile of HttpCache.AccessToDone.Used on all
536// platforms, and also to allow some time for IPC and scheduling.
537// TODO(xiaochengh): Tune it for the best performance.
538const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{
539 &kFontPreloadingDelaysRendering, "delay-in-ms", 100};
540
David Grogan17b34f4f2020-05-11 19:35:19541const base::Feature kFlexGaps{"FlexGaps", base::FEATURE_DISABLED_BY_DEFAULT};
David Grogan565f8bb2020-05-27 03:07:40542const base::Feature kFlexNG{"FlexNG", base::FEATURE_ENABLED_BY_DEFAULT};
David Grogan5b3cf162020-03-19 21:53:15543
Dominic Farolino0f55a082020-03-24 09:47:55544const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
545 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino7d3d6f12020-06-10 21:59:46546const base::Feature kDelayAsyncScriptExecution{
547 "DelayAsyncScriptExecution", base::FEATURE_DISABLED_BY_DEFAULT};
548const base::FeatureParam<DelayAsyncScriptDelayType>::Option
549 delay_async_script_execution_delay_types[] = {
550 {DelayAsyncScriptDelayType::kFinishedParsing, "finished_parsing"},
551 {DelayAsyncScriptDelayType::kFirstPaintOrFinishedParsing,
552 "first_paint_or_finished_parsing"}};
553const base::FeatureParam<DelayAsyncScriptDelayType>
554 kDelayAsyncScriptExecutionDelayParam{
555 &kDelayAsyncScriptExecution, "delay_type",
556 DelayAsyncScriptDelayType::kFinishedParsing,
557 &delay_async_script_execution_delay_types};
Dominic Farolino0f55a082020-03-24 09:47:55558
Adrienne Walkerb53b4372020-05-06 18:57:18559// The AppCache feature is a kill-switch for the entire AppCache feature,
560// both backend and API. If disabled, then it will turn off the backend and
561// api, regardless of the presence of valid origin trial tokens.
Adrienne Walkere6b51722020-04-01 17:56:38562const base::Feature kAppCache{"AppCache", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkerb53b4372020-05-06 18:57:18563// If AppCacheRequireOriginTrial is enabled, then the AppCache backend in the
564// browser will require origin trial tokens in order to load or store manifests
565// and their contents.
566const base::Feature kAppCacheRequireOriginTrial{
Adrienne Walkerdd9442e02020-06-10 16:23:40567 "AppCacheRequireOriginTrial", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkere6b51722020-04-01 17:56:38568
Wan-Teh Chang75fd5322020-04-08 01:32:18569// Enables the AV1 Image File Format (AVIF).
Wan-Teh Changb9d67a12020-06-26 01:19:13570const base::Feature kAVIF{"AVIF", base::FEATURE_ENABLED_BY_DEFAULT};
Wan-Teh Chang75fd5322020-04-08 01:32:18571
Xiaocheng Hu66795f02020-04-25 00:26:47572// Make all pending 'display: auto' web fonts enter the swap or failure period
Xiaocheng Hu9e2055c2020-04-09 20:35:28573// immediately before reaching the LCP time limit (~2500ms), so that web fonts
574// do not become a source of bad LCP.
575const base::Feature kAlignFontDisplayAutoTimeoutWithLCPGoal{
576 "AlignFontDisplayAutoTimeoutWithLCPGoal",
577 base::FEATURE_DISABLED_BY_DEFAULT};
578
Xiaocheng Hu66795f02020-04-25 00:26:47579// The amount of time allowed for 'display: auto' web fonts to load without
580// intervention, counted from navigation start.
581const base::FeatureParam<int>
582 kAlignFontDisplayAutoTimeoutWithLCPGoalTimeoutParam{
583 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "lcp-limit-in-ms", 2000};
584
585const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>::Option
586 align_font_display_auto_timeout_with_lcp_goal_modes[] = {
587 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
588 "failure"},
589 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, "swap"}};
590const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>
591 kAlignFontDisplayAutoTimeoutWithLCPGoalModeParam{
592 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "intervention-mode",
593 AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
594 &align_font_display_auto_timeout_with_lcp_goal_modes};
Xiaocheng Hu9e2055c2020-04-09 20:35:28595
Ben Kellyd52869b2020-04-20 17:17:43596// Enable throttling of fetch() requests from service workers in the
597// installing state.
598const base::Feature kThrottleInstallingServiceWorker{
599 "ThrottleInstallingServiceWorker", base::FEATURE_DISABLED_BY_DEFAULT};
600const base::FeatureParam<int> kInstallingServiceWorkerOutstandingThrottledLimit{
601 &kThrottleInstallingServiceWorker, "limit", 5};
602
Dave Tapuska95b71c82020-06-08 16:56:11603const base::Feature kInputPredictorTypeChoice{
604 "InputPredictorTypeChoice", base::FEATURE_DISABLED_BY_DEFAULT};
605
606const base::Feature kResamplingInputEvents{"ResamplingInputEvents",
607 base::FEATURE_DISABLED_BY_DEFAULT};
608
Dave Tapuskafea88942020-05-05 18:50:32609const base::Feature kResamplingScrollEvents{"ResamplingScrollEvents",
610 base::FEATURE_ENABLED_BY_DEFAULT};
611
Yoav Weiss200214d52020-05-13 23:58:42612// Enables the device-memory, resource-width, viewport-width and DPR client
613// hints to be sent to third-party origins if the first-party has opted in to
614// receiving client hints, regardless of Feature Policy.
615#if defined(OS_ANDROID)
616const base::Feature kAllowClientHintsToThirdParty{
617 "AllowClientHintsToThirdParty", base::FEATURE_ENABLED_BY_DEFAULT};
618#else
619const base::Feature kAllowClientHintsToThirdParty{
620 "AllowClientHintsToThirdParty", base::FEATURE_DISABLED_BY_DEFAULT};
621#endif
622
Dave Tapuskafea88942020-05-05 18:50:32623const char kScrollPredictorNameLsq[] = "lsq";
624const char kScrollPredictorNameKalman[] = "kalman";
625const char kScrollPredictorNameLinearFirst[] = "linear_first";
626const char kScrollPredictorNameLinearSecond[] = "linear_second";
627const char kScrollPredictorNameLinearResampling[] = "linear_resampling";
628const char kScrollPredictorNameEmpty[] = "empty";
629
630const base::Feature kFilteringScrollPrediction{
631 "FilteringScrollPrediction", base::FEATURE_DISABLED_BY_DEFAULT};
632
633const char kFilterNameEmpty[] = "empty_filter";
634const char kFilterNameOneEuro[] = "one_euro_filter";
635
636const base::Feature kKalmanHeuristics{"KalmanHeuristics",
637 base::FEATURE_DISABLED_BY_DEFAULT};
638
639const base::Feature kKalmanDirectionCutOff{"KalmanDirectionCutOff",
640 base::FEATURE_DISABLED_BY_DEFAULT};
641
642const base::Feature kSkipTouchEventFilter{"SkipTouchEventFilter",
643 base::FEATURE_ENABLED_BY_DEFAULT};
644const char kSkipTouchEventFilterTypeParamName[] = "type";
645const char kSkipTouchEventFilterTypeParamValueDiscrete[] = "discrete";
646const char kSkipTouchEventFilterTypeParamValueAll[] = "all";
647const char kSkipTouchEventFilterFilteringProcessParamName[] =
648 "skip_filtering_process";
649const char kSkipTouchEventFilterFilteringProcessParamValueBrowser[] = "browser";
650const char kSkipTouchEventFilterFilteringProcessParamValueBrowserAndRenderer[] =
651 "browser_and_renderer";
652
Patrick To2afc1162020-06-03 18:19:30653// Improves support for WebXR on computers with multiple GPUs.
654const base::Feature kWebXrMultiGpu{"WebXRMultiGpu",
655 base::FEATURE_DISABLED_BY_DEFAULT};
656
Anders Hartvoll Ruud80f8818812020-06-09 08:07:31657// Enables dependency support in blink::MatchedPropertiesCache, which allows
658// caching of previously uncachable objects.
659const base::Feature kCSSMatchedPropertiesCacheDependencies{
660 "CSSMatchedPropertiesCacheDependencies", base::FEATURE_DISABLED_BY_DEFAULT};
661
Benoit Lize04cbcd9d2020-06-18 09:44:27662// Whether ParkableStrings can be written out to disk.
663const base::Feature kParkableStringsToDisk{"ParkableStringsToDisk",
664 base::FEATURE_DISABLED_BY_DEFAULT};
665
Matt Falkenhagen5cc652792018-06-21 10:34:33666} // namespace features
667} // namespace blink