blob: 5456f7b4dfc5f43aa1c994a6884da193d89a2f72 [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
Scott Haseley8eefdcd2018-08-22 16:50:197#include "build/build_config.h"
Hiroki Nakagawa893ee502019-02-04 06:49:538#include "services/network/public/cpp/features.h"
Scott Haseley8eefdcd2018-08-22 16:50:199
Matt Falkenhagen5cc652792018-06-21 10:34:3310namespace blink {
11namespace features {
12
Yao Xiao2c1171a2019-04-01 23:44:3213// Enable intervention for download that was initiated from or occurred in an ad
14// frame without user activation.
15const base::Feature kBlockingDownloadsInAdFrameWithoutUserActivation{
16 "BlockingDownloadsInAdFrameWithoutUserActivation",
Yao Xiao3f9e4272019-05-23 15:22:4617 base::FEATURE_ENABLED_BY_DEFAULT};
Yao Xiao2c1171a2019-04-01 23:44:3218
Stephen Chenneyde6e5c82019-01-21 01:56:0419// Enable defer commits a bit to avoid flash.
20const base::Feature kAvoidFlashBetweenNavigation{
21 "AvoidFlashBetweenNavigation", base::FEATURE_DISABLED_BY_DEFAULT};
22
Matt Falkenhagenc25fea42018-07-17 07:13:5223// Enable eagerly setting up a CacheStorage interface pointer and
24// passing it to service workers on startup as an optimization.
25const base::Feature kEagerCacheStorageSetupForServiceWorkers{
26 "EagerCacheStorageSetupForServiceWorkers",
27 base::FEATURE_ENABLED_BY_DEFAULT};
28
Eric Karl0623ec72018-10-30 19:43:2629// Controls the user-specified viewport restriction for GPU Rasterization on
30// mobile. See https://crbug.com/899399
31const base::Feature kEnableGpuRasterizationViewportRestriction{
32 "EnableGpuRasterizationViewportRestriction",
33 base::FEATURE_ENABLED_BY_DEFAULT};
34
Peter Kvitek197eaf72018-12-04 19:14:5635// Controls script streaming.
36const base::Feature kScriptStreaming{"ScriptStreaming",
37 base::FEATURE_ENABLED_BY_DEFAULT};
38
Leszek Swirskif75c1912019-05-29 10:08:2539// Allow streaming small (<30kB) scripts.
40const base::Feature kSmallScriptStreaming{"SmallScriptStreaming",
41 base::FEATURE_DISABLED_BY_DEFAULT};
42
Keishi Hattori9e106922019-04-15 09:06:0343// Enables user level memory pressure signal generation on Android.
44const base::Feature kUserLevelMemoryPressureSignal{
45 "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT};
46
Liquan(Max) Gu4e243fc2018-11-17 00:13:0247// Enable FCP++ by experiment. See https://crbug.com/869924
48const base::Feature kFirstContentfulPaintPlusPlus{
49 "FirstContentfulPaintPlusPlus", base::FEATURE_DISABLED_BY_DEFAULT};
50
Aditya Keerthi6a933902019-03-14 21:09:2751// Perform memory purges after freezing only if all pages are frozen.
52const base::Feature kFreezePurgeMemoryAllPagesFrozen{
53 "FreezePurgeMemoryAllPagesFrozen", base::FEATURE_DISABLED_BY_DEFAULT};
54
John Delaneyac24e572019-04-30 19:47:0255// Freezes the user-agent as part of https://github.com/WICG/ua-client-hints.
56const base::Feature kFreezeUserAgent{"FreezeUserAgent",
57 base::FEATURE_DISABLED_BY_DEFAULT};
58
Steve Kobesb51c2fed2019-02-27 15:36:3159// Enables the experimental sweep-line algorithm for tracking "jank" from
60// layout objects changing their visual location between animation frames.
Steve Kobesaa9c7c22019-01-21 18:24:1361const base::Feature kJankTrackingSweepLine{"JankTrackingSweepLine",
62 base::FEATURE_DISABLED_BY_DEFAULT};
63
Philip Rogers63481332018-12-01 22:16:5164// Enable a new compositing mode called BlinkGenPropertyTrees where Blink
65// generates the compositor property trees. See: https://crbug.com/836884.
66const base::Feature kBlinkGenPropertyTrees{"BlinkGenPropertyTrees",
Philip Rogers3010556c2019-03-12 20:53:2267 base::FEATURE_ENABLED_BY_DEFAULT};
Philip Rogers63481332018-12-01 22:16:5168
Vladimir Levin43758ecc2019-05-09 18:04:0369// Enable Display Locking JavaScript APIs.
70const base::Feature kDisplayLocking{"DisplayLocking",
71 base::FEATURE_DISABLED_BY_DEFAULT};
72
Chris Harrelson6e41e3ae2019-05-03 23:09:4073// Enable applying rounded corner masks via a GL shader rather than
74// a mask layer.
75const base::Feature kFastBorderRadius{"FastBorderRadius",
76 base::FEATURE_DISABLED_BY_DEFAULT};
77
Ian Kilpatricke68ef11a2018-07-04 03:52:1078// Enable LayoutNG.
79const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_DISABLED_BY_DEFAULT};
80
Makoto Shimazu172eec02018-11-29 06:21:4481const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
82 base::FEATURE_DISABLED_BY_DEFAULT};
83
Marijn Kruisselbrinkcde64632018-06-22 22:45:1684// Enable mojo Blob URL interface and better blob URL lifetime management.
85// Can be enabled independently of NetworkService.
86const base::Feature kMojoBlobURLs{"MojoBlobURLs",
87 base::FEATURE_DISABLED_BY_DEFAULT};
88
Tarun Bansal422f9012019-01-23 16:55:5889// Used to control the collection of anchor element metrics (crbug.com/856683).
90// If kNavigationPredictor is enabled, then metrics of anchor elements
91// in the first viewport after the page load and the metrics of the clicked
92// anchor element will be extracted and recorded. Additionally, navigation
93// predictor may preconnect/prefetch to resources/origins to make the
94// future navigations faster.
95const base::Feature kNavigationPredictor{"NavigationPredictor",
96 base::FEATURE_DISABLED_BY_DEFAULT};
97
Hiroki Nakagawadf83a6f2019-01-28 06:07:4698// Enable off-the-main-thread dedicated worker script fetch.
99// (https://crbug.com/835717)
100const base::Feature kOffMainThreadDedicatedWorkerScriptFetch{
101 "OffMainThreadDedicatedWorkerScriptFetch",
102 base::FEATURE_DISABLED_BY_DEFAULT};
103
Kenichi Ishibashi5aa265a92019-02-28 07:01:45104// Enable off-the-main-thread service worker script fetch.
105// (https://crbug.com/924043)
106const base::Feature kOffMainThreadServiceWorkerScriptFetch{
Kenichi Ishibashi24c4e1c2019-05-22 00:18:20107 "OffMainThreadServiceWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Kenichi Ishibashi5aa265a92019-02-28 07:01:45108
Hiroki Nakagawa893ee502019-02-04 06:49:53109// Enable off-the-main-thread shared worker script fetch.
110// (https://crbug.com/924041)
111const base::Feature kOffMainThreadSharedWorkerScriptFetch{
Hiroki Nakagawad0e97e22019-05-24 04:17:26112 "OffMainThreadSharedWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Hiroki Nakagawa893ee502019-02-04 06:49:53113
Daniel Murphy80ce3022018-10-18 07:28:07114// Onion souping for all DOMStorage. https://crbug.com/781870
Daniel Murphy95792ef2018-10-04 01:29:55115const base::Feature kOnionSoupDOMStorage{"OnionSoupDOMStorage",
Daniel Murphydc4aa5a72019-02-07 22:08:47116 base::FEATURE_ENABLED_BY_DEFAULT};
Daniel Murphy95792ef2018-10-04 01:29:55117
Hiroki Nakagawa61ee0042019-01-22 06:30:26118// Enable browser-initiated dedicated worker script loading
119// (PlzDedicatedWorker). https://crbug.com/906991
120const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
121 base::FEATURE_DISABLED_BY_DEFAULT};
122
Daniel Murphy95792ef2018-10-04 01:29:55123// Enable Portals. https://crbug.com/865123.
124const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT};
125
Tarun Bansal8df12b52019-02-15 05:46:30126// Enable limiting previews loading hints to specific resource types.
127const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
128 "PreviewsResourceLoadingHintsSpecificResourceTypes",
129 base::FEATURE_DISABLED_BY_DEFAULT};
130
Aditya Keerthie84331b32019-03-20 15:25:52131// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
132// the "PurgeAndSuspend" experiment.
133//
134// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
135// reasons. Consider enabling by default if experiment results are positive.
136// https://crbug.com/926186
137const base::Feature kPurgeRendererMemoryWhenBackgrounded {
138 "PurgeRendererMemoryWhenBackgrounded",
139#if defined(OS_MACOSX) || defined(OS_ANDROID)
140 base::FEATURE_DISABLED_BY_DEFAULT
141#else
142 base::FEATURE_ENABLED_BY_DEFAULT
143#endif
144};
145
David Bokan911bded2018-11-27 23:23:32146// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44147// TODO(bokan): Temporarily disabled on desktop platforms to address issues
148// with non-overlay scrollbars. https://crbug.com/948059.
149const base::Feature kImplicitRootScroller {
150 "ImplicitRootScroller",
151#if defined(OS_ANDROID)
152 base::FEATURE_ENABLED_BY_DEFAULT
153#else
154 base::FEATURE_DISABLED_BY_DEFAULT
155#endif
156};
David Bokan911bded2018-11-27 23:23:32157
Makoto Shimazu172eec02018-11-29 06:21:44158// Enables usage of getDisplayMedia() that allows capture of web content, see
159// https://crbug.com/865060.
160const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
161 base::FEATURE_ENABLED_BY_DEFAULT};
162
163// Changes the default RTCPeerConnection constructor behavior to use Unified
164// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
165// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
166// argument).
167const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56168 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44169
Johannes Kronad5a4532019-01-09 11:17:46170// Determines if the SDP attrbute extmap-allow-mixed should be offered by
171// default or not. The default value can be overridden by passing
172// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
173// constructor.
174const base::Feature kRTCOfferExtmapAllowMixed{
175 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
176
Ben Kelly24e20aa2019-04-25 21:27:16177const base::Feature kServiceWorkerIsolateInForeground{
178 "ServiceWorkerIsolateInForeground", base::FEATURE_DISABLED_BY_DEFAULT};
179
momohattfc352292018-08-29 05:12:36180const base::Feature kServiceWorkerImportedScriptUpdateCheck{
181 "ServiceWorkerImportedScriptUpdateCheck",
182 base::FEATURE_DISABLED_BY_DEFAULT};
183
Ben Kellye20dc402018-09-18 01:55:42184// Enables reading a subresource's body data and side data in parallel.
185const base::Feature kServiceWorkerParallelSideDataReading{
186 "ServiceWorkerParallelSideDataReading", base::FEATURE_ENABLED_BY_DEFAULT};
187
Kenichi Ishibashi42f883d2019-01-11 08:26:14188const base::Feature kServiceWorkerAggressiveCodeCache{
189 "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT};
190
Makoto Shimazua8b3d742019-04-05 06:55:51191// Experiment of the delay from navigation to starting an update of a service
192// worker's script.
193const base::Feature kServiceWorkerUpdateDelay{
194 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
195
Scott Haseley8eefdcd2018-08-22 16:50:19196// Freeze scheduler task queues in background after allowed grace time.
197// "stop" is a legacy name.
198const base::Feature kStopInBackground {
199 "stop-in-background",
200#if defined(OS_ANDROID)
201 base::FEATURE_ENABLED_BY_DEFAULT
202#else
203 base::FEATURE_DISABLED_BY_DEFAULT
204#endif
205};
206
Takashi Sakamotoc19fc2b2019-04-10 06:30:52207// Freeze scheduler task queues in background on network idle.
208// This feature only works if stop-in-background is enabled.
209const base::Feature kFreezeBackgroundTabOnNetworkIdle{
210 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
211
Shubhie Panicker60bd4b02018-09-26 00:02:15212// Freeze non-timer task queues in background, after allowed grace time.
213// "stop" is a legacy name.
214const base::Feature kStopNonTimersInBackground {
215 "stop-non-timers-in-background",
216#if defined(OS_ANDROID)
217 base::FEATURE_ENABLED_BY_DEFAULT
218#else
219 base::FEATURE_DISABLED_BY_DEFAULT
220#endif
221};
Scott Haseley7757f6c2018-08-03 14:33:23222
David Bokane9370c22019-02-14 15:19:58223// Enable text snippets in URL fragments. https://crbug.com/919204.
224const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
225 base::FEATURE_DISABLED_BY_DEFAULT};
226
Bill Budge4d028f12018-11-20 15:05:12227// Enables the site isolated Wasm code cache that is keyed on the resource URL
228// and the origin lock of the renderer that is requesting the resource. When
229// this flag is enabled, content/GeneratedCodeCache handles code cache requests.
230const base::Feature kWasmCodeCache = {"WasmCodeCache",
231 base::FEATURE_DISABLED_BY_DEFAULT};
232
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42233// Writable files and native file system access. https://crbug.com/853326
234const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrinkfa0e1052019-03-05 22:32:55235 base::FEATURE_DISABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44236
Jay Harris583f48922019-05-06 05:55:24237// File handling integration. https://crbug.com/829689
238const base::Feature kFileHandlingAPI{"FileHandlingAPI",
239 base::FEATURE_DISABLED_BY_DEFAULT};
240
kdillon66bf5b522019-01-02 22:08:30241// Allows for synchronous XHR requests during page dismissal
242const base::Feature kForbidSyncXHRInPageDismissal{
Katie Dillon54c1ad222019-04-18 23:49:52243 "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30244
Carlos ILd3be52b2018-10-08 17:57:18245const char kMixedContentAutoupgradeModeParamName[] = "mode";
246const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
247const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
248 "optionally-blockable";
249
Madeleine Barowsky45be21a42018-12-07 18:39:30250// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
251// in the image decode cache. See crbug.com/900264 for details on the feature.
252const base::Feature kDecodeLossyWebPImagesToYUV{
253 "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
254
Aaron Krajeskif2f827d422019-01-08 15:08:34255// Use accelerated canvases whenever possible see https://crbug.com/909937
256const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas",
Aaron Krajeskiccfb9122019-04-25 21:28:44257 base::FEATURE_ENABLED_BY_DEFAULT};
Aaron Krajeskif2f827d422019-01-08 15:08:34258
Takashi Toyoshimaa91506d2019-03-28 05:44:42259// Enables cache-aware WebFonts loading. See https://crbug.com/570205.
260// The feature is disabled on Android for WebView API issue discussed at
261// https://crbug.com/942440.
262const base::Feature kWebFontsCacheAwareTimeoutAdaption {
263 "WebFontsCacheAwareTimeoutAdaption",
264#if defined(OS_ANDROID)
265 base::FEATURE_DISABLED_BY_DEFAULT
266#else
267 base::FEATURE_ENABLED_BY_DEFAULT
268#endif
269};
270
Ehsan Karamadbe95d122019-05-10 17:59:06271// Enabled to block programmatic focus in subframes when not triggered by user
272// activation (see htpps://crbug.com/954349).
273const base::Feature kBlockingFocusWithoutUserActivation{
274 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
275
Hongchan Choi370d3af2019-05-20 20:56:58276const base::Feature kAudioWorkletRealtimeThread{
277 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
278
Daniel Libby7da24b72019-05-22 05:46:35279// Use scroll gestures for scrollbar scrolls (see https://crbug.com/954007).
280const base::Feature kScrollbarInjectScrollGestures{
281 "ScrollbarInjectScrollGestures", base::FEATURE_DISABLED_BY_DEFAULT};
282
Hiroki Nakagawa893ee502019-02-04 06:49:53283bool IsOffMainThreadSharedWorkerScriptFetchEnabled() {
284 // Off-the-main-thread shared worker script fetch depends on PlzSharedWorker
285 // (NetworkService).
Hiroki Nakagawa893ee502019-02-04 06:49:53286 return base::FeatureList::IsEnabled(network::features::kNetworkService) &&
287 base::FeatureList::IsEnabled(
288 features::kOffMainThreadSharedWorkerScriptFetch);
289}
290
Hiroki Nakagawa7d8cbfa2019-02-07 11:01:28291bool IsPlzDedicatedWorkerEnabled() {
292 // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script
293 // fetch and NetworkService.
294#if DCHECK_IS_ON()
295 if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) {
296 DCHECK(base::FeatureList::IsEnabled(
297 features::kOffMainThreadDedicatedWorkerScriptFetch))
298 << "PlzDedicatedWorker is enabled but "
299 << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker "
300 << "requires OffMainThreadDedicatedWorkerScriptFetch.";
301 DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService))
302 << "PlzDedicatedWorker is enabled but NetworkService isn't. "
303 << "PlzDedicatedWorker requires NetworkService.";
304 }
305#endif // DCHECK_IS_ON()
306 return base::FeatureList::IsEnabled(
307 features::kOffMainThreadDedicatedWorkerScriptFetch) &&
308 base::FeatureList::IsEnabled(network::features::kNetworkService) &&
309 base::FeatureList::IsEnabled(features::kPlzDedicatedWorker);
310}
311
Matt Falkenhagen5cc652792018-06-21 10:34:33312} // namespace features
313} // namespace blink