blob: 09c91f80059f7e1270d89b92b662fb19cfcea5f8 [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{
Liquan(Max) Gu739af152019-06-07 19:27:1949 "FirstContentfulPaintPlusPlus", base::FEATURE_ENABLED_BY_DEFAULT};
Liquan(Max) Gu4e243fc2018-11-17 00:13:0250
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
Mason Freedc166cf12019-06-14 19:04:2669// Enable a new CSS property called backdrop-filter.
70const base::Feature kCSSBackdropFilter{"CSSBackdropFilter",
71 base::FEATURE_ENABLED_BY_DEFAULT};
72
Vladimir Levin43758ecc2019-05-09 18:04:0373// Enable Display Locking JavaScript APIs.
74const base::Feature kDisplayLocking{"DisplayLocking",
75 base::FEATURE_DISABLED_BY_DEFAULT};
76
Chris Harrelson6e41e3ae2019-05-03 23:09:4077// Enable applying rounded corner masks via a GL shader rather than
78// a mask layer.
79const base::Feature kFastBorderRadius{"FastBorderRadius",
80 base::FEATURE_DISABLED_BY_DEFAULT};
81
Ian Kilpatricke68ef11a2018-07-04 03:52:1082// Enable LayoutNG.
83const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_DISABLED_BY_DEFAULT};
84
Makoto Shimazu172eec02018-11-29 06:21:4485const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
86 base::FEATURE_DISABLED_BY_DEFAULT};
87
Marijn Kruisselbrinkcde64632018-06-22 22:45:1688// Enable mojo Blob URL interface and better blob URL lifetime management.
89// Can be enabled independently of NetworkService.
90const base::Feature kMojoBlobURLs{"MojoBlobURLs",
91 base::FEATURE_DISABLED_BY_DEFAULT};
92
Tarun Bansal422f9012019-01-23 16:55:5893// Used to control the collection of anchor element metrics (crbug.com/856683).
94// If kNavigationPredictor is enabled, then metrics of anchor elements
95// in the first viewport after the page load and the metrics of the clicked
96// anchor element will be extracted and recorded. Additionally, navigation
97// predictor may preconnect/prefetch to resources/origins to make the
98// future navigations faster.
99const base::Feature kNavigationPredictor{"NavigationPredictor",
100 base::FEATURE_DISABLED_BY_DEFAULT};
101
Hiroki Nakagawadf83a6f2019-01-28 06:07:46102// Enable off-the-main-thread dedicated worker script fetch.
103// (https://crbug.com/835717)
104const base::Feature kOffMainThreadDedicatedWorkerScriptFetch{
105 "OffMainThreadDedicatedWorkerScriptFetch",
106 base::FEATURE_DISABLED_BY_DEFAULT};
107
Kenichi Ishibashi5aa265a92019-02-28 07:01:45108// Enable off-the-main-thread service worker script fetch.
109// (https://crbug.com/924043)
110const base::Feature kOffMainThreadServiceWorkerScriptFetch{
Kenichi Ishibashi24c4e1c2019-05-22 00:18:20111 "OffMainThreadServiceWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Kenichi Ishibashi5aa265a92019-02-28 07:01:45112
Hiroki Nakagawa893ee502019-02-04 06:49:53113// Enable off-the-main-thread shared worker script fetch.
114// (https://crbug.com/924041)
115const base::Feature kOffMainThreadSharedWorkerScriptFetch{
Hiroki Nakagawad0e97e22019-05-24 04:17:26116 "OffMainThreadSharedWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Hiroki Nakagawa893ee502019-02-04 06:49:53117
Daniel Murphy80ce3022018-10-18 07:28:07118// Onion souping for all DOMStorage. https://crbug.com/781870
Daniel Murphy95792ef2018-10-04 01:29:55119const base::Feature kOnionSoupDOMStorage{"OnionSoupDOMStorage",
Daniel Murphydc4aa5a72019-02-07 22:08:47120 base::FEATURE_ENABLED_BY_DEFAULT};
Daniel Murphy95792ef2018-10-04 01:29:55121
Hiroki Nakagawa61ee0042019-01-22 06:30:26122// Enable browser-initiated dedicated worker script loading
123// (PlzDedicatedWorker). https://crbug.com/906991
124const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
125 base::FEATURE_DISABLED_BY_DEFAULT};
126
Daniel Murphy95792ef2018-10-04 01:29:55127// Enable Portals. https://crbug.com/865123.
128const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT};
129
Tarun Bansal8df12b52019-02-15 05:46:30130// Enable limiting previews loading hints to specific resource types.
131const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
132 "PreviewsResourceLoadingHintsSpecificResourceTypes",
133 base::FEATURE_DISABLED_BY_DEFAULT};
134
Aditya Keerthie84331b32019-03-20 15:25:52135// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
136// the "PurgeAndSuspend" experiment.
137//
138// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
139// reasons. Consider enabling by default if experiment results are positive.
140// https://crbug.com/926186
141const base::Feature kPurgeRendererMemoryWhenBackgrounded {
142 "PurgeRendererMemoryWhenBackgrounded",
143#if defined(OS_MACOSX) || defined(OS_ANDROID)
144 base::FEATURE_DISABLED_BY_DEFAULT
145#else
146 base::FEATURE_ENABLED_BY_DEFAULT
147#endif
148};
149
David Bokan911bded2018-11-27 23:23:32150// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44151// TODO(bokan): Temporarily disabled on desktop platforms to address issues
152// with non-overlay scrollbars. https://crbug.com/948059.
153const base::Feature kImplicitRootScroller {
154 "ImplicitRootScroller",
155#if defined(OS_ANDROID)
156 base::FEATURE_ENABLED_BY_DEFAULT
157#else
158 base::FEATURE_DISABLED_BY_DEFAULT
159#endif
160};
David Bokan911bded2018-11-27 23:23:32161
Makoto Shimazu172eec02018-11-29 06:21:44162// Enables usage of getDisplayMedia() that allows capture of web content, see
163// https://crbug.com/865060.
164const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
165 base::FEATURE_ENABLED_BY_DEFAULT};
166
167// Changes the default RTCPeerConnection constructor behavior to use Unified
168// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
169// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
170// argument).
171const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56172 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44173
Johannes Kronad5a4532019-01-09 11:17:46174// Determines if the SDP attrbute extmap-allow-mixed should be offered by
175// default or not. The default value can be overridden by passing
176// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
177// constructor.
178const base::Feature kRTCOfferExtmapAllowMixed{
179 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
180
Ben Kelly24e20aa2019-04-25 21:27:16181const base::Feature kServiceWorkerIsolateInForeground{
182 "ServiceWorkerIsolateInForeground", base::FEATURE_DISABLED_BY_DEFAULT};
183
momohattfc352292018-08-29 05:12:36184const base::Feature kServiceWorkerImportedScriptUpdateCheck{
185 "ServiceWorkerImportedScriptUpdateCheck",
186 base::FEATURE_DISABLED_BY_DEFAULT};
187
Ben Kellye20dc402018-09-18 01:55:42188// Enables reading a subresource's body data and side data in parallel.
189const base::Feature kServiceWorkerParallelSideDataReading{
190 "ServiceWorkerParallelSideDataReading", base::FEATURE_ENABLED_BY_DEFAULT};
191
Kenichi Ishibashi42f883d2019-01-11 08:26:14192const base::Feature kServiceWorkerAggressiveCodeCache{
193 "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT};
194
Makoto Shimazua8b3d742019-04-05 06:55:51195// Experiment of the delay from navigation to starting an update of a service
196// worker's script.
197const base::Feature kServiceWorkerUpdateDelay{
198 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
199
Scott Haseley8eefdcd2018-08-22 16:50:19200// Freeze scheduler task queues in background after allowed grace time.
201// "stop" is a legacy name.
202const base::Feature kStopInBackground {
203 "stop-in-background",
204#if defined(OS_ANDROID)
205 base::FEATURE_ENABLED_BY_DEFAULT
206#else
207 base::FEATURE_DISABLED_BY_DEFAULT
208#endif
209};
210
Takashi Sakamotoc19fc2b2019-04-10 06:30:52211// Freeze scheduler task queues in background on network idle.
212// This feature only works if stop-in-background is enabled.
213const base::Feature kFreezeBackgroundTabOnNetworkIdle{
214 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
215
Shubhie Panicker60bd4b02018-09-26 00:02:15216// Freeze non-timer task queues in background, after allowed grace time.
217// "stop" is a legacy name.
Dave Tapuska9140c552019-05-30 16:18:56218const base::Feature kStopNonTimersInBackground{
219 "stop-non-timers-in-background", base::FEATURE_ENABLED_BY_DEFAULT};
Scott Haseley7757f6c2018-08-03 14:33:23220
David Bokane9370c22019-02-14 15:19:58221// Enable text snippets in URL fragments. https://crbug.com/919204.
222const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
223 base::FEATURE_DISABLED_BY_DEFAULT};
224
Bill Budge4d028f12018-11-20 15:05:12225// Enables the site isolated Wasm code cache that is keyed on the resource URL
226// and the origin lock of the renderer that is requesting the resource. When
227// this flag is enabled, content/GeneratedCodeCache handles code cache requests.
228const base::Feature kWasmCodeCache = {"WasmCodeCache",
229 base::FEATURE_DISABLED_BY_DEFAULT};
230
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42231// Writable files and native file system access. https://crbug.com/853326
232const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrinkfa0e1052019-03-05 22:32:55233 base::FEATURE_DISABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44234
Jay Harris583f48922019-05-06 05:55:24235// File handling integration. https://crbug.com/829689
236const base::Feature kFileHandlingAPI{"FileHandlingAPI",
237 base::FEATURE_DISABLED_BY_DEFAULT};
238
kdillon66bf5b522019-01-02 22:08:30239// Allows for synchronous XHR requests during page dismissal
240const base::Feature kForbidSyncXHRInPageDismissal{
Katie Dillon54c1ad222019-04-18 23:49:52241 "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30242
Carlos ILd3be52b2018-10-08 17:57:18243const char kMixedContentAutoupgradeModeParamName[] = "mode";
244const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
245const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
246 "optionally-blockable";
247
Madeleine Barowsky45be21a42018-12-07 18:39:30248// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
249// in the image decode cache. See crbug.com/900264 for details on the feature.
250const base::Feature kDecodeLossyWebPImagesToYUV{
251 "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
252
Aaron Krajeskif2f827d422019-01-08 15:08:34253// Use accelerated canvases whenever possible see https://crbug.com/909937
254const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas",
Aaron Krajeskiccfb9122019-04-25 21:28:44255 base::FEATURE_ENABLED_BY_DEFAULT};
Aaron Krajeskif2f827d422019-01-08 15:08:34256
Takashi Toyoshimaa91506d2019-03-28 05:44:42257// 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.
260const 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 Karamadbe95d122019-05-10 17:59:06269// Enabled to block programmatic focus in subframes when not triggered by user
270// activation (see htpps://crbug.com/954349).
271const base::Feature kBlockingFocusWithoutUserActivation{
272 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
273
Hongchan Choi370d3af2019-05-20 20:56:58274const base::Feature kAudioWorkletRealtimeThread{
275 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
276
Daniel Libby7da24b72019-05-22 05:46:35277// Use scroll gestures for scrollbar scrolls (see https://crbug.com/954007).
278const base::Feature kScrollbarInjectScrollGestures{
Daniel Libby97b44752019-05-31 23:00:07279 "ScrollbarInjectScrollGestures", base::FEATURE_ENABLED_BY_DEFAULT};
Daniel Libby7da24b72019-05-22 05:46:35280
Hiroki Nakagawa893ee502019-02-04 06:49:53281bool IsOffMainThreadSharedWorkerScriptFetchEnabled() {
282 // Off-the-main-thread shared worker script fetch depends on PlzSharedWorker
283 // (NetworkService).
Hiroki Nakagawa893ee502019-02-04 06:49:53284 return base::FeatureList::IsEnabled(network::features::kNetworkService) &&
285 base::FeatureList::IsEnabled(
286 features::kOffMainThreadSharedWorkerScriptFetch);
287}
288
Hiroki Nakagawa7d8cbfa2019-02-07 11:01:28289bool IsPlzDedicatedWorkerEnabled() {
290 // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script
291 // fetch and NetworkService.
292#if DCHECK_IS_ON()
293 if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) {
294 DCHECK(base::FeatureList::IsEnabled(
295 features::kOffMainThreadDedicatedWorkerScriptFetch))
296 << "PlzDedicatedWorker is enabled but "
297 << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker "
298 << "requires OffMainThreadDedicatedWorkerScriptFetch.";
299 DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService))
300 << "PlzDedicatedWorker is enabled but NetworkService isn't. "
301 << "PlzDedicatedWorker requires NetworkService.";
302 }
303#endif // DCHECK_IS_ON()
304 return base::FeatureList::IsEnabled(
305 features::kOffMainThreadDedicatedWorkerScriptFetch) &&
306 base::FeatureList::IsEnabled(network::features::kNetworkService) &&
307 base::FeatureList::IsEnabled(features::kPlzDedicatedWorker);
308}
309
Fernando Serboncinif3186162019-06-10 20:03:47310const base::Feature kCanvasAlwaysDeferral{"CanvasAlwaysDeferral",
311 base::FEATURE_ENABLED_BY_DEFAULT};
312
Matt Falkenhagen5cc652792018-06-21 10:34:33313} // namespace features
314} // namespace blink