blob: ba033271ce44d8793e06386587ad6be21dfb2a6c [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
Keishi Hattori9e106922019-04-15 09:06:0339// Enables user level memory pressure signal generation on Android.
40const base::Feature kUserLevelMemoryPressureSignal{
41 "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT};
42
Liquan(Max) Gu4e243fc2018-11-17 00:13:0243// Enable FCP++ by experiment. See https://crbug.com/869924
44const base::Feature kFirstContentfulPaintPlusPlus{
45 "FirstContentfulPaintPlusPlus", base::FEATURE_DISABLED_BY_DEFAULT};
46
Aditya Keerthi6a933902019-03-14 21:09:2747// Perform memory purges after freezing only if all pages are frozen.
48const base::Feature kFreezePurgeMemoryAllPagesFrozen{
49 "FreezePurgeMemoryAllPagesFrozen", base::FEATURE_DISABLED_BY_DEFAULT};
50
John Delaneyac24e572019-04-30 19:47:0251// Freezes the user-agent as part of https://github.com/WICG/ua-client-hints.
52const base::Feature kFreezeUserAgent{"FreezeUserAgent",
53 base::FEATURE_DISABLED_BY_DEFAULT};
54
Steve Kobesb51c2fed2019-02-27 15:36:3155// Enables the experimental sweep-line algorithm for tracking "jank" from
56// layout objects changing their visual location between animation frames.
Steve Kobesaa9c7c22019-01-21 18:24:1357const base::Feature kJankTrackingSweepLine{"JankTrackingSweepLine",
58 base::FEATURE_DISABLED_BY_DEFAULT};
59
Philip Rogers63481332018-12-01 22:16:5160// Enable a new compositing mode called BlinkGenPropertyTrees where Blink
61// generates the compositor property trees. See: https://crbug.com/836884.
62const base::Feature kBlinkGenPropertyTrees{"BlinkGenPropertyTrees",
Philip Rogers3010556c2019-03-12 20:53:2263 base::FEATURE_ENABLED_BY_DEFAULT};
Philip Rogers63481332018-12-01 22:16:5164
Vladimir Levin43758ecc2019-05-09 18:04:0365// Enable Display Locking JavaScript APIs.
66const base::Feature kDisplayLocking{"DisplayLocking",
67 base::FEATURE_DISABLED_BY_DEFAULT};
68
Chris Harrelson6e41e3ae2019-05-03 23:09:4069// Enable applying rounded corner masks via a GL shader rather than
70// a mask layer.
71const base::Feature kFastBorderRadius{"FastBorderRadius",
72 base::FEATURE_DISABLED_BY_DEFAULT};
73
Ian Kilpatricke68ef11a2018-07-04 03:52:1074// Enable LayoutNG.
75const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_DISABLED_BY_DEFAULT};
76
Makoto Shimazu172eec02018-11-29 06:21:4477const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
78 base::FEATURE_DISABLED_BY_DEFAULT};
79
Marijn Kruisselbrinkcde64632018-06-22 22:45:1680// Enable mojo Blob URL interface and better blob URL lifetime management.
81// Can be enabled independently of NetworkService.
82const base::Feature kMojoBlobURLs{"MojoBlobURLs",
83 base::FEATURE_DISABLED_BY_DEFAULT};
84
Tarun Bansal422f9012019-01-23 16:55:5885// Used to control the collection of anchor element metrics (crbug.com/856683).
86// If kNavigationPredictor is enabled, then metrics of anchor elements
87// in the first viewport after the page load and the metrics of the clicked
88// anchor element will be extracted and recorded. Additionally, navigation
89// predictor may preconnect/prefetch to resources/origins to make the
90// future navigations faster.
91const base::Feature kNavigationPredictor{"NavigationPredictor",
92 base::FEATURE_DISABLED_BY_DEFAULT};
93
Hiroki Nakagawadf83a6f2019-01-28 06:07:4694// Enable off-the-main-thread dedicated worker script fetch.
95// (https://crbug.com/835717)
96const base::Feature kOffMainThreadDedicatedWorkerScriptFetch{
97 "OffMainThreadDedicatedWorkerScriptFetch",
98 base::FEATURE_DISABLED_BY_DEFAULT};
99
Kenichi Ishibashi5aa265a92019-02-28 07:01:45100// Enable off-the-main-thread service worker script fetch.
101// (https://crbug.com/924043)
102const base::Feature kOffMainThreadServiceWorkerScriptFetch{
Kenichi Ishibashi24c4e1c2019-05-22 00:18:20103 "OffMainThreadServiceWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Kenichi Ishibashi5aa265a92019-02-28 07:01:45104
Hiroki Nakagawa893ee502019-02-04 06:49:53105// Enable off-the-main-thread shared worker script fetch.
106// (https://crbug.com/924041)
107const base::Feature kOffMainThreadSharedWorkerScriptFetch{
Hiroki Nakagawad0e97e22019-05-24 04:17:26108 "OffMainThreadSharedWorkerScriptFetch", base::FEATURE_ENABLED_BY_DEFAULT};
Hiroki Nakagawa893ee502019-02-04 06:49:53109
Daniel Murphy80ce3022018-10-18 07:28:07110// Onion souping for all DOMStorage. https://crbug.com/781870
Daniel Murphy95792ef2018-10-04 01:29:55111const base::Feature kOnionSoupDOMStorage{"OnionSoupDOMStorage",
Daniel Murphydc4aa5a72019-02-07 22:08:47112 base::FEATURE_ENABLED_BY_DEFAULT};
Daniel Murphy95792ef2018-10-04 01:29:55113
Hiroki Nakagawa61ee0042019-01-22 06:30:26114// Enable browser-initiated dedicated worker script loading
115// (PlzDedicatedWorker). https://crbug.com/906991
116const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
117 base::FEATURE_DISABLED_BY_DEFAULT};
118
Daniel Murphy95792ef2018-10-04 01:29:55119// Enable Portals. https://crbug.com/865123.
120const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT};
121
Tarun Bansal8df12b52019-02-15 05:46:30122// Enable limiting previews loading hints to specific resource types.
123const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
124 "PreviewsResourceLoadingHintsSpecificResourceTypes",
125 base::FEATURE_DISABLED_BY_DEFAULT};
126
Aditya Keerthie84331b32019-03-20 15:25:52127// Perform a memory purge after a renderer is backgrounded. Formerly labelled as
128// the "PurgeAndSuspend" experiment.
129//
130// TODO(adityakeerthi): Disabled by default on Mac and Android for historical
131// reasons. Consider enabling by default if experiment results are positive.
132// https://crbug.com/926186
133const base::Feature kPurgeRendererMemoryWhenBackgrounded {
134 "PurgeRendererMemoryWhenBackgrounded",
135#if defined(OS_MACOSX) || defined(OS_ANDROID)
136 base::FEATURE_DISABLED_BY_DEFAULT
137#else
138 base::FEATURE_ENABLED_BY_DEFAULT
139#endif
140};
141
David Bokan911bded2018-11-27 23:23:32142// Enable Implicit Root Scroller. https://crbug.com/903260.
David Bokan145b5472019-05-22 14:38:44143// TODO(bokan): Temporarily disabled on desktop platforms to address issues
144// with non-overlay scrollbars. https://crbug.com/948059.
145const base::Feature kImplicitRootScroller {
146 "ImplicitRootScroller",
147#if defined(OS_ANDROID)
148 base::FEATURE_ENABLED_BY_DEFAULT
149#else
150 base::FEATURE_DISABLED_BY_DEFAULT
151#endif
152};
David Bokan911bded2018-11-27 23:23:32153
Makoto Shimazu172eec02018-11-29 06:21:44154// Enables usage of getDisplayMedia() that allows capture of web content, see
155// https://crbug.com/865060.
156const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
157 base::FEATURE_ENABLED_BY_DEFAULT};
158
159// Changes the default RTCPeerConnection constructor behavior to use Unified
160// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
161// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
162// argument).
163const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56164 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44165
Johannes Kronad5a4532019-01-09 11:17:46166// Determines if the SDP attrbute extmap-allow-mixed should be offered by
167// default or not. The default value can be overridden by passing
168// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
169// constructor.
170const base::Feature kRTCOfferExtmapAllowMixed{
171 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
172
Ben Kelly24e20aa2019-04-25 21:27:16173const base::Feature kServiceWorkerIsolateInForeground{
174 "ServiceWorkerIsolateInForeground", base::FEATURE_DISABLED_BY_DEFAULT};
175
momohattfc352292018-08-29 05:12:36176const base::Feature kServiceWorkerImportedScriptUpdateCheck{
177 "ServiceWorkerImportedScriptUpdateCheck",
178 base::FEATURE_DISABLED_BY_DEFAULT};
179
Ben Kellye20dc402018-09-18 01:55:42180// Enables reading a subresource's body data and side data in parallel.
181const base::Feature kServiceWorkerParallelSideDataReading{
182 "ServiceWorkerParallelSideDataReading", base::FEATURE_ENABLED_BY_DEFAULT};
183
Kenichi Ishibashi42f883d2019-01-11 08:26:14184const base::Feature kServiceWorkerAggressiveCodeCache{
185 "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT};
186
Makoto Shimazua8b3d742019-04-05 06:55:51187// Experiment of the delay from navigation to starting an update of a service
188// worker's script.
189const base::Feature kServiceWorkerUpdateDelay{
190 "ServiceWorkerUpdateDelay", base::FEATURE_DISABLED_BY_DEFAULT};
191
Scott Haseley8eefdcd2018-08-22 16:50:19192// Freeze scheduler task queues in background after allowed grace time.
193// "stop" is a legacy name.
194const base::Feature kStopInBackground {
195 "stop-in-background",
196#if defined(OS_ANDROID)
197 base::FEATURE_ENABLED_BY_DEFAULT
198#else
199 base::FEATURE_DISABLED_BY_DEFAULT
200#endif
201};
202
Takashi Sakamotoc19fc2b2019-04-10 06:30:52203// Freeze scheduler task queues in background on network idle.
204// This feature only works if stop-in-background is enabled.
205const base::Feature kFreezeBackgroundTabOnNetworkIdle{
206 "freeze-background-tab-on-network-idle", base::FEATURE_DISABLED_BY_DEFAULT};
207
Shubhie Panicker60bd4b02018-09-26 00:02:15208// Freeze non-timer task queues in background, after allowed grace time.
209// "stop" is a legacy name.
210const base::Feature kStopNonTimersInBackground {
211 "stop-non-timers-in-background",
212#if defined(OS_ANDROID)
213 base::FEATURE_ENABLED_BY_DEFAULT
214#else
215 base::FEATURE_DISABLED_BY_DEFAULT
216#endif
217};
Scott Haseley7757f6c2018-08-03 14:33:23218
David Bokane9370c22019-02-14 15:19:58219// Enable text snippets in URL fragments. https://crbug.com/919204.
220const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
221 base::FEATURE_DISABLED_BY_DEFAULT};
222
Bill Budge4d028f12018-11-20 15:05:12223// Enables the site isolated Wasm code cache that is keyed on the resource URL
224// and the origin lock of the renderer that is requesting the resource. When
225// this flag is enabled, content/GeneratedCodeCache handles code cache requests.
226const base::Feature kWasmCodeCache = {"WasmCodeCache",
227 base::FEATURE_DISABLED_BY_DEFAULT};
228
Marijn Kruisselbrinkca4bb5e2019-04-22 18:19:42229// Writable files and native file system access. https://crbug.com/853326
230const base::Feature kNativeFileSystemAPI{"NativeFileSystemAPI",
Marijn Kruisselbrinkfa0e1052019-03-05 22:32:55231 base::FEATURE_DISABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44232
Jay Harris583f48922019-05-06 05:55:24233// File handling integration. https://crbug.com/829689
234const base::Feature kFileHandlingAPI{"FileHandlingAPI",
235 base::FEATURE_DISABLED_BY_DEFAULT};
236
kdillon66bf5b522019-01-02 22:08:30237// Allows for synchronous XHR requests during page dismissal
238const base::Feature kForbidSyncXHRInPageDismissal{
Katie Dillon54c1ad222019-04-18 23:49:52239 "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
kdillon66bf5b522019-01-02 22:08:30240
Carlos ILd3be52b2018-10-08 17:57:18241const char kMixedContentAutoupgradeModeParamName[] = "mode";
242const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
243const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
244 "optionally-blockable";
245
Madeleine Barowsky45be21a42018-12-07 18:39:30246// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
247// in the image decode cache. See crbug.com/900264 for details on the feature.
248const base::Feature kDecodeLossyWebPImagesToYUV{
249 "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
250
Aaron Krajeskif2f827d422019-01-08 15:08:34251// Use accelerated canvases whenever possible see https://crbug.com/909937
252const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas",
Aaron Krajeskiccfb9122019-04-25 21:28:44253 base::FEATURE_ENABLED_BY_DEFAULT};
Aaron Krajeskif2f827d422019-01-08 15:08:34254
Takashi Toyoshimaa91506d2019-03-28 05:44:42255// Enables cache-aware WebFonts loading. See https://crbug.com/570205.
256// The feature is disabled on Android for WebView API issue discussed at
257// https://crbug.com/942440.
258const base::Feature kWebFontsCacheAwareTimeoutAdaption {
259 "WebFontsCacheAwareTimeoutAdaption",
260#if defined(OS_ANDROID)
261 base::FEATURE_DISABLED_BY_DEFAULT
262#else
263 base::FEATURE_ENABLED_BY_DEFAULT
264#endif
265};
266
Ehsan Karamadbe95d122019-05-10 17:59:06267// Enabled to block programmatic focus in subframes when not triggered by user
268// activation (see htpps://crbug.com/954349).
269const base::Feature kBlockingFocusWithoutUserActivation{
270 "BlockingFocusWithoutUserActivation", base::FEATURE_DISABLED_BY_DEFAULT};
271
Hongchan Choi370d3af2019-05-20 20:56:58272const base::Feature kAudioWorkletRealtimeThread{
273 "AudioWorkletRealtimeThread", base::FEATURE_DISABLED_BY_DEFAULT};
274
Daniel Libby7da24b72019-05-22 05:46:35275// Use scroll gestures for scrollbar scrolls (see https://crbug.com/954007).
276const base::Feature kScrollbarInjectScrollGestures{
277 "ScrollbarInjectScrollGestures", base::FEATURE_DISABLED_BY_DEFAULT};
278
Hiroki Nakagawa893ee502019-02-04 06:49:53279bool IsOffMainThreadSharedWorkerScriptFetchEnabled() {
280 // Off-the-main-thread shared worker script fetch depends on PlzSharedWorker
281 // (NetworkService).
Hiroki Nakagawa893ee502019-02-04 06:49:53282 return base::FeatureList::IsEnabled(network::features::kNetworkService) &&
283 base::FeatureList::IsEnabled(
284 features::kOffMainThreadSharedWorkerScriptFetch);
285}
286
Hiroki Nakagawa7d8cbfa2019-02-07 11:01:28287bool IsPlzDedicatedWorkerEnabled() {
288 // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script
289 // fetch and NetworkService.
290#if DCHECK_IS_ON()
291 if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) {
292 DCHECK(base::FeatureList::IsEnabled(
293 features::kOffMainThreadDedicatedWorkerScriptFetch))
294 << "PlzDedicatedWorker is enabled but "
295 << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker "
296 << "requires OffMainThreadDedicatedWorkerScriptFetch.";
297 DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService))
298 << "PlzDedicatedWorker is enabled but NetworkService isn't. "
299 << "PlzDedicatedWorker requires NetworkService.";
300 }
301#endif // DCHECK_IS_ON()
302 return base::FeatureList::IsEnabled(
303 features::kOffMainThreadDedicatedWorkerScriptFetch) &&
304 base::FeatureList::IsEnabled(network::features::kNetworkService) &&
305 base::FeatureList::IsEnabled(features::kPlzDedicatedWorker);
306}
307
Matt Falkenhagen5cc652792018-06-21 10:34:33308} // namespace features
309} // namespace blink