blob: 0024bee809979bc7ceb925717e1ee7b6447cbe0e [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
Tarun Bansal8df12b52019-02-15 05:46:3096// Enable limiting previews loading hints to specific resource types.
97const base::Feature kPreviewsResourceLoadingHintsSpecificResourceTypes{
98 "PreviewsResourceLoadingHintsSpecificResourceTypes",
99 base::FEATURE_DISABLED_BY_DEFAULT};
100
Aditya Keerthiacee82f2019-02-15 16:48:08101// Purge memory when freezing only if the renderer is backgrounded.
102const base::Feature kPurgeMemoryOnlyForBackgroundedProcesses{
103 "FreezePurgeMemoryBackgroundedOnly", base::FEATURE_DISABLED_BY_DEFAULT};
104
David Bokan911bded2018-11-27 23:23:32105// Enable Implicit Root Scroller. https://crbug.com/903260.
106const base::Feature kImplicitRootScroller{"ImplicitRootScroller",
David Bokan5173a502019-01-11 22:06:48107 base::FEATURE_ENABLED_BY_DEFAULT};
David Bokan911bded2018-11-27 23:23:32108
Makoto Shimazu172eec02018-11-29 06:21:44109// Enables usage of getDisplayMedia() that allows capture of web content, see
110// https://crbug.com/865060.
111const base::Feature kRTCGetDisplayMedia{"RTCGetDisplayMedia",
112 base::FEATURE_ENABLED_BY_DEFAULT};
113
114// Changes the default RTCPeerConnection constructor behavior to use Unified
115// Plan as the SDP semantics. When the feature is enabled, Unified Plan is used
116// unless the default is overridden (by passing {sdpSemantics:'plan-b'} as the
117// argument).
118const base::Feature kRTCUnifiedPlanByDefault{"RTCUnifiedPlanByDefault",
Henrik Boström07021ec82019-01-17 22:23:56119 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazu172eec02018-11-29 06:21:44120
Johannes Kronad5a4532019-01-09 11:17:46121// Determines if the SDP attrbute extmap-allow-mixed should be offered by
122// default or not. The default value can be overridden by passing
123// {offerExtmapAllowMixed:true} as an argument to the RTCPeerConnection
124// constructor.
125const base::Feature kRTCOfferExtmapAllowMixed{
126 "RTCOfferExtmapAllowMixed", base::FEATURE_DISABLED_BY_DEFAULT};
127
Makoto Shimazufc82e992018-12-05 07:14:28128// Enables to load the response body through Mojo data pipe passed by
129// WebURLLoaderClient::DidStartLoadingResponseBody() instead of
130// WebURLLoaderClient::DidReceiveData().
131const base::Feature kResourceLoadViaDataPipe{"ResourceLoadViaDataPipe",
Yutaka Hiranoce92866e2019-02-21 07:57:36132 base::FEATURE_ENABLED_BY_DEFAULT};
Makoto Shimazufc82e992018-12-05 07:14:28133
momohattfc352292018-08-29 05:12:36134const base::Feature kServiceWorkerImportedScriptUpdateCheck{
135 "ServiceWorkerImportedScriptUpdateCheck",
136 base::FEATURE_DISABLED_BY_DEFAULT};
137
Ben Kellye20dc402018-09-18 01:55:42138// Enables reading a subresource's body data and side data in parallel.
139const base::Feature kServiceWorkerParallelSideDataReading{
140 "ServiceWorkerParallelSideDataReading", base::FEATURE_ENABLED_BY_DEFAULT};
141
Kenichi Ishibashi42f883d2019-01-11 08:26:14142const base::Feature kServiceWorkerAggressiveCodeCache{
143 "ServiceWorkerAggressiveCodeCache", base::FEATURE_DISABLED_BY_DEFAULT};
144
Matt Falkenhagen5cc652792018-06-21 10:34:33145// Enable new service worker glue for NetworkService. Can be
146// enabled independently of NetworkService.
147const base::Feature kServiceWorkerServicification{
Matt Falkenhagen5d2271c2018-10-17 10:12:44148 "ServiceWorkerServicification", base::FEATURE_ENABLED_BY_DEFAULT};
Matt Falkenhagen5cc652792018-06-21 10:34:33149
Scott Haseley8eefdcd2018-08-22 16:50:19150// Freeze scheduler task queues in background after allowed grace time.
151// "stop" is a legacy name.
152const base::Feature kStopInBackground {
153 "stop-in-background",
154#if defined(OS_ANDROID)
155 base::FEATURE_ENABLED_BY_DEFAULT
156#else
157 base::FEATURE_DISABLED_BY_DEFAULT
158#endif
159};
160
Shubhie Panicker60bd4b02018-09-26 00:02:15161// Freeze non-timer task queues in background, after allowed grace time.
162// "stop" is a legacy name.
163const base::Feature kStopNonTimersInBackground {
164 "stop-non-timers-in-background",
165#if defined(OS_ANDROID)
166 base::FEATURE_ENABLED_BY_DEFAULT
167#else
168 base::FEATURE_DISABLED_BY_DEFAULT
169#endif
170};
Scott Haseley7757f6c2018-08-03 14:33:23171
David Bokane9370c22019-02-14 15:19:58172// Enable text snippets in URL fragments. https://crbug.com/919204.
173const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
174 base::FEATURE_DISABLED_BY_DEFAULT};
175
Bill Budge4d028f12018-11-20 15:05:12176// Enables the site isolated Wasm code cache that is keyed on the resource URL
177// and the origin lock of the renderer that is requesting the resource. When
178// this flag is enabled, content/GeneratedCodeCache handles code cache requests.
179const base::Feature kWasmCodeCache = {"WasmCodeCache",
180 base::FEATURE_DISABLED_BY_DEFAULT};
181
Makoto Shimazu172eec02018-11-29 06:21:44182// Writable files and native filesystem access. https://crbug.com/853326
183const base::Feature kWritableFilesAPI{"WritableFilesAPI",
184 base::FEATURE_DISABLED_BY_DEFAULT};
185
kdillon66bf5b522019-01-02 22:08:30186// Allows for synchronous XHR requests during page dismissal
187const base::Feature kForbidSyncXHRInPageDismissal{
188 "ForbidSyncXHRInPageDismissal", base::FEATURE_DISABLED_BY_DEFAULT};
189
Balazs Engedy130ab802019-02-22 12:14:00190// Emergency lever that can be used to restore DeviceOrientationEvent and
191// DeviceMotionEvent functionality in non-secure browsing contexts.
192// See: https://crbug.com/932078.
193const base::Feature kRestrictDeviceSensorEventsToSecureContexts{
194 "RestrictDeviceSensorEventsToSecureContexts",
195 base::FEATURE_DISABLED_BY_DEFAULT};
196
Fabio Tirelo9b423c7b2018-08-15 14:32:18197const char kAutofillPreviewStyleExperimentBgColorParameterName[] = "bg_color";
198
199const char kAutofillPreviewStyleExperimentColorParameterName[] = "color";
200
Carlos ILd3be52b2018-10-08 17:57:18201const char kMixedContentAutoupgradeModeParamName[] = "mode";
202const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
203const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
204 "optionally-blockable";
205
Madeleine Barowsky45be21a42018-12-07 18:39:30206// Decodes lossy WebP images to YUV instead of RGBX and stores in this format
207// in the image decode cache. See crbug.com/900264 for details on the feature.
208const base::Feature kDecodeLossyWebPImagesToYUV{
209 "DecodeLossyWebPImagesToYUV", base::FEATURE_DISABLED_BY_DEFAULT};
210
Aaron Krajeskif2f827d422019-01-08 15:08:34211// Use accelerated canvases whenever possible see https://crbug.com/909937
212const base::Feature kAlwaysAccelerateCanvas{"AlwaysAccelerateCanvas",
213 base::FEATURE_DISABLED_BY_DEFAULT};
214
Hiroki Nakagawa893ee502019-02-04 06:49:53215bool IsOffMainThreadSharedWorkerScriptFetchEnabled() {
216 // Off-the-main-thread shared worker script fetch depends on PlzSharedWorker
217 // (NetworkService).
218 DCHECK(!base::FeatureList::IsEnabled(
219 features::kOffMainThreadSharedWorkerScriptFetch) ||
220 base::FeatureList::IsEnabled(network::features::kNetworkService))
221 << "OffMainThreadSharedWorkerScriptFetch is enabled but NetworkService "
222 << "isn't. OffMainThreadSharedWorkerScriptFetch requires NetworkService.";
223 return base::FeatureList::IsEnabled(network::features::kNetworkService) &&
224 base::FeatureList::IsEnabled(
225 features::kOffMainThreadSharedWorkerScriptFetch);
226}
227
Hiroki Nakagawa7d8cbfa2019-02-07 11:01:28228bool IsPlzDedicatedWorkerEnabled() {
229 // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script
230 // fetch and NetworkService.
231#if DCHECK_IS_ON()
232 if (base::FeatureList::IsEnabled(features::kPlzDedicatedWorker)) {
233 DCHECK(base::FeatureList::IsEnabled(
234 features::kOffMainThreadDedicatedWorkerScriptFetch))
235 << "PlzDedicatedWorker is enabled but "
236 << "OffMainThreadDedicatedWorkerScriptFetch isn't. PlzDedicatedWorker "
237 << "requires OffMainThreadDedicatedWorkerScriptFetch.";
238 DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService))
239 << "PlzDedicatedWorker is enabled but NetworkService isn't. "
240 << "PlzDedicatedWorker requires NetworkService.";
241 }
242#endif // DCHECK_IS_ON()
243 return base::FeatureList::IsEnabled(
244 features::kOffMainThreadDedicatedWorkerScriptFetch) &&
245 base::FeatureList::IsEnabled(network::features::kNetworkService) &&
246 base::FeatureList::IsEnabled(features::kPlzDedicatedWorker);
247}
248
Matt Falkenhagen5cc652792018-06-21 10:34:33249} // namespace features
250} // namespace blink