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{ |
| 23 | "AvoidFlashBetweenNavigation", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 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 | |
Eric Karl | 0623ec7 | 2018-10-30 19:43:26 | [diff] [blame] | 31 | // Controls the user-specified viewport restriction for GPU Rasterization on |
| 32 | // mobile. See https://crbug.com/899399 |
| 33 | const base::Feature kEnableGpuRasterizationViewportRestriction{ |
| 34 | "EnableGpuRasterizationViewportRestriction", |
Eric Karl | 3594464 | 2019-07-17 23:58:24 | [diff] [blame] | 35 | base::FEATURE_DISABLED_BY_DEFAULT}; |
Eric Karl | 0623ec7 | 2018-10-30 19:43:26 | [diff] [blame] | 36 | |
Peter Kvitek | 197eaf7 | 2018-12-04 19:14:56 | [diff] [blame] | 37 | // Controls script streaming. |
| 38 | const base::Feature kScriptStreaming{"ScriptStreaming", |
| 39 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 40 | |
Leszek Swirski | f75c191 | 2019-05-29 10:08:25 | [diff] [blame] | 41 | // Allow streaming small (<30kB) scripts. |
| 42 | const base::Feature kSmallScriptStreaming{"SmallScriptStreaming", |
| 43 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 44 | |
Keishi Hattori | 9e10692 | 2019-04-15 09:06:03 | [diff] [blame] | 45 | // Enables user level memory pressure signal generation on Android. |
| 46 | const base::Feature kUserLevelMemoryPressureSignal{ |
| 47 | "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 48 | |
Liquan(Max) Gu | 4e243fc | 2018-11-17 00:13:02 | [diff] [blame] | 49 | // Enable FCP++ by experiment. See https://crbug.com/869924 |
| 50 | const base::Feature kFirstContentfulPaintPlusPlus{ |
Liquan(Max) Gu | 739af15 | 2019-06-07 19:27:19 | [diff] [blame] | 51 | "FirstContentfulPaintPlusPlus", base::FEATURE_ENABLED_BY_DEFAULT}; |
Liquan(Max) Gu | 4e243fc | 2018-11-17 00:13:02 | [diff] [blame] | 52 | |
Aditya Keerthi | 6a93390 | 2019-03-14 21:09:27 | [diff] [blame] | 53 | // Perform memory purges after freezing only if all pages are frozen. |
| 54 | const base::Feature kFreezePurgeMemoryAllPagesFrozen{ |
| 55 | "FreezePurgeMemoryAllPagesFrozen", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 56 | |
John Delaney | ac24e57 | 2019-04-30 19:47:02 | [diff] [blame] | 57 | // Freezes the user-agent as part of https://github.com/WICG/ua-client-hints. |
| 58 | const base::Feature kFreezeUserAgent{"FreezeUserAgent", |
| 59 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 60 | |
Steve Kobes | b51c2fed | 2019-02-27 15:36:31 | [diff] [blame] | 61 | // Enables the experimental sweep-line algorithm for tracking "jank" from |
| 62 | // layout objects changing their visual location between animation frames. |
Steve Kobes | aa9c7c2 | 2019-01-21 18:24:13 | [diff] [blame] | 63 | const base::Feature kJankTrackingSweepLine{"JankTrackingSweepLine", |
| 64 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 65 | |
Philip Rogers | 6348133 | 2018-12-01 22:16:51 | [diff] [blame] | 66 | // Enable a new compositing mode called BlinkGenPropertyTrees where Blink |
| 67 | // generates the compositor property trees. See: https://crbug.com/836884. |
| 68 | const base::Feature kBlinkGenPropertyTrees{"BlinkGenPropertyTrees", |
Philip Rogers | 3010556c | 2019-03-12 20:53:22 | [diff] [blame] | 69 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Philip Rogers | 6348133 | 2018-12-01 22:16:51 | [diff] [blame] | 70 | |
Mason Freed | c166cf1 | 2019-06-14 19:04:26 | [diff] [blame] | 71 | // Enable a new CSS property called backdrop-filter. |
| 72 | const base::Feature kCSSBackdropFilter{"CSSBackdropFilter", |
| 73 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 74 | |
Vladimir Levin | 43758ecc | 2019-05-09 18:04:03 | [diff] [blame] | 75 | // Enable Display Locking JavaScript APIs. |
| 76 | const base::Feature kDisplayLocking{"DisplayLocking", |
| 77 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 78 | |
Chris Harrelson | 6e41e3ae | 2019-05-03 23:09:40 | [diff] [blame] | 79 | // Enable applying rounded corner masks via a GL shader rather than |
| 80 | // a mask layer. |
| 81 | const base::Feature kFastBorderRadius{"FastBorderRadius", |
| 82 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 83 | |
Ian Kilpatrick | e68ef11a | 2018-07-04 03:52:10 | [diff] [blame] | 84 | // Enable LayoutNG. |
Emil A Eklund | 69eeb56 | 2019-07-03 01:38:30 | [diff] [blame] | 85 | const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_ENABLED_BY_DEFAULT}; |
Ian Kilpatrick | e68ef11a | 2018-07-04 03:52:10 | [diff] [blame] | 86 | |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 87 | const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent", |
| 88 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 89 | |
Tarun Bansal | 422f901 | 2019-01-23 16:55:58 | [diff] [blame] | 90 | // Used to control the collection of anchor element metrics (crbug.com/856683). |
| 91 | // If kNavigationPredictor is enabled, then metrics of anchor elements |
| 92 | // in the first viewport after the page load and the metrics of the clicked |
| 93 | // anchor element will be extracted and recorded. Additionally, navigation |
| 94 | // predictor may preconnect/prefetch to resources/origins to make the |
| 95 | // future navigations faster. |
Sofiya Semenova | e4e07615 | 2019-07-29 20:10:27 | [diff] [blame] | 96 | const base::Feature kNavigationPredictor { |
| 97 | "NavigationPredictor", |
| 98 | #if defined(OS_ANDROID) |
| 99 | base::FEATURE_ENABLED_BY_DEFAULT |
| 100 | #else |
| 101 | base::FEATURE_DISABLED_BY_DEFAULT |
| 102 | #endif |
| 103 | }; |
Tarun Bansal | 422f901 | 2019-01-23 16:55:58 | [diff] [blame] | 104 | |
Hiroki Nakagawa | df83a6f | 2019-01-28 06:07:46 | [diff] [blame] | 105 | // Enable off-the-main-thread dedicated worker script fetch. |
| 106 | // (https://crbug.com/835717) |
| 107 | const base::Feature kOffMainThreadDedicatedWorkerScriptFetch{ |
| 108 | "OffMainThreadDedicatedWorkerScriptFetch", |
| 109 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 110 | |
Kenichi Ishibashi | 5aa265a9 | 2019-02-28 07:01:45 | [diff] [blame] | 111 | // Enable off-the-main-thread service worker script fetch. |
| 112 | // (https://crbug.com/924043) |
| 113 | const base::Feature kOffMainThreadServiceWorkerScriptFetch{ |
Kenichi Ishibashi | 24c4e1c | 2019-05-22 00:18:20 | [diff] [blame] | 114 | "OffMainThreadServiceWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT}; |
Kenichi Ishibashi | 5aa265a9 | 2019-02-28 07:01:45 | [diff] [blame] | 115 | |
Hiroki Nakagawa | 61ee004 | 2019-01-22 06:30:26 | [diff] [blame] | 116 | // Enable browser-initiated dedicated worker script loading |
| 117 | // (PlzDedicatedWorker). https://crbug.com/906991 |
| 118 | const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker", |
| 119 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 120 | |
Daniel Murphy | 95792ef | 2018-10-04 01:29:55 | [diff] [blame] | 121 | // Enable Portals. https://crbug.com/865123. |
| 122 | const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 123 | |
Tarun Bansal | 8df12b5 | 2019-02-15 05:46:30 | [diff] [blame] | 124 | // Enable limiting previews loading hints to specific resource types. |
| 125 | const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{ |
| 126 | "PreviewsResourceLoadingHintsSpecificResourceTypes", |
| 127 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 128 | |
Aditya Keerthi | e84331b3 | 2019-03-20 15:25:52 | [diff] [blame] | 129 | // Perform a memory purge after a renderer is backgrounded. Formerly labelled as |
| 130 | // the "PurgeAndSuspend" experiment. |
| 131 | // |
| 132 | // TODO(adityakeerthi): Disabled by default on Mac and Android for historical |
| 133 | // reasons. Consider enabling by default if experiment results are positive. |
| 134 | // https://crbug.com/926186 |
| 135 | const base::Feature kPurgeRendererMemoryWhenBackgrounded { |
| 136 | "PurgeRendererMemoryWhenBackgrounded", |
| 137 | #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 138 | base::FEATURE_DISABLED_BY_DEFAULT |
| 139 | #else |
| 140 | base::FEATURE_ENABLED_BY_DEFAULT |
| 141 | #endif |
| 142 | }; |
| 143 | |
David Bokan | 911bded | 2018-11-27 23:23:32 | [diff] [blame] | 144 | // Enable Implicit Root Scroller. https://crbug.com/903260. |
David Bokan | 145b547 | 2019-05-22 14:38:44 | [diff] [blame] | 145 | // TODO(bokan): Temporarily disabled on desktop platforms to address issues |
| 146 | // with non-overlay scrollbars. https://crbug.com/948059. |
| 147 | const base::Feature kImplicitRootScroller { |
| 148 | "ImplicitRootScroller", |
| 149 | #if defined(OS_ANDROID) |
| 150 | base::FEATURE_ENABLED_BY_DEFAULT |
| 151 | #else |
| 152 | base::FEATURE_DISABLED_BY_DEFAULT |
| 153 | #endif |
| 154 | }; |
David Bokan | 911bded | 2018-11-27 23:23:32 | [diff] [blame] | 155 | |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 156 | // Enables usage of getDisplayMedia() that allows capture of web content, see |
| 157 | // https://crbug.com/865060. |
| 158 | const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia", |
| 159 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 160 | |
| 161 | // Changes the default RTCPeerConnection constructor behavior to use Unified |
| 162 | // Plan as the SDP semantics. When the feature is enabled, Unified Plan is used |
| 163 | // unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the |
| 164 | // argument). |
| 165 | const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault", |
Henrik Boström | 07021ec8 | 2019-01-17 22:23:56 | [diff] [blame] | 166 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 167 | |
Johannes Kron | ad5a453 | 2019-01-09 11:17:46 | [diff] [blame] | 168 | // Determines if the SDP attrbute extmap-allow-mixed should be offered by |
| 169 | // default or not. The default value can be overridden by passing |
| 170 | // {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection |
| 171 | // constructor. |
| 172 | const base::Feature kRTCOfferExtmapAllowMixed{ |
| 173 | "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 174 | |
Ben Kelly | 24e20aa | 2019-04-25 21:27:16 | [diff] [blame] | 175 | const base::Feature kServiceWorkerIsolateInForeground{ |
Ben Kelly | b27f17e8 | 2019-06-26 05:31:41 | [diff] [blame] | 176 | "ServiceWorkerIsolateInForeground", base::FEATURE_ENABLED_BY_DEFAULT}; |
Ben Kelly | 24e20aa | 2019-04-25 21:27:16 | [diff] [blame] | 177 | |
momohatt | fc35229 | 2018-08-29 05:12:36 | [diff] [blame] | 178 | const base::Feature kServiceWorkerImportedScriptUpdateCheck{ |
| 179 | "ServiceWorkerImportedScriptUpdateCheck", |
| 180 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 181 | |
Kenichi Ishibashi | 42f883d | 2019-01-11 08:26:14 | [diff] [blame] | 182 | const base::Feature kServiceWorkerAggressiveCodeCache{ |
| 183 | "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 184 | |
Makoto Shimazu | a8b3d74 | 2019-04-05 06:55:51 | [diff] [blame] | 185 | // Experiment of the delay from navigation to starting an update of a service |
| 186 | // worker's script. |
| 187 | const base::Feature kServiceWorkerUpdateDelay{ |
| 188 | "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 189 | |
Scott Haseley | 8eefdcd | 2018-08-22 16:50:19 | [diff] [blame] | 190 | // Freeze scheduler task queues in background after allowed grace time. |
| 191 | // "stop" is a legacy name. |
| 192 | const base::Feature kStopInBackground { |
| 193 | "stop-in-background", |
| 194 | #if defined(OS_ANDROID) |
| 195 | base::FEATURE_ENABLED_BY_DEFAULT |
| 196 | #else |
| 197 | base::FEATURE_DISABLED_BY_DEFAULT |
| 198 | #endif |
| 199 | }; |
| 200 | |
Takashi Sakamoto | c19fc2b | 2019-04-10 06:30:52 | [diff] [blame] | 201 | // Freeze scheduler task queues in background on network idle. |
| 202 | // This feature only works if stop-in-background is enabled. |
| 203 | const base::Feature kFreezeBackgroundTabOnNetworkIdle{ |
| 204 | "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 205 | |
Shubhie Panicker | 60bd4b0 | 2018-09-26 00:02:15 | [diff] [blame] | 206 | // Freeze non-timer task queues in background, after allowed grace time. |
| 207 | // "stop" is a legacy name. |
Dave Tapuska | 9140c55 | 2019-05-30 16:18:56 | [diff] [blame] | 208 | const base::Feature kStopNonTimersInBackground{ |
| 209 | "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT}; |
Scott Haseley | 7757f6c | 2018-08-03 14:33:23 | [diff] [blame] | 210 | |
David Bokan | e9370c2 | 2019-02-14 15:19:58 | [diff] [blame] | 211 | // Enable text snippets in URL fragments. https://crbug.com/919204. |
| 212 | const base::Feature kTextFragmentAnchor{"TextFragmentAnchor", |
| 213 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 214 | |
Bill Budge | 4d028f1 | 2018-11-20 15:05:12 | [diff] [blame] | 215 | // Enables the site isolated Wasm code cache that is keyed on the resource URL |
| 216 | // and the origin lock of the renderer that is requesting the resource. When |
| 217 | // this flag is enabled, content/GeneratedCodeCache handles code cache requests. |
| 218 | const base::Feature kWasmCodeCache = {"WasmCodeCache", |
| 219 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 220 | |
Marijn Kruisselbrink | ca4bb5e | 2019-04-22 18:19:42 | [diff] [blame] | 221 | // Writable files and native file system access. https://crbug.com/853326 |
| 222 | const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI", |
Marijn Kruisselbrink | fa0e105 | 2019-03-05 22:32:55 | [diff] [blame] | 223 | base::FEATURE_DISABLED_BY_DEFAULT}; |
Makoto Shimazu | 172eec0 | 2018-11-29 06:21:44 | [diff] [blame] | 224 | |
Jay Harris | 583f4892 | 2019-05-06 05:55:24 | [diff] [blame] | 225 | // File handling integration. https://crbug.com/829689 |
| 226 | const base::Feature kFileHandlingAPI{"FileHandlingAPI", |
| 227 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 228 | |
kdillon | 66bf5b52 | 2019-01-02 22:08:30 | [diff] [blame] | 229 | // Allows for synchronous XHR requests during page dismissal |
| 230 | const base::Feature kForbidSyncXHRInPageDismissal{ |
Katie Dillon | 54c1ad22 | 2019-04-18 23:49:52 | [diff] [blame] | 231 | "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT}; |
kdillon | 66bf5b52 | 2019-01-02 22:08:30 | [diff] [blame] | 232 | |
Dominic Farolino | 693fd72d | 2019-08-05 11:09:44 | [diff] [blame] | 233 | // Forces the redirect mode for prefetches to kManual. See crbug.com/988956. |
| 234 | const base::Feature kPrefetchRedirectError{"PrefetchRedirectError", |
| 235 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 236 | |
Carlos IL | d3be52b | 2018-10-08 17:57:18 | [diff] [blame] | 237 | const char kMixedContentAutoupgradeModeParamName[] = "mode"; |
| 238 | const char kMixedContentAutoupgradeModeBlockable[] = "blockable"; |
| 239 | const char kMixedContentAutoupgradeModeOptionallyBlockable[] = |
| 240 | "optionally-blockable"; |
| 241 | |
Madeleine Barowsky | 45be21a4 | 2018-12-07 18:39:30 | [diff] [blame] | 242 | // Decodes lossy WebP images to YUV instead of RGBX and stores in this format |
| 243 | // in the image decode cache. See crbug.com/900264 for details on the feature. |
| 244 | const base::Feature kDecodeLossyWebPImagesToYUV{ |
| 245 | "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 246 | |
Aaron Krajeski | f2f827d42 | 2019-01-08 15:08:34 | [diff] [blame] | 247 | // Use accelerated canvases whenever possible see https://crbug.com/909937 |
| 248 | const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas", |
Aaron Krajeski | ccfb912 | 2019-04-25 21:28:44 | [diff] [blame] | 249 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Aaron Krajeski | f2f827d42 | 2019-01-08 15:08:34 | [diff] [blame] | 250 | |
Tarun Bansal | e4ad347 | 2019-07-09 03:59:28 | [diff] [blame] | 251 | // Enables usage of render frame observer as the receiver of the resource |
| 252 | // loading hints in the render process. |
| 253 | // https://crbug.com/891328. |
| 254 | const base::Feature kSendPreviewsLoadingHintsBeforeCommit{ |
| 255 | "SendPreviewsLoadingHintsBeforeCommit", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 256 | |
Takashi Toyoshima | a91506d | 2019-03-28 05:44:42 | [diff] [blame] | 257 | // Enables cache-aware WebFonts loading. See https://crbug.com/570205. |
| 258 | // The feature is disabled on Android for WebView API issue discussed at |
| 259 | // https://crbug.com/942440. |
| 260 | const base::Feature kWebFontsCacheAwareTimeoutAdaption { |
| 261 | "WebFontsCacheAwareTimeoutAdaption", |
| 262 | #if defined(OS_ANDROID) |
| 263 | base::FEATURE_DISABLED_BY_DEFAULT |
| 264 | #else |
| 265 | base::FEATURE_ENABLED_BY_DEFAULT |
| 266 | #endif |
| 267 | }; |
| 268 | |
Ehsan Karamad | be95d12 | 2019-05-10 17:59:06 | [diff] [blame] | 269 | // Enabled to block programmatic focus in subframes when not triggered by user |
| 270 | // activation (see htpps://crbug.com/954349). |
| 271 | const base::Feature kBlockingFocusWithoutUserActivation{ |
| 272 | "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 273 | |
Hongchan Choi | 370d3af | 2019-05-20 20:56:58 | [diff] [blame] | 274 | const base::Feature kAudioWorkletRealtimeThread{ |
| 275 | "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 276 | |
Ryan Sturm | 139c3ac | 2019-07-12 18:52:53 | [diff] [blame] | 277 | // A feature to reduce the set of resources fetched by No-State Prefetch. |
| 278 | const base::Feature kLightweightNoStatePrefetch{ |
Ryan Sturm | 37bcbec | 2019-07-26 12:53:08 | [diff] [blame] | 279 | "LightweightNoStatePrefetch", base::FEATURE_DISABLED_BY_DEFAULT}; |
Ryan Sturm | 139c3ac | 2019-07-12 18:52:53 | [diff] [blame] | 280 | |
Daniel Libby | 7da24b7 | 2019-05-22 05:46:35 | [diff] [blame] | 281 | // Use scroll gestures for scrollbar scrolls (see https://crbug.com/954007). |
| 282 | const base::Feature kScrollbarInjectScrollGestures{ |
Daniel Libby | 97b4475 | 2019-05-31 23:00:07 | [diff] [blame] | 283 | "ScrollbarInjectScrollGestures", base::FEATURE_ENABLED_BY_DEFAULT}; |
Daniel Libby | 7da24b7 | 2019-05-22 05:46:35 | [diff] [blame] | 284 | |
Aran Gilman | 5e9672bed | 2019-08-02 19:07:49 | [diff] [blame] | 285 | // Automatically convert light-themed pages to use a Blink-generated dark theme |
| 286 | const base::Feature kForceWebContentsDarkMode{ |
| 287 | "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 288 | |
| 289 | // Which algorithm should be used for color inversion? |
| 290 | const base::FeatureParam<ForceDarkInversionMethod>::Option |
| 291 | forcedark_inversion_method_options[] = { |
| 292 | {ForceDarkInversionMethod::kUseBlinkSettings, |
| 293 | "use_blink_settings_for_method"}, |
| 294 | {ForceDarkInversionMethod::kHslBased, "hsl_based"}, |
| 295 | {ForceDarkInversionMethod::kCielabBased, "cielab_based"}}; |
| 296 | |
| 297 | const base::FeatureParam<ForceDarkInversionMethod> |
| 298 | kForceDarkInversionMethodParam{&kForceWebContentsDarkMode, |
| 299 | "inversion_method", |
| 300 | ForceDarkInversionMethod::kUseBlinkSettings, |
| 301 | &forcedark_inversion_method_options}; |
| 302 | |
| 303 | // Should images be inverted? |
| 304 | const base::FeatureParam<ForceDarkImageBehavior>::Option |
| 305 | forcedark_image_behavior_options[] = { |
| 306 | {ForceDarkImageBehavior::kUseBlinkSettings, |
| 307 | "use_blink_settings_for_images"}, |
| 308 | {ForceDarkImageBehavior::kInvertNone, "none"}, |
| 309 | {ForceDarkImageBehavior::kInvertSelectively, "selective"}}; |
| 310 | |
| 311 | const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{ |
| 312 | &kForceWebContentsDarkMode, "image_behavior", |
| 313 | ForceDarkImageBehavior::kUseBlinkSettings, |
| 314 | &forcedark_image_behavior_options}; |
| 315 | |
| 316 | // Do not invert text lighter than this. |
| 317 | // Range: 0 (do not invert any text) to 256 (invert all text) |
| 318 | // Can also set to -1 to let Blink's internal settings control the value |
| 319 | const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{ |
| 320 | &kForceWebContentsDarkMode, "text_lightness_threshold", -1}; |
| 321 | |
| 322 | // Do not invert backgrounds darker than this. |
| 323 | // Range: 0 (invert all backgrounds) to 256 (invert no backgrounds) |
| 324 | // Can also set to -1 to let Blink's internal settings control the value |
| 325 | const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{ |
| 326 | &kForceWebContentsDarkMode, "background_lightness_threshold", -1}; |
| 327 | |
Hiroki Nakagawa | 7d8cbfa | 2019-02-07 11:01:28 | [diff] [blame] | 328 | bool IsPlzDedicatedWorkerEnabled() { |
| 329 | // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script |
| 330 | // fetch and NetworkService. |
| 331 | #if DCHECK_IS_ON() |
| 332 | if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) { |
| 333 | DCHECK(base::FeatureList::IsEnabled( |
| 334 | features::kOffMainThreadDedicatedWorkerScriptFetch)) |
| 335 | << "PlzDedicatedWorker is enabled but " |
| 336 | << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker " |
| 337 | << "requires OffMainThreadDedicatedWorkerScriptFetch."; |
| 338 | DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService)) |
| 339 | << "PlzDedicatedWorker is enabled but NetworkService isn't. " |
| 340 | << "PlzDedicatedWorker requires NetworkService."; |
| 341 | } |
| 342 | #endif // DCHECK_IS_ON() |
| 343 | return base::FeatureList::IsEnabled( |
| 344 | features::kOffMainThreadDedicatedWorkerScriptFetch) && |
| 345 | base::FeatureList::IsEnabled(network::features::kNetworkService) && |
| 346 | base::FeatureList::IsEnabled(features::kPlzDedicatedWorker); |
| 347 | } |
| 348 | |
Fernando Serboncini | f318616 | 2019-06-10 20:03:47 | [diff] [blame] | 349 | const base::Feature kCanvasAlwaysDeferral{"CanvasAlwaysDeferral", |
| 350 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 351 | |
Adam Rice | 8e55e80 | 2019-06-24 11:58:03 | [diff] [blame] | 352 | // Use the new C++ implementation of WHATWG Streams. See |
| 353 | // https://crbug.com/977500. |
| 354 | const base::Feature kStreamsNative{"StreamsNative", |
| 355 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 356 | |
Michael Lippautz | e670df9f | 2019-07-09 11:39:49 | [diff] [blame] | 357 | // Blink garbage collection. |
| 358 | // Enables compaction of backing stores on Blink's heap. |
| 359 | const base::Feature kBlinkHeapCompaction{"BlinkHeapCompaction", |
| 360 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 361 | // Enables concurrently marking Blink's heap. |
| 362 | const base::Feature kBlinkHeapConcurrentMarking{ |
| 363 | "BlinkHeapConcurrentMarking", base::FEATURE_DISABLED_BY_DEFAULT}; |
Anton Bikineev | 9b7b372 | 2019-07-09 13:48:39 | [diff] [blame] | 364 | // Enables concurrently sweeping Blink's heap. |
| 365 | const base::Feature kBlinkHeapConcurrentSweeping{ |
Anton Bikineev | 204cc75 | 2019-08-07 00:26:37 | [diff] [blame^] | 366 | "BlinkHeapConcurrentSweeping", base::FEATURE_ENABLED_BY_DEFAULT}; |
Michael Lippautz | e670df9f | 2019-07-09 11:39:49 | [diff] [blame] | 367 | // Enables incrementally marking Blink's heap. |
| 368 | const base::Feature kBlinkHeapIncrementalMarking{ |
| 369 | "BlinkHeapIncrementalMarking", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 370 | // Enables a marking stress mode that schedules more garbage collections and |
| 371 | // also adds additional verification passes. |
| 372 | const base::Feature kBlinkHeapIncrementalMarkingStress{ |
| 373 | "BlinkHeapIncrementalMarkingStress", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 374 | // Enables unified heap garbage collection scheduling where scheduling is |
| 375 | // delegated to V8's heap controller. |
| 376 | const base::Feature kBlinkHeapUnifiedGCScheduling{ |
| 377 | "BlinkHeapUnifiedGCScheduling", base::FEATURE_ENABLED_BY_DEFAULT}; |
| 378 | |
Ben Kelly | 298d8e0 | 2019-07-10 17:37:49 | [diff] [blame] | 379 | // Enables a delay before BufferingBytesConsumer begins reading from its |
| 380 | // underlying consumer when instantiated with CreateWithDelay(). |
| 381 | const base::Feature kBufferingBytesConsumerDelay{ |
Ben Kelly | b97951a | 2019-08-05 19:59:51 | [diff] [blame] | 382 | "BufferingBytesConsumerDelay", base::FEATURE_ENABLED_BY_DEFAULT}; |
Ben Kelly | 298d8e0 | 2019-07-10 17:37:49 | [diff] [blame] | 383 | const base::FeatureParam<int> kBufferingBytesConsumerDelayMilliseconds{ |
| 384 | &kBufferingBytesConsumerDelay, "milliseconds", 50}; |
| 385 | |
Yoav Weiss | ddfb8d2e | 2019-07-15 22:34:03 | [diff] [blame] | 386 | // Enables removing AppCache delays when triggering requests when the HTML was |
| 387 | // not fetched from AppCache. |
| 388 | const base::Feature kVerifyHTMLFetchedFromAppCacheBeforeDelay{ |
| 389 | "VerifyHTMLFetchedFromAppCacheBeforeDelay", |
| 390 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 391 | |
Michael Spang | 8d2303e | 2019-07-26 01:56:32 | [diff] [blame] | 392 | // Controls whether we use ThreadPriority::DISPLAY for renderer |
| 393 | // compositor & IO threads. |
| 394 | const base::Feature kBlinkCompositorUseDisplayThreadPriority { |
| 395 | "BlinkCompositorUseDisplayThreadPriority", |
| 396 | #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 397 | base::FEATURE_ENABLED_BY_DEFAULT |
| 398 | #else |
| 399 | base::FEATURE_DISABLED_BY_DEFAULT |
| 400 | #endif |
| 401 | }; |
| 402 | |
Matt Falkenhagen | 5cc65279 | 2018-06-21 10:34:33 | [diff] [blame] | 403 | } // namespace features |
| 404 | } // namespace blink |