Commit dc348bc8 authored by Mugdha Lakhani's avatar Mugdha Lakhani Committed by Commit Bot

[Background Fetch] Add feature flag for access to

active background fetches.
This allows iterative implementation of this feature.

Bug: 875201
Change-Id: Ia349eb55e682cf22825b53559c8e1f603d189501
Reviewed-on: https://chromium-review.googlesource.com/c/1331397Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Mugdha Lakhani <nator@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607537}
parent bb0fc8da
...@@ -496,6 +496,10 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( ...@@ -496,6 +496,10 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
if (!base::FeatureList::IsEnabled(features::kBackgroundFetch)) if (!base::FeatureList::IsEnabled(features::kBackgroundFetch))
WebRuntimeFeatures::EnableBackgroundFetch(false); WebRuntimeFeatures::EnableBackgroundFetch(false);
WebRuntimeFeatures::EnableBackgroundFetchAccessActiveFetches(
base::FeatureList::IsEnabled(
features::kBackgroundFetchAccessActiveFetches));
WebRuntimeFeatures::EnableBackgroundFetchUploads( WebRuntimeFeatures::EnableBackgroundFetchUploads(
base::FeatureList::IsEnabled(features::kBackgroundFetchUploads)); base::FeatureList::IsEnabled(features::kBackgroundFetchUploads));
......
...@@ -53,6 +53,10 @@ const base::Feature kAwaitOptimization{"AwaitOptimization", ...@@ -53,6 +53,10 @@ const base::Feature kAwaitOptimization{"AwaitOptimization",
const base::Feature kBackgroundFetch{"BackgroundFetch", const base::Feature kBackgroundFetch{"BackgroundFetch",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// Enables access to active background fetches.
const base::Feature kBackgroundFetchAccessActiveFetches{
"BackgroundFetchAccessActiveFetches", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables using uploads in a Background Fetch. // Enables using uploads in a Background Fetch.
const base::Feature kBackgroundFetchUploads{"BackgroundFetchUploads", const base::Feature kBackgroundFetchUploads{"BackgroundFetchUploads",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -26,6 +26,7 @@ CONTENT_EXPORT extern const base::Feature kAudioServiceLaunchOnStartup; ...@@ -26,6 +26,7 @@ CONTENT_EXPORT extern const base::Feature kAudioServiceLaunchOnStartup;
CONTENT_EXPORT extern const base::Feature kAudioServiceOutOfProcess; CONTENT_EXPORT extern const base::Feature kAudioServiceOutOfProcess;
CONTENT_EXPORT extern const base::Feature kAwaitOptimization; CONTENT_EXPORT extern const base::Feature kAwaitOptimization;
CONTENT_EXPORT extern const base::Feature kBackgroundFetch; CONTENT_EXPORT extern const base::Feature kBackgroundFetch;
CONTENT_EXPORT extern const base::Feature kBackgroundFetchAccessActiveFetches;
CONTENT_EXPORT extern const base::Feature kBackgroundFetchUploads; CONTENT_EXPORT extern const base::Feature kBackgroundFetchUploads;
CONTENT_EXPORT extern const base::Feature kBlinkHeapIncrementalMarking; CONTENT_EXPORT extern const base::Feature kBlinkHeapIncrementalMarking;
CONTENT_EXPORT extern const base::Feature kBlinkHeapUnifiedGarbageCollection; CONTENT_EXPORT extern const base::Feature kBlinkHeapUnifiedGarbageCollection;
......
...@@ -82,6 +82,8 @@ class WebRuntimeFeatures { ...@@ -82,6 +82,8 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableAllowActivationDelegationAttr(bool); BLINK_PLATFORM_EXPORT static void EnableAllowActivationDelegationAttr(bool);
BLINK_PLATFORM_EXPORT static void EnableAudioOutputDevices(bool); BLINK_PLATFORM_EXPORT static void EnableAudioOutputDevices(bool);
BLINK_PLATFORM_EXPORT static void EnableBackgroundFetch(bool); BLINK_PLATFORM_EXPORT static void EnableBackgroundFetch(bool);
BLINK_PLATFORM_EXPORT static void EnableBackgroundFetchAccessActiveFetches(
bool);
BLINK_PLATFORM_EXPORT static void EnableBackgroundFetchUploads(bool); BLINK_PLATFORM_EXPORT static void EnableBackgroundFetchUploads(bool);
BLINK_PLATFORM_EXPORT static void EnableBlinkHeapIncrementalMarking(bool); BLINK_PLATFORM_EXPORT static void EnableBlinkHeapIncrementalMarking(bool);
BLINK_PLATFORM_EXPORT static void EnableBlinkHeapUnifiedGarbageCollection( BLINK_PLATFORM_EXPORT static void EnableBlinkHeapUnifiedGarbageCollection(
......
...@@ -181,7 +181,8 @@ ScriptPromise BackgroundFetchRegistration::MatchImpl( ...@@ -181,7 +181,8 @@ ScriptPromise BackgroundFetchRegistration::MatchImpl(
bool match_all) { bool match_all) {
// TODO(crbug.com/875201): Update this check once we support access to active // TODO(crbug.com/875201): Update this check once we support access to active
// fetches. // fetches.
if (result_ == mojom::BackgroundFetchResult::UNSET) { if (result_ == mojom::BackgroundFetchResult::UNSET &&
!RuntimeEnabledFeatures::BackgroundFetchAccessActiveFetchesEnabled()) {
return ScriptPromise::RejectWithDOMException( return ScriptPromise::RejectWithDOMException(
script_state, script_state,
DOMException::Create( DOMException::Create(
......
...@@ -568,6 +568,10 @@ void WebRuntimeFeatures::EnableBackgroundFetch(bool enable) { ...@@ -568,6 +568,10 @@ void WebRuntimeFeatures::EnableBackgroundFetch(bool enable) {
RuntimeEnabledFeatures::SetBackgroundFetchEnabled(enable); RuntimeEnabledFeatures::SetBackgroundFetchEnabled(enable);
} }
void WebRuntimeFeatures::EnableBackgroundFetchAccessActiveFetches(bool enable) {
RuntimeEnabledFeatures::SetBackgroundFetchAccessActiveFetchesEnabled(enable);
}
void WebRuntimeFeatures::EnableBackgroundFetchUploads(bool enable) { void WebRuntimeFeatures::EnableBackgroundFetchUploads(bool enable) {
RuntimeEnabledFeatures::SetBackgroundFetchUploadsEnabled(enable); RuntimeEnabledFeatures::SetBackgroundFetchUploadsEnabled(enable);
} }
......
...@@ -117,6 +117,10 @@ ...@@ -117,6 +117,10 @@
origin_trial_feature_name: "BackgroundFetch", origin_trial_feature_name: "BackgroundFetch",
status: "experimental", status: "experimental",
}, },
{
name: "BackgroundFetchAccessActiveFetches",
status: "experimental",
},
{ {
name: "BackgroundFetchUploads", name: "BackgroundFetchUploads",
status: "experimental", status: "experimental",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment