Matt Falkenhagen | 5cc65279 | 2018-06-21 10:34:33 | [diff] [blame] | 1 | // 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 Gilman | 5e9672bed | 2019-08-02 19:07:49 | [diff] [blame] | 7 | #include "base/feature_list.h" |
Scott Haseley | 8eefdcd | 2018-08-22 16:50:19 | [diff] [blame] | 8 | #include "build/build_config.h" |
Hiroki Nakagawa | 893ee50 | 2019-02-04 06:49:53 | [diff] [blame] | 9 | #include "services/network/public/cpp/features.h" |
Aran Gilman | 5e9672bed | 2019-08-02 19:07:49 | [diff] [blame] | 10 | #include "third_party/blink/public/common/forcedark/forcedark_switches.h" |
Scott Haseley | 8eefdcd | 2018-08-22 16:50:19 | [diff] [blame] | 11 | |
Matt Falkenhagen | 5cc65279 | 2018-06-21 10:34:33 | [diff] [blame] | 12 | namespace blink { |
| 13 | namespace features { |
| 14 | |
Yao Xiao | 2c1171a | 2019-04-01 23:44:32 | [diff] [blame] | 15 | // Enable intervention for download that was initiated from or occurred in an ad |
| 16 | // frame without user activation. |
| 17 | const base::Feature kBlockingDownloadsInAdFrameWithoutUserActivation{ |
| 18 | "BlockingDownloadsInAdFrameWithoutUserActivation", |
Yao Xiao | 3f9e427 | 2019-05-23 15:22:46 | [diff] [blame] | 19 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Yao Xiao | 2c1171a | 2019-04-01 23:44:32 | [diff] [blame] | 20 | |
Stephen Chenney | de6e5c8 | 2019-01-21 01:56:04 | [diff] [blame] | 21 | // Enable defer commits a bit to avoid flash. |
| 22 | const base::Feature kAvoidFlashBetweenNavigation{ |
Stephen Chenney | ebb056b | 2019-09-06 11:58:02 | [diff] [blame] | 23 | "AvoidFlashBetweenNavigation", base::FEATURE_ENABLED_BY_DEFAULT}; |
Stephen Chenney | de6e5c8 | 2019-01-21 01:56:04 | [diff] [blame] | 24 | |
Matt Falkenhagen | c25fea4 | 2018-07-17 07:13:52 | [diff] [blame] | 25 | // Enable eagerly setting up a CacheStorage interface pointer and |
| 26 | // passing it to service workers on startup as an optimization. |
| 27 | const base::Feature kEagerCacheStorageSetupForServiceWorkers{ |
| 28 | "EagerCacheStorageSetupForServiceWorkers", |
| 29 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 30 | |
Peter Kvitek | 197eaf7 | 2018-12-04 19:14:56 | [diff] [blame] | 31 | // Controls script streaming. |
| 32 | const base::Feature kScriptStreaming{"ScriptStreaming", |
| 33 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 34 | |
Leszek Swirski | f75c191 | 2019-05-29 10:08:25 | [diff] [blame] | 35 | // Allow streaming small (<30kB) scripts. |
| 36 | const base::Feature kSmallScriptStreaming{"SmallScriptStreaming", |
| 37 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 38 | |
Keishi Hattori | 9e10692 | 2019-04-15 09:06:03 | [diff] [blame] | 39 | // Enables user level memory pressure signal generation on Android. |
| 40 | const base::Feature kUserLevelMemoryPressureSignal{ |
| 41 | "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 42 | |
Aditya Keerthi | 6a93390 | 2019-03-14 21:09:27 | [diff] [blame] | 43 | // Perform memory purges after freezing only if all pages are frozen. |
| 44 | const base::Feature kFreezePurgeMemoryAllPagesFrozen{ |
| 45 | "FreezePurgeMemoryAllPagesFrozen", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 46 | |
John Delaney | ac24e57 | 2019-04-30 19:47:02 | [diff] [blame] | 47 | // Freezes the user-agent as part of https://github.com/WICG/ua-client-hints. |
| 48 | const base::Feature kFreezeUserAgent{"FreezeUserAgent", |
| 49 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 50 | |
Mason Freed | c166cf1 | 2019-06-14 19:04:26 | [diff] [blame] | 51 | // Enable a new CSS property called backdrop-filter. |
Mason Freed | 34663f4 | 2019-09-06 22:40:05 | [diff] [blame] | 52 | const base::Feature kCSSBackdropFilter{"CSSBackdropFilter", |
| 53 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Mason Freed | c166cf1 | 2019-06-14 19:04:26 | [diff] [blame] | 54 | |
Vladimir Levin | 43758ecc | 2019-05-09 18:04:03 | [diff] [blame] | 55 | // Enable Display Locking JavaScript APIs. |
| 56 | const base::Feature kDisplayLocking{"DisplayLocking", |
| 57 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 58 | |
Chris Harrelson | 6e41e3ae | 2019-05-03 23:09:40 | [diff] [blame] | 59 | // Enable applying rounded corner masks via a GL shader rather than |
| 60 | // a mask layer. |
Chris Harrelson | 3f7e3611 | 2019-08-21 19:15:48 | [diff] [blame] | 61 | const base::Feature kFastBorderRadius { |
| 62 | "FastBorderRadius", |
Chris Harrelson | 3f7e3611 | 2019-08-21 19:15:48 | [diff] [blame] | 63 | base::FEATURE_ENABLED_BY_DEFAULT |
Chris Harrelson | 3f7e3611 | 2019-08-21 19:15:48 | [diff] [blame] | 64 | }; |
Chris Harrelson | 6e41e3ae | 2019-05-03 23:09:40 | [diff] [blame] | 65 | |
Ian Kilpatrick | e68ef11a | 2018-07-04 03:52:10 | [diff] [blame] | 66 | // Enable LayoutNG. |
Emil A Eklund | 69eeb56 | 2019-07-03 01:38:30 | [diff] [blame] | 67 | const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_ENABLED_BY_DEFAULT}; |
Ian Kilpatrick | e68ef11a | 2018-07-04 03:52:10 | [diff] [blame] | 68 | |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 69 | const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent", |
| 70 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 71 | |
Tarun Bansal | 422f901 | 2019-01-23 16:55:58 | [diff] [blame] | 72 | // Used to control the collection of anchor element metrics (crbug.com/856683). |
| 73 | // If kNavigationPredictor is enabled, then metrics of anchor elements |
| 74 | // in the first viewport after the page load and the metrics of the clicked |
| 75 | // anchor element will be extracted and recorded. Additionally, navigation |
| 76 | // predictor may preconnect/prefetch to resources/origins to make the |
| 77 | // future navigations faster. |
Sofiya Semenova | e4e07615 | 2019-07-29 20:10:27 | [diff] [blame] | 78 | const base::Feature kNavigationPredictor { |
| 79 | "NavigationPredictor", |
| 80 | #if defined(OS_ANDROID) |
| 81 | base::FEATURE_ENABLED_BY_DEFAULT |
| 82 | #else |
| 83 | base::FEATURE_DISABLED_BY_DEFAULT |
| 84 | #endif |
| 85 | }; |
Tarun Bansal | 422f901 | 2019-01-23 16:55:58 | [diff] [blame] | 86 | |
Kenichi Ishibashi | 0b9b91b | 2019-08-29 01:01:09 | [diff] [blame] | 87 | // Start service workers on a background thread. |
Kenichi Ishibashi | 27bdc95 | 2019-08-16 03:16:30 | [diff] [blame] | 88 | // https://crbug.com/692909 |
| 89 | const base::Feature kOffMainThreadServiceWorkerStartup{ |
Kenichi Ishibashi | 083ed48 | 2019-09-05 23:50:15 | [diff] [blame] | 90 | "OffMainThreadServiceWorkerStartup", base::FEATURE_ENABLED_BY_DEFAULT}; |
Kenichi Ishibashi | 27bdc95 | 2019-08-16 03:16:30 | [diff] [blame] | 91 | |
Hiroki Nakagawa | 61ee004 | 2019-01-22 06:30:26 | [diff] [blame] | 92 | // Enable browser-initiated dedicated worker script loading |
| 93 | // (PlzDedicatedWorker). https://crbug.com/906991 |
| 94 | const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker", |
| 95 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 96 | |
Daniel Murphy | 95792ef | 2018-10-04 01:29:55 | [diff] [blame] | 97 | // Enable Portals. https://crbug.com/865123. |
| 98 | const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 99 | |
Tarun Bansal | 8df12b5 | 2019-02-15 05:46:30 | [diff] [blame] | 100 | // Enable limiting previews loading hints to specific resource types. |
| 101 | const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{ |
| 102 | "PreviewsResourceLoadingHintsSpecificResourceTypes", |
| 103 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 104 | |
Aditya Keerthi | e84331b3 | 2019-03-20 15:25:52 | [diff] [blame] | 105 | // Perform a memory purge after a renderer is backgrounded. Formerly labelled as |
| 106 | // the "PurgeAndSuspend" experiment. |
| 107 | // |
| 108 | // TODO(adityakeerthi): Disabled by default on Mac and Android for historical |
| 109 | // reasons. Consider enabling by default if experiment results are positive. |
| 110 | // https://crbug.com/926186 |
| 111 | const base::Feature kPurgeRendererMemoryWhenBackgrounded { |
| 112 | "PurgeRendererMemoryWhenBackgrounded", |
| 113 | #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 114 | base::FEATURE_DISABLED_BY_DEFAULT |
| 115 | #else |
| 116 | base::FEATURE_ENABLED_BY_DEFAULT |
| 117 | #endif |
| 118 | }; |
| 119 | |
David Bokan | 911bded | 2018-11-27 23:23:32 | [diff] [blame] | 120 | // Enable Implicit Root Scroller. https://crbug.com/903260. |
David Bokan | 145b547 | 2019-05-22 14:38:44 | [diff] [blame] | 121 | // TODO(bokan): Temporarily disabled on desktop platforms to address issues |
| 122 | // with non-overlay scrollbars. https://crbug.com/948059. |
| 123 | const base::Feature kImplicitRootScroller { |
| 124 | "ImplicitRootScroller", |
| 125 | #if defined(OS_ANDROID) |
| 126 | base::FEATURE_ENABLED_BY_DEFAULT |
| 127 | #else |
| 128 | base::FEATURE_DISABLED_BY_DEFAULT |
| 129 | #endif |
| 130 | }; |
David Bokan | 911bded | 2018-11-27 23:23:32 | [diff] [blame] | 131 | |
Cathie Chen | eac7060 | 2019-10-10 02:55:29 | [diff] [blame^] | 132 | // Enable CSSOM View Scroll Coordinates. https://crbug.com/721759. |
| 133 | const base::Feature kCSSOMViewScrollCoordinates{ |
| 134 | "CSSOMViewScrollCoordinates", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 135 | |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 136 | // Enables usage of getDisplayMedia() that allows capture of web content, see |
| 137 | // https://crbug.com/865060. |
| 138 | const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia", |
| 139 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 140 | |
| 141 | // Changes the default RTCPeerConnection constructor behavior to use Unified |
| 142 | // Plan as the SDP semantics. When the feature is enabled, Unified Plan is used |
| 143 | // unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the |
| 144 | // argument). |
| 145 | const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault", |
Henrik Boström | 07021ec8 | 2019-01-17 22:23:56 | [diff] [blame] | 146 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 147 | |
Johannes Kron | ad5a453 | 2019-01-09 11:17:46 | [diff] [blame] | 148 | // Determines if the SDP attrbute extmap-allow-mixed should be offered by |
| 149 | // default or not. The default value can be overridden by passing |
| 150 | // {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection |
| 151 | // constructor. |
| 152 | const base::Feature kRTCOfferExtmapAllowMixed{ |
| 153 | "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 154 | |
Antonio Gomes | 76a8ec6 | 2019-09-03 23:20:17 | [diff] [blame] | 155 | // Enables HW VP8 encoding on Android. |
| 156 | const base::Feature kWebRtcHWVP8Encoding { |
| 157 | "WebRtcHWVP8Encoding", |
| 158 | #if defined(OS_ANDROID) |
| 159 | base::FEATURE_DISABLED_BY_DEFAULT |
| 160 | #else |
| 161 | base::FEATURE_ENABLED_BY_DEFAULT |
| 162 | #endif |
| 163 | }; |
| 164 | |
| 165 | // Enables HW VP9 encoding on Android. |
| 166 | const base::Feature kWebRtcHWVP9Encoding { |
| 167 | "WebRtcHWVP9Encoding", |
| 168 | #if defined(OS_ANDROID) |
| 169 | base::FEATURE_DISABLED_BY_DEFAULT |
| 170 | #else |
| 171 | base::FEATURE_DISABLED_BY_DEFAULT |
| 172 | #endif |
| 173 | }; |
| 174 | |
| 175 | // Enables HW H264 encoding on Android. |
| 176 | const base::Feature kWebRtcHWH264Encoding{"WebRtcHWH264Encoding", |
| 177 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 178 | |
Antonio Gomes | b471857 | 2019-09-11 02:55:48 | [diff] [blame] | 179 | // Enables negotiation of experimental multiplex codec in SDP. |
| 180 | const base::Feature kWebRtcMultiplexCodec{"WebRTC-MultiplexCodec", |
| 181 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 182 | |
| 183 | // Causes WebRTC to replace host ICE candidate IP addresses with generated |
| 184 | // names ending in ".local" and resolve them using mDNS. |
| 185 | // http://crbug.com/878465 |
| 186 | const base::Feature kWebRtcHideLocalIpsWithMdns{ |
| 187 | "WebRtcHideLocalIpsWithMdns", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 188 | |
Antonio Gomes | f3bcd51 | 2019-09-03 21:27:17 | [diff] [blame] | 189 | #if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) |
| 190 | // Run-time feature for the |rtc_use_h264| encoder/decoder. |
| 191 | const base::Feature kWebRtcH264WithOpenH264FFmpeg{ |
| 192 | "WebRTC-H264WithOpenH264FFmpeg", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 193 | #endif // BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) |
| 194 | |
momohatt | fc35229 | 2018-08-29 05:12:36 | [diff] [blame] | 195 | const base::Feature kServiceWorkerImportedScriptUpdateCheck{ |
Makoto Shimazu | b9067eb0 | 2019-08-18 23:42:53 | [diff] [blame] | 196 | "ServiceWorkerImportedScriptUpdateCheck", base::FEATURE_ENABLED_BY_DEFAULT}; |
momohatt | fc35229 | 2018-08-29 05:12:36 | [diff] [blame] | 197 | |
Makoto Shimazu | a8b3d74 | 2019-04-05 06:55:51 | [diff] [blame] | 198 | // Experiment of the delay from navigation to starting an update of a service |
| 199 | // worker's script. |
| 200 | const base::Feature kServiceWorkerUpdateDelay{ |
| 201 | "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 202 | |
Scott Haseley | 8eefdcd | 2018-08-22 16:50:19 | [diff] [blame] | 203 | // Freeze scheduler task queues in background after allowed grace time. |
| 204 | // "stop" is a legacy name. |
| 205 | const base::Feature kStopInBackground { |
| 206 | "stop-in-background", |
| 207 | #if defined(OS_ANDROID) |
| 208 | base::FEATURE_ENABLED_BY_DEFAULT |
| 209 | #else |
| 210 | base::FEATURE_DISABLED_BY_DEFAULT |
| 211 | #endif |
| 212 | }; |
| 213 | |
Takashi Sakamoto | c19fc2b | 2019-04-10 06:30:52 | [diff] [blame] | 214 | // Freeze scheduler task queues in background on network idle. |
| 215 | // This feature only works if stop-in-background is enabled. |
| 216 | const base::Feature kFreezeBackgroundTabOnNetworkIdle{ |
| 217 | "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 218 | |
Shubhie Panicker | 60bd4b0 | 2018-09-26 00:02:15 | [diff] [blame] | 219 | // Freeze non-timer task queues in background, after allowed grace time. |
| 220 | // "stop" is a legacy name. |
Dave Tapuska | 9140c55 | 2019-05-30 16:18:56 | [diff] [blame] | 221 | const base::Feature kStopNonTimersInBackground{ |
| 222 | "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT}; |
Scott Haseley | 7757f6c | 2018-08-03 14:33:23 | [diff] [blame] | 223 | |
Brandon Maslen | da12cf8 | 2019-08-23 20:54:18 | [diff] [blame] | 224 | // Enable the Storage Access API. https://crbug.com/989663. |
| 225 | const base::Feature kStorageAccessAPI{"StorageAccessAPI", |
| 226 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 227 | |
David Bokan | e9370c2 | 2019-02-14 15:19:58 | [diff] [blame] | 228 | // Enable text snippets in URL fragments. https://crbug.com/919204. |
| 229 | const base::Feature kTextFragmentAnchor{"TextFragmentAnchor", |
| 230 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 231 | |
Bill Budge | 4d028f1 | 2018-11-20 15:05:12 | [diff] [blame] | 232 | // Enables the site isolated Wasm code cache that is keyed on the resource URL |
| 233 | // and the origin lock of the renderer that is requesting the resource. When |
| 234 | // this flag is enabled, content/GeneratedCodeCache handles code cache requests. |
| 235 | const base::Feature kWasmCodeCache = {"WasmCodeCache", |
| 236 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 237 | |
Marijn Kruisselbrink | ca4bb5e | 2019-04-22 18:19:42 | [diff] [blame] | 238 | // Writable files and native file system access. https://crbug.com/853326 |
| 239 | const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI", |
Marijn Kruisselbrink | 4cc3ec2 | 2019-09-04 16:28:20 | [diff] [blame] | 240 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 241 | |
Jay Harris | 583f4892 | 2019-05-06 05:55:24 | [diff] [blame] | 242 | // File handling integration. https://crbug.com/829689 |
| 243 | const base::Feature kFileHandlingAPI{"FileHandlingAPI", |
| 244 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 245 | |
kdillon | 66bf5b52 | 2019-01-02 22:08:30 | [diff] [blame] | 246 | // Allows for synchronous XHR requests during page dismissal |
Katie Dillon | 8b35731 | 2019-09-19 13:23:23 | [diff] [blame] | 247 | const base::Feature kAllowSyncXHRInPageDismissal{ |
| 248 | "AllowSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT}; |
kdillon | 66bf5b52 | 2019-01-02 22:08:30 | [diff] [blame] | 249 | |
Dominic Farolino | 780df94 | 2019-09-04 06:49:44 | [diff] [blame] | 250 | // Prefetch request properties are updated to be privacy-preserving. See |
| 251 | // crbug.com/988956. |
| 252 | const base::Feature kPrefetchPrivacyChanges{"PrefetchPrivacyChanges", |
| 253 | base::FEATURE_DISABLED_BY_DEFAULT}; |
Dominic Farolino | 693fd72d | 2019-08-05 11:09:44 | [diff] [blame] | 254 | |
Carlos IL | d3be52b | 2018-10-08 17:57:18 | [diff] [blame] | 255 | const char kMixedContentAutoupgradeModeParamName[] = "mode"; |
| 256 | const char kMixedContentAutoupgradeModeBlockable[] = "blockable"; |
| 257 | const char kMixedContentAutoupgradeModeOptionallyBlockable[] = |
| 258 | "optionally-blockable"; |
| 259 | |
Sasha McIntosh | e889f9f | 2019-09-03 21:01:57 | [diff] [blame] | 260 | // Decodes jpeg 4:2:0 formatted images to YUV instead of RGBX and stores in this |
| 261 | // format in the image decode cache. See crbug.com/919627 for details on the |
| 262 | // feature. |
| 263 | const base::Feature kDecodeJpeg420ImagesToYUV{ |
| 264 | "DecodeJpeg420ImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 265 | |
Madeleine Barowsky | 45be21a4 | 2018-12-07 18:39:30 | [diff] [blame] | 266 | // Decodes lossy WebP images to YUV instead of RGBX and stores in this format |
| 267 | // in the image decode cache. See crbug.com/900264 for details on the feature. |
| 268 | const base::Feature kDecodeLossyWebPImagesToYUV{ |
| 269 | "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 270 | |
Takashi Toyoshima | a91506d | 2019-03-28 05:44:42 | [diff] [blame] | 271 | // Enables cache-aware WebFonts loading. See https://crbug.com/570205. |
| 272 | // The feature is disabled on Android for WebView API issue discussed at |
| 273 | // https://crbug.com/942440. |
| 274 | const base::Feature kWebFontsCacheAwareTimeoutAdaption { |
| 275 | "WebFontsCacheAwareTimeoutAdaption", |
| 276 | #if defined(OS_ANDROID) |
| 277 | base::FEATURE_DISABLED_BY_DEFAULT |
| 278 | #else |
| 279 | base::FEATURE_ENABLED_BY_DEFAULT |
| 280 | #endif |
| 281 | }; |
| 282 | |
Ehsan Karamad | be95d12 | 2019-05-10 17:59:06 | [diff] [blame] | 283 | // Enabled to block programmatic focus in subframes when not triggered by user |
| 284 | // activation (see htpps://crbug.com/954349). |
| 285 | const base::Feature kBlockingFocusWithoutUserActivation{ |
| 286 | "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 287 | |
Hongchan Choi | 370d3af | 2019-05-20 20:56:58 | [diff] [blame] | 288 | const base::Feature kAudioWorkletRealtimeThread{ |
| 289 | "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 290 | |
Ryan Sturm | 139c3ac | 2019-07-12 18:52:53 | [diff] [blame] | 291 | // A feature to reduce the set of resources fetched by No-State Prefetch. |
| 292 | const base::Feature kLightweightNoStatePrefetch{ |
Ryan Sturm | f223cb0 | 2019-10-04 18:02:00 | [diff] [blame] | 293 | "LightweightNoStatePrefetch", |
| 294 | #if defined(OS_ANDROID) |
| 295 | base::FEATURE_ENABLED_BY_DEFAULT |
| 296 | #else |
| 297 | base::FEATURE_DISABLED_BY_DEFAULT |
| 298 | #endif |
| 299 | }; |
Ryan Sturm | 139c3ac | 2019-07-12 18:52:53 | [diff] [blame] | 300 | |
Aran Gilman | 5e9672bed | 2019-08-02 19:07:49 | [diff] [blame] | 301 | // Automatically convert light-themed pages to use a Blink-generated dark theme |
| 302 | const base::Feature kForceWebContentsDarkMode{ |
| 303 | "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 304 | |
| 305 | // Which algorithm should be used for color inversion? |
| 306 | const base::FeatureParam<ForceDarkInversionMethod>::Option |
| 307 | forcedark_inversion_method_options[] = { |
| 308 | {ForceDarkInversionMethod::kUseBlinkSettings, |
| 309 | "use_blink_settings_for_method"}, |
| 310 | {ForceDarkInversionMethod::kHslBased, "hsl_based"}, |
Aran Gilman | 8b3ca41c | 2019-08-12 18:59:04 | [diff] [blame] | 311 | {ForceDarkInversionMethod::kCielabBased, "cielab_based"}, |
| 312 | {ForceDarkInversionMethod::kRgbBased, "rgb_based"}}; |
Aran Gilman | 5e9672bed | 2019-08-02 19:07:49 | [diff] [blame] | 313 | |
| 314 | const base::FeatureParam<ForceDarkInversionMethod> |
| 315 | kForceDarkInversionMethodParam{&kForceWebContentsDarkMode, |
| 316 | "inversion_method", |
| 317 | ForceDarkInversionMethod::kUseBlinkSettings, |
| 318 | &forcedark_inversion_method_options}; |
| 319 | |
| 320 | // Should images be inverted? |
| 321 | const base::FeatureParam<ForceDarkImageBehavior>::Option |
| 322 | forcedark_image_behavior_options[] = { |
| 323 | {ForceDarkImageBehavior::kUseBlinkSettings, |
| 324 | "use_blink_settings_for_images"}, |
| 325 | {ForceDarkImageBehavior::kInvertNone, "none"}, |
| 326 | {ForceDarkImageBehavior::kInvertSelectively, "selective"}}; |
| 327 | |
| 328 | const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{ |
| 329 | &kForceWebContentsDarkMode, "image_behavior", |
| 330 | ForceDarkImageBehavior::kUseBlinkSettings, |
| 331 | &forcedark_image_behavior_options}; |
| 332 | |
| 333 | // Do not invert text lighter than this. |
| 334 | // Range: 0 (do not invert any text) to 256 (invert all text) |
| 335 | // Can also set to -1 to let Blink's internal settings control the value |
| 336 | const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{ |
| 337 | &kForceWebContentsDarkMode, "text_lightness_threshold", -1}; |
| 338 | |
| 339 | // Do not invert backgrounds darker than this. |
| 340 | // Range: 0 (invert all backgrounds) to 256 (invert no backgrounds) |
| 341 | // Can also set to -1 to let Blink's internal settings control the value |
| 342 | const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{ |
| 343 | &kForceWebContentsDarkMode, "background_lightness_threshold", -1}; |
| 344 | |
Fernando Serboncini | f318616 | 2019-06-10 20:03:47 | [diff] [blame] | 345 | const base::Feature kCanvasAlwaysDeferral{"CanvasAlwaysDeferral", |
| 346 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 347 | |
Michael Lippautz | e670df9f | 2019-07-09 11:39:49 | [diff] [blame] | 348 | // Blink garbage collection. |
| 349 | // Enables compaction of backing stores on Blink's heap. |
| 350 | const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction", |
| 351 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 352 | // Enables concurrently marking Blink's heap. |
| 353 | const base::Feature kBlinkHeapConcurrentMarking{ |
| 354 | "BlinkHeapConcurrentMarking", base::FEATURE_DISABLED_BY_DEFAULT}; |
Anton Bikineev | 9b7b372 | 2019-07-09 13:48:39 | [diff] [blame] | 355 | // Enables concurrently sweeping Blink's heap. |
| 356 | const base::Feature kBlinkHeapConcurrentSweeping{ |
Anton Bikineev | 204cc75 | 2019-08-07 00:26:37 | [diff] [blame] | 357 | "BlinkHeapConcurrentSweeping", base::FEATURE_ENABLED_BY_DEFAULT}; |
Michael Lippautz | e670df9f | 2019-07-09 11:39:49 | [diff] [blame] | 358 | // Enables incrementally marking Blink's heap. |
| 359 | const base::Feature kBlinkHeapIncrementalMarking{ |
| 360 | "BlinkHeapIncrementalMarking", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 361 | // Enables a marking stress mode that schedules more garbage collections and |
| 362 | // also adds additional verification passes. |
| 363 | const base::Feature kBlinkHeapIncrementalMarkingStress{ |
| 364 | "BlinkHeapIncrementalMarkingStress", base::FEATURE_DISABLED_BY_DEFAULT}; |
Michael Lippautz | e670df9f | 2019-07-09 11:39:49 | [diff] [blame] | 365 | |
Ben Kelly | 298d8e0 | 2019-07-10 17:37:49 | [diff] [blame] | 366 | // Enables a delay before BufferingBytesConsumer begins reading from its |
| 367 | // underlying consumer when instantiated with CreateWithDelay(). |
| 368 | const base::Feature kBufferingBytesConsumerDelay{ |
Ben Kelly | b97951a | 2019-08-05 19:59:51 | [diff] [blame] | 369 | "BufferingBytesConsumerDelay", base::FEATURE_ENABLED_BY_DEFAULT}; |
Ben Kelly | 298d8e0 | 2019-07-10 17:37:49 | [diff] [blame] | 370 | const base::FeatureParam<int> kBufferingBytesConsumerDelayMilliseconds{ |
| 371 | &kBufferingBytesConsumerDelay, "milliseconds", 50}; |
| 372 | |
Yoav Weiss | ddfb8d2e | 2019-07-15 22:34:03 | [diff] [blame] | 373 | // Enables removing AppCache delays when triggering requests when the HTML was |
| 374 | // not fetched from AppCache. |
| 375 | const base::Feature kVerifyHTMLFetchedFromAppCacheBeforeDelay{ |
| 376 | "VerifyHTMLFetchedFromAppCacheBeforeDelay", |
| 377 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 378 | |
Michael Spang | 8d2303e | 2019-07-26 01:56:32 | [diff] [blame] | 379 | // Controls whether we use ThreadPriority::DISPLAY for renderer |
| 380 | // compositor & IO threads. |
| 381 | const base::Feature kBlinkCompositorUseDisplayThreadPriority { |
| 382 | "BlinkCompositorUseDisplayThreadPriority", |
| 383 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 384 | base::FEATURE_ENABLED_BY_DEFAULT |
| 385 | #else |
| 386 | base::FEATURE_DISABLED_BY_DEFAULT |
| 387 | #endif |
| 388 | }; |
| 389 | |
Yuki Shiino | a812f49 | 2019-08-23 06:47:46 | [diff] [blame] | 390 | // Ignores cross origin windows in the named property interceptor of Window. |
| 391 | // https://crbug.com/538562 |
| 392 | const base::Feature kIgnoreCrossOriginWindowWhenNamedAccessOnWindow{ |
| 393 | "IgnoreCrossOriginWindowWhenNamedAccessOnWindow", |
| 394 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 395 | |
Tarun Bansal | 3879246 | 2019-09-04 16:08:11 | [diff] [blame] | 396 | // When enabled, loading priority of JavaScript requests is lowered when they |
| 397 | // are force deferred by the intervention. |
| 398 | const base::Feature kLowerJavaScriptPriorityWhenForceDeferred{ |
| 399 | "LowerJavaScriptPriorityWhenForceDeferred", |
| 400 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 401 | |
Hiroshige Hayashizaki | 8ee3f7e6 | 2019-09-05 07:17:47 | [diff] [blame] | 402 | const base::Feature kHtmlImportsRequestInitiatorLock{ |
Yutaka Hirano | fe5510cf | 2019-10-08 07:30:33 | [diff] [blame] | 403 | "HtmlImportsRequestInitiatorLock", base::FEATURE_DISABLED_BY_DEFAULT}; |
Hiroshige Hayashizaki | 8ee3f7e6 | 2019-09-05 07:17:47 | [diff] [blame] | 404 | |
Matt Falkenhagen | 5cc65279 | 2018-06-21 10:34:33 | [diff] [blame] | 405 | } // namespace features |
| 406 | } // namespace blink |