blob: bf71f1c4e6aa63890dd48c9ce12290f29696afc4 [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
Ulan Degenbaev13d709c2020-07-14 20:15:2462const base::Feature kMeasureMemoryExperiment{"MeasureMemoryExperiment",
63 base::FEATURE_DISABLED_BY_DEFAULT};
64
Vladimir Levin43758ecc2019-05-09 18:04:0365// Enable Display Locking JavaScript APIs.
66const base::Feature kDisplayLocking{"DisplayLocking",
67 base::FEATURE_DISABLED_BY_DEFAULT};
68
Sam Sebree2dd45c4f2019-12-13 05:51:4969const base::Feature kJSONModules{"JSONModules",
70 base::FEATURE_DISABLED_BY_DEFAULT};
71
Mason Freedd71a9642020-06-03 01:35:0772const base::Feature kForceSynchronousHTMLParsing{
73 "ForceSynchronousHTMLParsing", base::FEATURE_DISABLED_BY_DEFAULT};
74
Camillo Brunia19d7fc2020-03-17 07:53:3575// Enables top-level await in modules.
76const base::Feature kTopLevelAwait{"TopLevelAwait",
77 base::FEATURE_DISABLED_BY_DEFAULT};
78
Ian Kilpatricke68ef11a2018-07-04 03:52:1079// Enable LayoutNG.
Emil A Eklund69eeb562019-07-03 01:38:3080const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_ENABLED_BY_DEFAULT};
Ian Kilpatricke68ef11a2018-07-04 03:52:1081
Kent Tamura4187dc92020-06-18 04:39:3582// Enable LayoutNGRuby by default. This feature is for a kill switch.
83const base::Feature kLayoutNGRuby{"LayoutNGRuby",
84 base::FEATURE_ENABLED_BY_DEFAULT};
85
Koji Ishii14c52bd2020-06-11 17:00:5986const base::Feature kFragmentItem{"FragmentItem",
87 base::FEATURE_DISABLED_BY_DEFAULT};
88
Makoto Shimazu172eec02018-11-29 06:21:4489const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
Carlos IL9970a942020-02-14 01:16:5090 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:4491
Tarun Bansal422f9012019-01-23 16:55:5892// Used to control the collection of anchor element metrics (crbug.com/856683).
93// If kNavigationPredictor is enabled, then metrics of anchor elements
94// in the first viewport after the page load and the metrics of the clicked
95// anchor element will be extracted and recorded. Additionally, navigation
96// predictor may preconnect/prefetch to resources/origins to make the
97// future navigations faster.
Sofiya Semenovae4e076152019-07-29 20:10:2798const base::Feature kNavigationPredictor {
99 "NavigationPredictor",
100#if defined(OS_ANDROID)
101 base::FEATURE_ENABLED_BY_DEFAULT
102#else
103 base::FEATURE_DISABLED_BY_DEFAULT
104#endif
105};
Tarun Bansal422f9012019-01-23 16:55:58106
Benoit Lize66684b22020-08-07 12:30:22107const base::Feature kParentNodeReplaceChildren{
108 "ParentNodeReplaceChildren", base::FEATURE_ENABLED_BY_DEFAULT};
Yu Hanae4c3b72020-07-08 21:48:58109
Hiroki Nakagawa61ee0042019-01-22 06:30:26110// Enable browser-initiated dedicated worker script loading
111// (PlzDedicatedWorker). https://crbug.com/906991
112const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
113 base::FEATURE_DISABLED_BY_DEFAULT};
114
Daniel Murphy95792ef2018-10-04 01:29:55115// Enable Portals. https://crbug.com/865123.
Jeremy Romanf369a9d62020-06-24 19:59:54116// For the current origin trial (https://crbug.com/1040212), this is enabled on
117// Android only.
118const base::Feature kPortals {
119 "Portals",
120#if defined(OS_ANDROID)
121 base::FEATURE_ENABLED_BY_DEFAULT
122#else
123 base::FEATURE_DISABLED_BY_DEFAULT
124#endif
125};
Daniel Murphy95792ef2018-10-04 01:29:55126
Jeremy Roman20366e42019-10-22 17:48:08127// When kPortals is enabled, allow portals to load content that is third-party
128// (cross-origin) to the hosting page. Otherwise has no effect.
129//
Jeremy Roman20366e42019-10-22 17:48:08130// https://crbug.com/1013389
131const base::Feature kPortalsCrossOrigin{"PortalsCrossOrigin",
Jeremy Romanf369a9d62020-06-24 19:59:54132 base::FEATURE_DISABLED_BY_DEFAULT};
Jeremy Roman20366e42019-10-22 17:48:08133
Tarun Bansal8df12b52019-02-15 05:46:30134// Enable limiting previews loading hints to specific resource types.
135const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
136 "PreviewsResourceLoadingHintsSpecificResourceTypes",
137 base::FEATURE_DISABLED_BY_DEFAULT};
138
Aditya Keerthie84331b32019-03-20 15:25:52139// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
140// the "PurgeAndSuspend" experiment.
141//
142// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
143// reasons. Consider enabling by default if experiment results are positive.
144// https://crbug.com/926186
145const base::Feature kPurgeRendererMemoryWhenBackgrounded {
146 "PurgeRendererMemoryWhenBackgrounded",
Avi Drissman916c12f2020-07-29 16:59:13147#if defined(OS_MAC) || defined(OS_ANDROID)
Aditya Keerthie84331b32019-03-20 15:25:52148 base::FEATURE_DISABLED_BY_DEFAULT
149#else
150 base::FEATURE_ENABLED_BY_DEFAULT
151#endif
152};
153
David Bokan911bded2018-11-27 23:23:32154// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44155// TODO(bokan): Temporarily disabled on desktop platforms to address issues
156// with non-overlay scrollbars. https://crbug.com/948059.
157const base::Feature kImplicitRootScroller {
158 "ImplicitRootScroller",
159#if defined(OS_ANDROID)
160 base::FEATURE_ENABLED_BY_DEFAULT
161#else
162 base::FEATURE_DISABLED_BY_DEFAULT
163#endif
164};
David Bokan911bded2018-11-27 23:23:32165
Cathie Cheneac70602019-10-10 02:55:29166// Enable CSSOM View Scroll Coordinates. https://crbug.com/721759.
167const base::Feature kCSSOMViewScrollCoordinates{
168 "CSSOMViewScrollCoordinates", base::FEATURE_DISABLED_BY_DEFAULT};
169
Darwin Huangf588cc8e2019-12-13 22:24:56170// Enables Raw Clipboard. https://crbug.com/897289.
171const base::Feature kRawClipboard{"RawClipboard",
172 base::FEATURE_DISABLED_BY_DEFAULT};
173
Makoto Shimazu172eec02018-11-29 06:21:44174// Enables usage of getDisplayMedia() that allows capture of web content, see
175// https://crbug.com/865060.
176const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
177 base::FEATURE_ENABLED_BY_DEFAULT};
178
179// Changes the default RTCPeerConnection constructor behavior to use Unified
180// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
181// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
182// argument).
183const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56184 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44185
Johannes Kronad5a4532019-01-09 11:17:46186// Determines if the SDP attrbute extmap-allow-mixed should be offered by
187// default or not. The default value can be overridden by passing
188// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
189// constructor.
190const base::Feature kRTCOfferExtmapAllowMixed{
191 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
192
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00193// Prevents workers from sending IsolateInBackgroundNotification to V8
194// and thus instructs V8 to favor performance over memory on workers.
195const base::Feature kV8OptimizeWorkersForPerformance{
Ulan Degenbaev7acd73ea2020-04-07 16:02:33196 "V8OptimizeWorkersForPerformance", base::FEATURE_ENABLED_BY_DEFAULT};
Ulan Degenbaev4b3bc29b2020-03-13 17:09:00197
Antonio Gomesb4718572019-09-11 02:55:48198// Enables negotiation of experimental multiplex codec in SDP.
199const base::Feature kWebRtcMultiplexCodec{"WebRTC-MultiplexCodec",
200 base::FEATURE_DISABLED_BY_DEFAULT};
201
202// Causes WebRTC to replace host ICE candidate IP addresses with generated
203// names ending in ".local" and resolve them using mDNS.
204// http://crbug.com/878465
205const base::Feature kWebRtcHideLocalIpsWithMdns{
206 "WebRtcHideLocalIpsWithMdns", base::FEATURE_ENABLED_BY_DEFAULT};
207
OlivierLi95a0f6a52020-06-18 15:40:08208// When enabled, wake ups from throttleable TaskQueues are limited to 1 per
209// minute in a page that has been backgrounded for 5 minutes.
210//
211// Intensive wake up throttling is enforced in addition to other throttling
212// mechanisms:
213// - 1 wake up per second in a background page or hidden cross-origin frame
214// - 1% CPU time in a page that has been backgrounded for 10 seconds
215//
216// Feature tracking bug: https://crbug.com/1075553
217//
218// Note that the base::Feature should not be read from;
219// rather the provided accessors should be used, which also take into account
220// the managed policy override of the feature.
221const base::Feature kIntensiveWakeUpThrottling{
222 "IntensiveWakeUpThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
223
Olivier Li5f02c1a2020-07-31 16:13:44224// When enabled, timers with timeout=0 are not throttled.
225const base::Feature kOptOutZeroTimeoutTimersFromThrottling{
226 "OptOutZeroTimeoutTimersFromThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
227
Francois Doray66c328cb2020-07-13 15:46:13228// When enabled, no throttling is applied to a page when it uses WebRTC.
229//
230// This allows a page to use a timer to do video processing on frames. An
231// event-driven mechanism should be provided to do video processing. When it is
232// available, this feature should be removed. https://crbug.com/1101806
233const base::Feature kOptOutWebRTCFromAllThrottling{
234 "OptOutWebRTCFromAllThrottling", base::FEATURE_DISABLED_BY_DEFAULT};
235
Francois Doray6cff4e02020-07-01 01:12:58236// Name of the parameter that controls the grace period during which there is no
237// intensive wake up throttling after a page is hidden. Defined here to allow
238// access from about_flags.cc. The FeatureParam is defined in
239// third_party/blink/renderer/platform/scheduler/common/features.cc.
240const char kIntensiveWakeUpThrottling_GracePeriodSeconds_Name[] =
241 "grace_period_seconds";
242
Antonio Gomesf3bcd512019-09-03 21:27:17243#if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
244// Run-time feature for the |rtc_use_h264| encoder/decoder.
245const base::Feature kWebRtcH264WithOpenH264FFmpeg{
246 "WebRTC-H264WithOpenH264FFmpeg", base::FEATURE_ENABLED_BY_DEFAULT};
247#endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
248
Makoto Shimazua8b3d742019-04-05 06:55:51249// Experiment of the delay from navigation to starting an update of a service
250// worker's script.
251const base::Feature kServiceWorkerUpdateDelay{
252 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
253
Scott Haseley8eefdcd2018-08-22 16:50:19254// Freeze scheduler task queues in background after allowed grace time.
255// "stop" is a legacy name.
256const base::Feature kStopInBackground {
257 "stop-in-background",
258#if defined(OS_ANDROID)
259 base::FEATURE_ENABLED_BY_DEFAULT
260#else
261 base::FEATURE_DISABLED_BY_DEFAULT
262#endif
263};
264
Takashi Sakamotoc19fc2b2019-04-10 06:30:52265// Freeze scheduler task queues in background on network idle.
266// This feature only works if stop-in-background is enabled.
267const base::Feature kFreezeBackgroundTabOnNetworkIdle{
268 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
269
Shubhie Panicker60bd4b02018-09-26 00:02:15270// Freeze non-timer task queues in background, after allowed grace time.
271// "stop" is a legacy name.
Dave Tapuska9140c552019-05-30 16:18:56272const base::Feature kStopNonTimersInBackground{
273 "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT};
Scott Haseley7757f6c2018-08-03 14:33:23274
Brandon Maslenda12cf82019-08-23 20:54:18275// Enable the Storage Access API. https://crbug.com/989663.
276const base::Feature kStorageAccessAPI{"StorageAccessAPI",
277 base::FEATURE_DISABLED_BY_DEFAULT};
278
David Bokane9370c22019-02-14 15:19:58279// Enable text snippets in URL fragments. https://crbug.com/919204.
280const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
Nick Burris62f8d5f02020-01-16 22:54:51281 base::FEATURE_ENABLED_BY_DEFAULT};
David Bokane9370c22019-02-14 15:19:58282
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42283// Writable files and native file system access. https://crbug.com/853326
284const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrink4cc3ec22019-09-04 16:28:20285 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44286
Jay Harris583f48922019-05-06 05:55:24287// File handling integration. https://crbug.com/829689
288const base::Feature kFileHandlingAPI{"FileHandlingAPI",
289 base::FEATURE_DISABLED_BY_DEFAULT};
290
kdillon66bf5b522019-01-02 22:08:30291// Allows for synchronous XHR requests during page dismissal
Katie Dillon8b357312019-09-19 13:23:23292const base::Feature kAllowSyncXHRInPageDismissal{
293 "AllowSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30294
Olivier Yiptongb60d2c42020-01-10 22:47:15295// Font enumeration and table access. https://crbug.com/535764 and
296// https://crbug.com/982054.
297const base::Feature kFontAccess{"FontAccess",
298 base::FEATURE_DISABLED_BY_DEFAULT};
299
Mason Freed6f146312020-06-27 05:12:55300// Allows Web Components v0 to be re-enabled.
301const base::Feature kWebComponentsV0{"WebComponentsV0",
302 base::FEATURE_DISABLED_BY_DEFAULT};
303
Dominic Farolino780df942019-09-04 06:49:44304// Prefetch request properties are updated to be privacy-preserving. See
305// crbug.com/988956.
306const base::Feature kPrefetchPrivacyChanges{"PrefetchPrivacyChanges",
307 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino693fd72d2019-08-05 11:09:44308
Carlos ILd3be52b2018-10-08 17:57:18309const char kMixedContentAutoupgradeModeParamName[] = "mode";
Carlos IL9970a942020-02-14 01:16:50310const char kMixedContentAutoupgradeModeAllPassive[] = "all-passive";
Carlos ILd3be52b2018-10-08 17:57:18311
Sasha McIntoshe889f9f2019-09-03 21:01:57312// Decodes jpeg 4:2:0 formatted images to YUV instead of RGBX and stores in this
313// format in the image decode cache. See crbug.com/919627 for details on the
314// feature.
Sasha McIntosh633b6312020-06-12 19:45:19315const base::Feature kDecodeJpeg420ImagesToYUV{
316 "DecodeJpeg420ImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
Sasha McIntoshe889f9f2019-09-03 21:01:57317
Madeleine Barowsky45be21a42018-12-07 18:39:30318// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
319// in the image decode cache. See crbug.com/900264 for details on the feature.
320const base::Feature kDecodeLossyWebPImagesToYUV{
Sasha McIntoshf670a6b2020-01-09 18:27:09321 "DecodeLossyWebPImagesToYUV", base::FEATURE_ENABLED_BY_DEFAULT};
Madeleine Barowsky45be21a42018-12-07 18:39:30322
Takashi Toyoshimaa91506d2019-03-28 05:44:42323// Enables cache-aware WebFonts loading. See https://crbug.com/570205.
324// The feature is disabled on Android for WebView API issue discussed at
325// https://crbug.com/942440.
326const base::Feature kWebFontsCacheAwareTimeoutAdaption {
327 "WebFontsCacheAwareTimeoutAdaption",
328#if defined(OS_ANDROID)
329 base::FEATURE_DISABLED_BY_DEFAULT
330#else
331 base::FEATURE_ENABLED_BY_DEFAULT
332#endif
333};
334
Ehsan Karamadbe95d122019-05-10 17:59:06335// Enabled to block programmatic focus in subframes when not triggered by user
336// activation (see htpps://crbug.com/954349).
337const base::Feature kBlockingFocusWithoutUserActivation{
338 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
339
Hongchan Choi370d3af2019-05-20 20:56:58340const base::Feature kAudioWorkletRealtimeThread{
341 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
342
Ryan Sturm139c3ac2019-07-12 18:52:53343// A feature to reduce the set of resources fetched by No-State Prefetch.
Robert Ogden2bb6a2522020-06-05 00:28:10344const base::Feature kLightweightNoStatePrefetch {
Ryan Sturmf223cb02019-10-04 18:02:00345 "LightweightNoStatePrefetch",
346#if defined(OS_ANDROID)
347 base::FEATURE_ENABLED_BY_DEFAULT
348#else
349 base::FEATURE_DISABLED_BY_DEFAULT
350#endif
351};
Ryan Sturm139c3ac2019-07-12 18:52:53352
Aran Gilman5e9672bed2019-08-02 19:07:49353// Automatically convert light-themed pages to use a Blink-generated dark theme
354const base::Feature kForceWebContentsDarkMode{
355 "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT};
356
Michael Crouseb7acd772020-02-20 02:56:26357// A feature to enable using the smallest image specified within image srcset
358// for users with Save Data enabled.
359const base::Feature kSaveDataImgSrcset{"SaveDataImgSrcset",
360 base::FEATURE_DISABLED_BY_DEFAULT};
361
Aran Gilman5e9672bed2019-08-02 19:07:49362// Which algorithm should be used for color inversion?
363const base::FeatureParam<ForceDarkInversionMethod>::Option
364 forcedark_inversion_method_options[] = {
365 {ForceDarkInversionMethod::kUseBlinkSettings,
366 "use_blink_settings_for_method"},
367 {ForceDarkInversionMethod::kHslBased, "hsl_based"},
Aran Gilman8b3ca41c2019-08-12 18:59:04368 {ForceDarkInversionMethod::kCielabBased, "cielab_based"},
369 {ForceDarkInversionMethod::kRgbBased, "rgb_based"}};
Aran Gilman5e9672bed2019-08-02 19:07:49370
371const base::FeatureParam<ForceDarkInversionMethod>
372 kForceDarkInversionMethodParam{&kForceWebContentsDarkMode,
373 "inversion_method",
374 ForceDarkInversionMethod::kUseBlinkSettings,
375 &forcedark_inversion_method_options};
376
377// Should images be inverted?
378const base::FeatureParam<ForceDarkImageBehavior>::Option
379 forcedark_image_behavior_options[] = {
380 {ForceDarkImageBehavior::kUseBlinkSettings,
381 "use_blink_settings_for_images"},
382 {ForceDarkImageBehavior::kInvertNone, "none"},
383 {ForceDarkImageBehavior::kInvertSelectively, "selective"}};
384
385const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{
386 &kForceWebContentsDarkMode, "image_behavior",
387 ForceDarkImageBehavior::kUseBlinkSettings,
388 &forcedark_image_behavior_options};
389
390// Do not invert text lighter than this.
391// Range: 0 (do not invert any text) to 256 (invert all text)
392// Can also set to -1 to let Blink's internal settings control the value
393const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{
394 &kForceWebContentsDarkMode, "text_lightness_threshold", -1};
395
396// Do not invert backgrounds darker than this.
397// Range: 0 (invert all backgrounds) to 256 (invert no backgrounds)
398// Can also set to -1 to let Blink's internal settings control the value
399const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{
400 &kForceWebContentsDarkMode, "background_lightness_threshold", -1};
401
Sergey Silkinc33244f2020-01-31 17:21:30402// Instructs WebRTC to honor the Min/Max Video Encode Accelerator dimensions.
Miguel Casas-Sanchezb6128392020-02-18 15:45:39403const base::Feature kWebRtcUseMinMaxVEADimensions {
404 "WebRtcUseMinMaxVEADimensions",
405 // TODO(crbug.com/1008491): enable other platforms.
406#if defined(OS_CHROMEOS)
407 base::FEATURE_ENABLED_BY_DEFAULT
408#else
409 base::FEATURE_DISABLED_BY_DEFAULT
410#endif
411};
Sergey Silkinc33244f2020-01-31 17:21:30412
Michael Lippautze670df9f2019-07-09 11:39:49413// Blink garbage collection.
414// Enables compaction of backing stores on Blink's heap.
415const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction",
416 base::FEATURE_ENABLED_BY_DEFAULT};
417// Enables concurrently marking Blink's heap.
418const base::Feature kBlinkHeapConcurrentMarking{
Omer Katz1757893c2020-02-17 12:09:19419 "BlinkHeapConcurrentMarking", base::FEATURE_ENABLED_BY_DEFAULT};
Anton Bikineev9b7b3722019-07-09 13:48:39420// Enables concurrently sweeping Blink's heap.
421const base::Feature kBlinkHeapConcurrentSweeping{
Anton Bikineev204cc752019-08-07 00:26:37422 "BlinkHeapConcurrentSweeping", base::FEATURE_ENABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49423// Enables incrementally marking Blink's heap.
424const base::Feature kBlinkHeapIncrementalMarking{
425 "BlinkHeapIncrementalMarking", base::FEATURE_ENABLED_BY_DEFAULT};
426// Enables a marking stress mode that schedules more garbage collections and
427// also adds additional verification passes.
428const base::Feature kBlinkHeapIncrementalMarkingStress{
429 "BlinkHeapIncrementalMarkingStress", base::FEATURE_DISABLED_BY_DEFAULT};
Michael Lippautze670df9f2019-07-09 11:39:49430
Yoav Weissddfb8d2e2019-07-15 22:34:03431// Enables removing AppCache delays when triggering requests when the HTML was
432// not fetched from AppCache.
433const base::Feature kVerifyHTMLFetchedFromAppCacheBeforeDelay{
434 "VerifyHTMLFetchedFromAppCacheBeforeDelay",
435 base::FEATURE_DISABLED_BY_DEFAULT};
436
Michael Spang8d2303e2019-07-26 01:56:32437// Controls whether we use ThreadPriority::DISPLAY for renderer
438// compositor & IO threads.
439const base::Feature kBlinkCompositorUseDisplayThreadPriority {
440 "BlinkCompositorUseDisplayThreadPriority",
Sunny Sachanandani16944252019-12-04 03:40:49441#if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_WIN)
Michael Spang8d2303e2019-07-26 01:56:32442 base::FEATURE_ENABLED_BY_DEFAULT
443#else
444 base::FEATURE_DISABLED_BY_DEFAULT
445#endif
446};
447
Yuki Shiinoa812f492019-08-23 06:47:46448// Ignores cross origin windows in the named property interceptor of Window.
449// https://crbug.com/538562
450const base::Feature kIgnoreCrossOriginWindowWhenNamedAccessOnWindow{
451 "IgnoreCrossOriginWindowWhenNamedAccessOnWindow",
452 base::FEATURE_DISABLED_BY_DEFAULT};
453
Tarun Bansal38792462019-09-04 16:08:11454// When enabled, loading priority of JavaScript requests is lowered when they
455// are force deferred by the intervention.
456const base::Feature kLowerJavaScriptPriorityWhenForceDeferred{
457 "LowerJavaScriptPriorityWhenForceDeferred",
Tarun Bansal755268fe2019-10-18 18:57:40458 base::FEATURE_DISABLED_BY_DEFAULT};
Tarun Bansal38792462019-09-04 16:08:11459
Tarun Bansalf32aaa22020-02-12 16:16:44460// When enabled, scripts in iframes are not force deferred by the DeferAllScript
461// intervention.
462const base::Feature kDisableForceDeferInChildFrames{
463 "DisableForceDeferInChildFrames", base::FEATURE_DISABLED_BY_DEFAULT};
464
rajendrantd5db55f2019-10-19 01:56:59465// Enables redirecting subresources in the page to better compressed and
466// optimized versions to provide data savings.
467const base::Feature kSubresourceRedirect{"SubresourceRedirect",
468 base::FEATURE_DISABLED_BY_DEFAULT};
469
Stefan Zagerfd18161c2019-10-22 20:44:31470// When 'enabled', all cross-origin iframes will get a compositing layer.
471const base::Feature kCompositeCrossOriginIframes{
472 "CompositeCrossOriginIframes", base::FEATURE_DISABLED_BY_DEFAULT};
Yutaka Hirano0b3c319b2019-10-25 17:19:15473
Chris Harrelson70be13d2020-06-03 21:06:52474// When enabled, enforces new interoperable semantics for 3D transforms.
475// See crbug.com/1008483.
476const base::Feature kTransformInterop{"TransformInterop",
477 base::FEATURE_DISABLED_BY_DEFAULT};
478
Yutaka Hirano0b3c319b2019-10-25 17:19:15479// When enabled, beacons (and friends) have ResourceLoadPriority::kLow,
480// not ResourceLoadPriority::kVeryLow.
481const base::Feature kSetLowPriorityForBeacon{"SetLowPriorityForBeacon",
482 base::FEATURE_DISABLED_BY_DEFAULT};
483
Ben Kelly776f59d2019-11-06 16:25:30484// When enabled allows the header name used in the blink
485// CacheStorageCodeCacheHint runtime feature to be modified. This runtime
486// feature disables generating full code cache for responses stored in
487// cache_storage during a service worker install event. The runtime feature
488// must be enabled via the blink runtime feature mechanism, however.
489const base::Feature kCacheStorageCodeCacheHintHeader{
490 "CacheStorageCodeCacheHintHeader", base::FEATURE_DISABLED_BY_DEFAULT};
491const base::FeatureParam<std::string> kCacheStorageCodeCacheHintHeaderName{
492 &kCacheStorageCodeCacheHintHeader, "name", "x-CacheStorageCodeCacheHint"};
493
Francois Doray563453432019-11-20 15:32:17494// When enabled, the beforeunload handler is dispatched when a frame is frozen.
495// This allows the browser to know whether discarding the frame could result in
496// lost user data, at the cost of extra CPU usage. The feature will be removed
497// once we have determine whether the CPU cost is acceptable.
498const base::Feature kDispatchBeforeUnloadOnFreeze{
499 "DispatchBeforeUnloadOnFreeze", base::FEATURE_ENABLED_BY_DEFAULT};
500
Sunny Sachanandani26463422019-12-05 21:35:40501// Enables the use of GpuMemoryBuffer images for low latency 2d canvas.
502// TODO(khushalsagar): Enable this if we're using SurfaceControl and GMBs allow
503// us to overlay these resources.
504const base::Feature kLowLatencyCanvas2dImageChromium {
505 "LowLatencyCanvas2dImageChromium",
506#if defined(OS_CHROMEOS)
507 base::FEATURE_ENABLED_BY_DEFAULT
508#else
509 base::FEATURE_DISABLED_BY_DEFAULT
510#endif // OS_CHROMEOS
511};
512
513// Enables the use of shared image swap chains for low latency 2d canvas.
514const base::Feature kLowLatencyCanvas2dSwapChain{
Sunny Sachanandanib954dc7c2019-12-12 02:50:51515 "LowLatencyCanvas2dSwapChain", base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40516
517// Enables the use of shared image swap chains for low latency webgl canvas.
Sunny Sachanandanib954dc7c2019-12-12 02:50:51518const base::Feature kLowLatencyWebGLSwapChain{"LowLatencyWebGLSwapChain",
519 base::FEATURE_ENABLED_BY_DEFAULT};
Sunny Sachanandani26463422019-12-05 21:35:40520
Stephen Whitee17b0232020-04-27 23:48:49521// Enables Dawn-accelerated 2D canvas.
522const base::Feature kDawn2dCanvas{"Dawn2dCanvas",
523 base::FEATURE_DISABLED_BY_DEFAULT};
524
Xiaocheng Hud5197fd2020-02-06 07:26:08525const base::Feature kCSSReducedFontLoadingInvalidations{
Xiaocheng Hu75bafe52020-06-22 22:54:27526 "CSSReducedFontLoadingInvalidations", base::FEATURE_ENABLED_BY_DEFAULT};
Xiaocheng Hue5ff8e12020-06-16 21:47:35527const base::Feature kCSSReducedFontLoadingLayoutInvalidations{
528 "CSSReducedFontLoadingLayoutInvalidations",
529 base::FEATURE_DISABLED_BY_DEFAULT};
Xiaocheng Hud5197fd2020-02-06 07:26:08530
Egor Pasko28ec46952020-02-07 15:17:57531// When enabled, frees up CachedMetadata after consumption by script resources
532// and modules. Needed for the experiment in http://crbug.com/1045052.
533const base::Feature kDiscardCodeCacheAfterFirstUse{
534 "DiscardCodeCacheAfterFirstUse", base::FEATURE_DISABLED_BY_DEFAULT};
535
Yutaka Hiranobf410a42020-02-18 08:08:45536// The kill-switch for the fix for https://crbug.com/1051439.
537// TODO(crbug.com/1053369): Remove this around M84.
538const base::Feature kSuppressContentTypeForBeaconMadeWithArrayBufferView{
539 "SuppressContentTypeForBeaconMadeWithArrayBufferView",
540 base::FEATURE_ENABLED_BY_DEFAULT};
541
Ian Kilpatrickef7f4382020-06-02 12:38:10542const base::Feature kBlockFlowHandlesWebkitLineClamp{
Ian Kilpatrickbdec8902020-06-02 12:46:09543 "BlockFlowHandlesWebkitLineClamp", base::FEATURE_ENABLED_BY_DEFAULT};
Ian Kilpatrickef7f4382020-06-02 12:38:10544
Rune Lillesveen61f49ee2020-03-02 07:53:49545const base::Feature kBlockHTMLParserOnStyleSheets{
546 "BlockHTMLParserOnStyleSheets", base::FEATURE_DISABLED_BY_DEFAULT};
547
Mason Freed0ebaa772020-06-03 16:11:08548// Kill switch for the new <link disabled> behavior.
549// TODO(crbug.com/1087043): Remove this once the feature has
550// landed and no compat issues are reported.
551const base::Feature kLinkDisabledNewSpecBehavior{
552 "LinkDisabledNewSpecBehavior", base::FEATURE_ENABLED_BY_DEFAULT};
553
Xiaocheng Hud2e807d2020-03-04 21:15:21554// Slightly delays rendering if there are fonts being preloaded, so that
555// they don't miss the first paint if they can be loaded fast enough (e.g.,
556// from the disk cache)
557const base::Feature kFontPreloadingDelaysRendering{
Xiaocheng Hue60457d2020-07-20 06:09:54558 "FontPreloadingDelaysRendering", base::FEATURE_ENABLED_BY_DEFAULT};
559// 50ms is the overall best performing value in our experiments.
Xiaocheng Hud2e807d2020-03-04 21:15:21560const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{
Xiaocheng Hue60457d2020-07-20 06:09:54561 &kFontPreloadingDelaysRendering, "delay-in-ms", 50};
Xiaocheng Hud2e807d2020-03-04 21:15:21562
David Grogan565f8bb2020-05-27 03:07:40563const base::Feature kFlexNG{"FlexNG", base::FEATURE_ENABLED_BY_DEFAULT};
David Grogan5b3cf162020-03-19 21:53:15564
Dominic Farolino0f55a082020-03-24 09:47:55565const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
566 base::FEATURE_DISABLED_BY_DEFAULT};
Dominic Farolino7d3d6f12020-06-10 21:59:46567const base::Feature kDelayAsyncScriptExecution{
568 "DelayAsyncScriptExecution", base::FEATURE_DISABLED_BY_DEFAULT};
569const base::FeatureParam<DelayAsyncScriptDelayType>::Option
570 delay_async_script_execution_delay_types[] = {
571 {DelayAsyncScriptDelayType::kFinishedParsing, "finished_parsing"},
572 {DelayAsyncScriptDelayType::kFirstPaintOrFinishedParsing,
Dominic Farolino53270852020-08-06 22:28:00573 "first_paint_or_finished_parsing"},
574 {DelayAsyncScriptDelayType::kUseOptimizationGuide,
575 "use_optimization_guide"}};
Dominic Farolino7d3d6f12020-06-10 21:59:46576const base::FeatureParam<DelayAsyncScriptDelayType>
577 kDelayAsyncScriptExecutionDelayParam{
578 &kDelayAsyncScriptExecution, "delay_type",
579 DelayAsyncScriptDelayType::kFinishedParsing,
580 &delay_async_script_execution_delay_types};
Dominic Farolino0f55a082020-03-24 09:47:55581
Adrienne Walkerb53b4372020-05-06 18:57:18582// The AppCache feature is a kill-switch for the entire AppCache feature,
583// both backend and API. If disabled, then it will turn off the backend and
584// api, regardless of the presence of valid origin trial tokens.
Adrienne Walkere6b51722020-04-01 17:56:38585const base::Feature kAppCache{"AppCache", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkerb53b4372020-05-06 18:57:18586// If AppCacheRequireOriginTrial is enabled, then the AppCache backend in the
587// browser will require origin trial tokens in order to load or store manifests
588// and their contents.
589const base::Feature kAppCacheRequireOriginTrial{
Adrienne Walkerdd9442e02020-06-10 16:23:40590 "AppCacheRequireOriginTrial", base::FEATURE_ENABLED_BY_DEFAULT};
Adrienne Walkere6b51722020-04-01 17:56:38591
Wan-Teh Chang75fd5322020-04-08 01:32:18592// Enables the AV1 Image File Format (AVIF).
Wan-Teh Changb9d67a12020-06-26 01:19:13593const base::Feature kAVIF{"AVIF", base::FEATURE_ENABLED_BY_DEFAULT};
Wan-Teh Chang75fd5322020-04-08 01:32:18594
Xiaocheng Hu66795f02020-04-25 00:26:47595// Make all pending 'display: auto' web fonts enter the swap or failure period
Xiaocheng Hu9e2055c2020-04-09 20:35:28596// immediately before reaching the LCP time limit (~2500ms), so that web fonts
597// do not become a source of bad LCP.
598const base::Feature kAlignFontDisplayAutoTimeoutWithLCPGoal{
599 "AlignFontDisplayAutoTimeoutWithLCPGoal",
600 base::FEATURE_DISABLED_BY_DEFAULT};
601
Xiaocheng Hu66795f02020-04-25 00:26:47602// The amount of time allowed for 'display: auto' web fonts to load without
603// intervention, counted from navigation start.
604const base::FeatureParam<int>
605 kAlignFontDisplayAutoTimeoutWithLCPGoalTimeoutParam{
606 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "lcp-limit-in-ms", 2000};
607
608const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>::Option
609 align_font_display_auto_timeout_with_lcp_goal_modes[] = {
610 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
611 "failure"},
612 {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, "swap"}};
613const base::FeatureParam<AlignFontDisplayAutoTimeoutWithLCPGoalMode>
614 kAlignFontDisplayAutoTimeoutWithLCPGoalModeParam{
615 &kAlignFontDisplayAutoTimeoutWithLCPGoal, "intervention-mode",
616 AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod,
617 &align_font_display_auto_timeout_with_lcp_goal_modes};
Xiaocheng Hu9e2055c2020-04-09 20:35:28618
Ben Kellyd52869b2020-04-20 17:17:43619// Enable throttling of fetch() requests from service workers in the
620// installing state.
621const base::Feature kThrottleInstallingServiceWorker{
622 "ThrottleInstallingServiceWorker", base::FEATURE_DISABLED_BY_DEFAULT};
623const base::FeatureParam<int> kInstallingServiceWorkerOutstandingThrottledLimit{
624 &kThrottleInstallingServiceWorker, "limit", 5};
625
Dave Tapuska95b71c82020-06-08 16:56:11626const base::Feature kInputPredictorTypeChoice{
627 "InputPredictorTypeChoice", base::FEATURE_DISABLED_BY_DEFAULT};
628
629const base::Feature kResamplingInputEvents{"ResamplingInputEvents",
630 base::FEATURE_DISABLED_BY_DEFAULT};
631
Dave Tapuskafea88942020-05-05 18:50:32632const base::Feature kResamplingScrollEvents{"ResamplingScrollEvents",
633 base::FEATURE_ENABLED_BY_DEFAULT};
634
Yoav Weiss200214d52020-05-13 23:58:42635// Enables the device-memory, resource-width, viewport-width and DPR client
636// hints to be sent to third-party origins if the first-party has opted in to
637// receiving client hints, regardless of Feature Policy.
638#if defined(OS_ANDROID)
639const base::Feature kAllowClientHintsToThirdParty{
640 "AllowClientHintsToThirdParty", base::FEATURE_ENABLED_BY_DEFAULT};
641#else
642const base::Feature kAllowClientHintsToThirdParty{
643 "AllowClientHintsToThirdParty", base::FEATURE_DISABLED_BY_DEFAULT};
644#endif
645
Dave Tapuskafea88942020-05-05 18:50:32646const base::Feature kFilteringScrollPrediction{
647 "FilteringScrollPrediction", base::FEATURE_DISABLED_BY_DEFAULT};
648
Dave Tapuskafea88942020-05-05 18:50:32649const base::Feature kKalmanHeuristics{"KalmanHeuristics",
650 base::FEATURE_DISABLED_BY_DEFAULT};
651
652const base::Feature kKalmanDirectionCutOff{"KalmanDirectionCutOff",
653 base::FEATURE_DISABLED_BY_DEFAULT};
654
655const base::Feature kSkipTouchEventFilter{"SkipTouchEventFilter",
656 base::FEATURE_ENABLED_BY_DEFAULT};
657const char kSkipTouchEventFilterTypeParamName[] = "type";
658const char kSkipTouchEventFilterTypeParamValueDiscrete[] = "discrete";
659const char kSkipTouchEventFilterTypeParamValueAll[] = "all";
660const char kSkipTouchEventFilterFilteringProcessParamName[] =
661 "skip_filtering_process";
662const char kSkipTouchEventFilterFilteringProcessParamValueBrowser[] = "browser";
663const char kSkipTouchEventFilterFilteringProcessParamValueBrowserAndRenderer[] =
664 "browser_and_renderer";
665
Patrick To2afc1162020-06-03 18:19:30666// Improves support for WebXR on computers with multiple GPUs.
667const base::Feature kWebXrMultiGpu{"WebXRMultiGpu",
668 base::FEATURE_DISABLED_BY_DEFAULT};
669
Anders Hartvoll Ruud80f8818812020-06-09 08:07:31670// Enables dependency support in blink::MatchedPropertiesCache, which allows
671// caching of previously uncachable objects.
672const base::Feature kCSSMatchedPropertiesCacheDependencies{
673 "CSSMatchedPropertiesCacheDependencies", base::FEATURE_DISABLED_BY_DEFAULT};
674
Benoit Lize66684b22020-08-07 12:30:22675// Disabling this will cause parkable strings to never be compressed.
676// This is useful for headless mode + virtual time. Since virtual time advances
677// quickly, strings may be parked too eagerly in that mode.
678const base::Feature kCompressParkableStrings{"CompressParkableStrings",
679 base::FEATURE_ENABLED_BY_DEFAULT};
680
Benoit Lize04cbcd9d2020-06-18 09:44:27681// Whether ParkableStrings can be written out to disk.
Benoit Lize66684b22020-08-07 12:30:22682// Depends on compression above.
Benoit Lize04cbcd9d2020-06-18 09:44:27683const base::Feature kParkableStringsToDisk{"ParkableStringsToDisk",
684 base::FEATURE_DISABLED_BY_DEFAULT};
685
Benoit Lize66684b22020-08-07 12:30:22686bool IsParkableStringsToDiskEnabled() {
687 return base::FeatureList::IsEnabled(kParkableStringsToDisk) &&
688 base::FeatureList::IsEnabled(kCompressParkableStrings);
689}
690
Matt Falkenhagen5cc652792018-06-21 10:34:33691} // namespace features
692} // namespace blink