blob: 3b668afe5a60646f51c0f77d6be20c51888806cb [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
Fabio Tirelo9b423c7b2018-08-15 14:32:1813const base::Feature kAutofillPreviewStyleExperiment{
14 "AutofillPreviewStyleExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
15
Stephen Chenneyde6e5c82019-01-21 01:56:0416// Enable defer commits a bit to avoid flash.
17const base::Feature kAvoidFlashBetweenNavigation{
18 "AvoidFlashBetweenNavigation", base::FEATURE_DISABLED_BY_DEFAULT};
19
Matt Falkenhagenc25fea42018-07-17 07:13:5220// Enable eagerly setting up a CacheStorage interface pointer and
21// passing it to service workers on startup as an optimization.
22const base::Feature kEagerCacheStorageSetupForServiceWorkers{
23 "EagerCacheStorageSetupForServiceWorkers",
24 base::FEATURE_ENABLED_BY_DEFAULT};
25
Eric Karl0623ec72018-10-30 19:43:2626// Controls the user-specified viewport restriction for GPU Rasterization on
27// mobile. See https://crbug.com/899399
28const base::Feature kEnableGpuRasterizationViewportRestriction{
29 "EnableGpuRasterizationViewportRestriction",
30 base::FEATURE_ENABLED_BY_DEFAULT};
31
Peter Kvitek197eaf72018-12-04 19:14:5632// Controls script streaming.
33const base::Feature kScriptStreaming{"ScriptStreaming",
34 base::FEATURE_ENABLED_BY_DEFAULT};
35
Liquan(Max) Gu4e243fc2018-11-17 00:13:0236// Enable FCP++ by experiment. See https://crbug.com/869924
37const base::Feature kFirstContentfulPaintPlusPlus{
38 "FirstContentfulPaintPlusPlus", base::FEATURE_DISABLED_BY_DEFAULT};
39
Makoto Shimazu172eec02018-11-29 06:21:4440// Tracks "jank" from layout objects changing their visual location between
41// animation frames (see crbug.com/581518).
42const base::Feature kJankTracking{"JankTracking",
Steve Kobes7995fdd2019-02-13 21:30:4343 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:4444
Steve Kobesaa9c7c22019-01-21 18:24:1345const base::Feature kJankTrackingSweepLine{"JankTrackingSweepLine",
46 base::FEATURE_DISABLED_BY_DEFAULT};
47
Philip Rogers63481332018-12-01 22:16:5148// Enable a new compositing mode called BlinkGenPropertyTrees where Blink
49// generates the compositor property trees. See: https://crbug.com/836884.
50const base::Feature kBlinkGenPropertyTrees{"BlinkGenPropertyTrees",
51 base::FEATURE_DISABLED_BY_DEFAULT};
52
Ian Kilpatricke68ef11a2018-07-04 03:52:1053// Enable LayoutNG.
54const base::Feature kLayoutNG{"LayoutNG", base::FEATURE_DISABLED_BY_DEFAULT};
55
Makoto Shimazu172eec02018-11-29 06:21:4456const base::Feature kMixedContentAutoupgrade{"AutoupgradeMixedContent",
57 base::FEATURE_DISABLED_BY_DEFAULT};
58
Marijn Kruisselbrinkcde64632018-06-22 22:45:1659// Enable mojo Blob URL interface and better blob URL lifetime management.
60// Can be enabled independently of NetworkService.
61const base::Feature kMojoBlobURLs{"MojoBlobURLs",
62 base::FEATURE_DISABLED_BY_DEFAULT};
63
Tarun Bansal422f9012019-01-23 16:55:5864// Used to control the collection of anchor element metrics (crbug.com/856683).
65// If kNavigationPredictor is enabled, then metrics of anchor elements
66// in the first viewport after the page load and the metrics of the clicked
67// anchor element will be extracted and recorded. Additionally, navigation
68// predictor may preconnect/prefetch to resources/origins to make the
69// future navigations faster.
70const base::Feature kNavigationPredictor{"NavigationPredictor",
71 base::FEATURE_DISABLED_BY_DEFAULT};
72
Hiroki Nakagawadf83a6f2019-01-28 06:07:4673// Enable off-the-main-thread dedicated worker script fetch.
74// (https://crbug.com/835717)
75const base::Feature kOffMainThreadDedicatedWorkerScriptFetch{
76 "OffMainThreadDedicatedWorkerScriptFetch",
77 base::FEATURE_DISABLED_BY_DEFAULT};
78
Hiroki Nakagawa893ee502019-02-04 06:49:5379// Enable off-the-main-thread shared worker script fetch.
80// (https://crbug.com/924041)
81const base::Feature kOffMainThreadSharedWorkerScriptFetch{
82 "OffMainThreadSharedWorkerScriptFetch", base::FEATURE_DISABLED_BY_DEFAULT};
83
Daniel Murphy80ce3022018-10-18 07:28:0784// Onion souping for all DOMStorage. https://crbug.com/781870
Daniel Murphy95792ef2018-10-04 01:29:5585const base::Feature kOnionSoupDOMStorage{"OnionSoupDOMStorage",
Daniel Murphydc4aa5a72019-02-07 22:08:4786 base::FEATURE_ENABLED_BY_DEFAULT};
Daniel Murphy95792ef2018-10-04 01:29:5587
Hiroki Nakagawa61ee0042019-01-22 06:30:2688// Enable browser-initiated dedicated worker script loading
89// (PlzDedicatedWorker). https://crbug.com/906991
90const base::Feature kPlzDedicatedWorker{"PlzDedicatedWorker",
91 base::FEATURE_DISABLED_BY_DEFAULT};
92
Daniel Murphy95792ef2018-10-04 01:29:5593// Enable Portals. https://crbug.com/865123.
94const base::Feature kPortals{"Portals", base::FEATURE_DISABLED_BY_DEFAULT};
95
David Bokan911bded2018-11-27 23:23:3296// Enable Implicit Root Scroller. https://crbug.com/903260.
97const base::Feature kImplicitRootScroller{"ImplicitRootScroller",
David Bokan5173a502019-01-11 22:06:4898 base::FEATURE_ENABLED_BY_DEFAULT};
David Bokan911bded2018-11-27 23:23:3299
Makoto Shimazu172eec02018-11-29 06:21:44100// Enables usage of getDisplayMedia() that allows capture of web content, see
101// https://crbug.com/865060.
102const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
103 base::FEATURE_ENABLED_BY_DEFAULT};
104
105// Changes the default RTCPeerConnection constructor behavior to use Unified
106// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
107// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
108// argument).
109const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56110 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44111
Johannes Kronad5a4532019-01-09 11:17:46112// Determines if the SDP attrbute extmap-allow-mixed should be offered by
113// default or not. The default value can be overridden by passing
114// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
115// constructor.
116const base::Feature kRTCOfferExtmapAllowMixed{
117 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
118
Makoto Shimazufc82e992018-12-05 07:14:28119// Enables to load the response body through Mojo data pipe passed by
120// WebURLLoaderClient::DidStartLoadingResponseBody() instead of
121// WebURLLoaderClient::DidReceiveData().
122const base::Feature kResourceLoadViaDataPipe{"ResourceLoadViaDataPipe",
Caleb Rouleaue92139b2019-02-08 03:00:34123 base::FEATURE_DISABLED_BY_DEFAULT};
Makoto Shimazufc82e992018-12-05 07:14:28124
momohattfc352292018-08-29 05:12:36125const base::Feature kServiceWorkerImportedScriptUpdateCheck{
126 "ServiceWorkerImportedScriptUpdateCheck",
127 base::FEATURE_DISABLED_BY_DEFAULT};
128
Ben Kellye20dc402018-09-18 01:55:42129// Enables reading a subresource's body data and side data in parallel.
130const base::Feature kServiceWorkerParallelSideDataReading{
131 "ServiceWorkerParallelSideDataReading", base::FEATURE_ENABLED_BY_DEFAULT};
132
Kenichi Ishibashi42f883d2019-01-11 08:26:14133const base::Feature kServiceWorkerAggressiveCodeCache{
134 "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT};
135
Matt Falkenhagen5cc652792018-06-21 10:34:33136// Enable new service worker glue for NetworkService. Can be
137// enabled independently of NetworkService.
138const base::Feature kServiceWorkerServicification{
Matt Falkenhagen5d2271c2018-10-17 10:12:44139 "ServiceWorkerServicification", base::FEATURE_ENABLED_BY_DEFAULT};
Matt Falkenhagen5cc652792018-06-21 10:34:33140
Scott Haseley8eefdcd2018-08-22 16:50:19141// Freeze scheduler task queues in background after allowed grace time.
142// "stop" is a legacy name.
143const base::Feature kStopInBackground {
144 "stop-in-background",
145#if defined(OS_ANDROID)
146 base::FEATURE_ENABLED_BY_DEFAULT
147#else
148 base::FEATURE_DISABLED_BY_DEFAULT
149#endif
150};
151
Shubhie Panicker60bd4b02018-09-26 00:02:15152// Freeze non-timer task queues in background, after allowed grace time.
153// "stop" is a legacy name.
154const base::Feature kStopNonTimersInBackground {
155 "stop-non-timers-in-background",
156#if defined(OS_ANDROID)
157 base::FEATURE_ENABLED_BY_DEFAULT
158#else
159 base::FEATURE_DISABLED_BY_DEFAULT
160#endif
161};
Scott Haseley7757f6c2018-08-03 14:33:23162
David Bokane9370c22019-02-14 15:19:58163// Enable text snippets in URL fragments. https://crbug.com/919204.
164const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
165 base::FEATURE_DISABLED_BY_DEFAULT};
166
Bill Budge4d028f12018-11-20 15:05:12167// Enables the site isolated Wasm code cache that is keyed on the resource URL
168// and the origin lock of the renderer that is requesting the resource. When
169// this flag is enabled, content/GeneratedCodeCache handles code cache requests.
170const base::Feature kWasmCodeCache = {"WasmCodeCache",
171 base::FEATURE_DISABLED_BY_DEFAULT};
172
Makoto Shimazu172eec02018-11-29 06:21:44173// Writable files and native filesystem access. https://crbug.com/853326
174const base::Feature kWritableFilesAPI{"WritableFilesAPI",
175 base::FEATURE_DISABLED_BY_DEFAULT};
176
kdillon66bf5b522019-01-02 22:08:30177// Allows for synchronous XHR requests during page dismissal
178const base::Feature kForbidSyncXHRInPageDismissal{
179 "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
180
Fabio Tirelo9b423c7b2018-08-15 14:32:18181const char kAutofillPreviewStyleExperimentBgColorParameterName[] = "bg_color";
182
183const char kAutofillPreviewStyleExperimentColorParameterName[] = "color";
184
Carlos ILd3be52b2018-10-08 17:57:18185const char kMixedContentAutoupgradeModeParamName[] = "mode";
186const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
187const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
188 "optionally-blockable";
189
Madeleine Barowsky45be21a42018-12-07 18:39:30190// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
191// in the image decode cache. See crbug.com/900264 for details on the feature.
192const base::Feature kDecodeLossyWebPImagesToYUV{
193 "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
194
Aaron Krajeskif2f827d422019-01-08 15:08:34195// Use accelerated canvases whenever possible see https://crbug.com/909937
196const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas",
197 base::FEATURE_DISABLED_BY_DEFAULT};
198
Hiroki Nakagawa893ee502019-02-04 06:49:53199bool IsOffMainThreadSharedWorkerScriptFetchEnabled() {
200 // Off-the-main-thread shared worker script fetch depends on PlzSharedWorker
201 // (NetworkService).
202 DCHECK(!base::FeatureList::IsEnabled(
203 features::kOffMainThreadSharedWorkerScriptFetch) ||
204 base::FeatureList::IsEnabled(network::features::kNetworkService))
205 << "OffMainThreadSharedWorkerScriptFetch is enabled but NetworkService "
206 << "isn't. OffMainThreadSharedWorkerScriptFetch requires NetworkService.";
207 return base::FeatureList::IsEnabled(network::features::kNetworkService) &&
208 base::FeatureList::IsEnabled(
209 features::kOffMainThreadSharedWorkerScriptFetch);
210}
211
Hiroki Nakagawa7d8cbfa2019-02-07 11:01:28212bool IsPlzDedicatedWorkerEnabled() {
213 // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script
214 // fetch and NetworkService.
215#if DCHECK_IS_ON()
216 if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) {
217 DCHECK(base::FeatureList::IsEnabled(
218 features::kOffMainThreadDedicatedWorkerScriptFetch))
219 << "PlzDedicatedWorker is enabled but "
220 << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker "
221 << "requires OffMainThreadDedicatedWorkerScriptFetch.";
222 DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService))
223 << "PlzDedicatedWorker is enabled but NetworkService isn't. "
224 << "PlzDedicatedWorker requires NetworkService.";
225 }
226#endif // DCHECK_IS_ON()
227 return base::FeatureList::IsEnabled(
228 features::kOffMainThreadDedicatedWorkerScriptFetch) &&
229 base::FeatureList::IsEnabled(network::features::kNetworkService) &&
230 base::FeatureList::IsEnabled(features::kPlzDedicatedWorker);
231}
232
Matt Falkenhagen5cc652792018-06-21 10:34:33233} // namespace features
234} // namespace blink