0

Add ServiceWorkerAutoPreload to chrome://flags

Adding the ServiceWorkerAutoPreload feature flags to chrome://flags, so
that developers and partners can try the feature on their sides.

To add it to chrome://flags, the feature flag
`kServiceWorkerAutoPreload` will be moved from content/common/features
to content/public/common/content_features.

Bug: 379052301
Change-Id: I30300642e4df4fa1c23feff758b16dff3b20417e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6022204
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Commit-Queue: Shunya Shishido <sisidovski@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1383435}
This commit is contained in:
Shunya Shishido
2024-11-15 06:14:17 +00:00
committed by Chromium LUCI CQ
parent 7caea6864b
commit 519c739fab
12 changed files with 49 additions and 17 deletions

@ -4248,6 +4248,15 @@ const FeatureEntry::FeatureVariation
#endif // BUILDFLAG(IS_ANDROID) && PA_BUILDFLAG(HAS_MEMORY_TAGGING) &&
// PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
const FeatureEntry::FeatureParam kServiceWorkerAutoPreload_SWNotRunningOnly[] =
{
{"enable_only_when_service_worker_not_running", "true"},
};
const FeatureEntry::FeatureVariation kServiceWorkerAutoPreloadVariations[] = {
{"only when SW is not running", kServiceWorkerAutoPreload_SWNotRunningOnly,
std::size(kServiceWorkerAutoPreload_SWNotRunningOnly), nullptr},
};
// RECORDING USER METRICS FOR FLAGS:
// -----------------------------------------------------------------------------
// The first line of the entry is the internal name.
@ -11831,6 +11840,13 @@ const FeatureEntry kFeatureEntries[] = {
kOsMac | kOsWin | kOsLinux, FEATURE_VALUE_TYPE(features::kGlic)},
#endif // ENABLE_GLIC
{"service-worker-auto-preload",
flag_descriptions::kServiceWorkerAutoPreloadName,
flag_descriptions::kServiceWorkerAutoPreloadDescription, kOsAll,
FEATURE_WITH_PARAMS_VALUE_TYPE(features::kServiceWorkerAutoPreload,
kServiceWorkerAutoPreloadVariations,
"ServiceWorkerAutoPreload")},
// NOTE: Adding a new flag requires adding a corresponding entry to enum
// "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag
// Histograms" in tools/metrics/histograms/README.md (run the

@ -7948,6 +7948,11 @@
"owners": ["tbarzic@chromium.org", "owenzhang@google.com"],
"expiry_milestone": 130
},
{
"name": "service-worker-auto-preload",
"owners": ["sisidovski@chromium.org", "chrome-worker@google.com"],
"expiry_milestone": 136
},
{
"name": "set-market-url-for-testing",
"owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/omaha/OWNERS" ],

@ -3462,6 +3462,12 @@ const char kSegmentationSurveyPageName[] =
const char kSegmentationSurveyPageDescription[] =
"Enable internals page for survey and fetching model";
const char kServiceWorkerAutoPreloadName[] = "ServiceWorkerAutoPreload";
const char kServiceWorkerAutoPreloadDescription[] =
"Dispatches a preload request for navigation before starting the service "
"worker. See "
"https://github.com/explainers-by-googlers/service-worker-auto-preload";
const char kSharedZstdName[] = "Shared Zstd";
const char kSharedZstdDescription[] =
"Enables compression dictionary transport with Zstandard (aka Shared "

@ -1972,6 +1972,9 @@ extern const char kSecurePaymentConfirmationNetworkAndIssuerIconsDescription[];
extern const char kSegmentationSurveyPageName[];
extern const char kSegmentationSurveyPageDescription[];
extern const char kServiceWorkerAutoPreloadName[];
extern const char kServiceWorkerAutoPreloadDescription[];
extern const char kSharedZstdName[];
extern const char kSharedZstdDescription[];

@ -504,19 +504,6 @@ BASE_FEATURE(kRunStableVideoDecoderFactoryProcessServiceOnIOThread,
"RunStableVideoDecoderFactoryProcessServiceOnIOThread",
base::FEATURE_ENABLED_BY_DEFAULT);
// Enables auto preloading for fetch requests before invoking the fetch handler
// in ServiceWorker. The fetch request inside the fetch handler is resolved with
// this preload response. If the fetch handler result is fallback, uses this
// preload request as a fallback network request.
//
// Unlike navigation preload, this preloading is applied to subresources. Also,
// it doesn't require a developer opt-in.
//
// crbug.com/1472634 for more details.
BASE_FEATURE(kServiceWorkerAutoPreload,
"ServiceWorkerAutoPreload",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kServiceWorkerAvoidMainThreadForInitialization,
"ServiceWorkerAvoidMainThreadForInitialization",
#if BUILDFLAG(IS_ANDROID)

@ -123,7 +123,6 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(
CONTENT_EXPORT BASE_DECLARE_FEATURE(kRemoveRendererProcessLimit);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kReuseInitialRenderFrameHostForWebUI);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kSendBeaconThrowForBlobWithNonSimpleType);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kServiceWorkerAutoPreload);
CONTENT_EXPORT BASE_DECLARE_FEATURE(
kServiceWorkerAvoidMainThreadForInitialization);
CONTENT_EXPORT BASE_DECLARE_FEATURE(

@ -13,7 +13,7 @@
#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/field_trial_params.h"
#include "content/common/features.h"
#include "content/public/common/content_features.h"
#include "mojo/public/c/system/types.h"
#include "net/base/io_buffer.h"
#include "services/network/public/cpp/features.h"

@ -12,8 +12,8 @@
#include "base/containers/span.h"
#include "base/metrics/field_trial_params.h"
#include "base/system/sys_info.h"
#include "content/common/features.h"
#include "content/common/service_worker/race_network_request_url_loader_client.h"
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/public/cpp/system/simple_watcher.h"
#include "services/network/public/cpp/features.h"

@ -8,7 +8,7 @@
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
#include "content/common/features.h"
#include "content/public/common/content_features.h"
#include "services/network/public/mojom/service_worker_router_info.mojom-shared.h"
namespace content {

@ -957,6 +957,19 @@ constexpr base::FeatureParam<double> kProcessPerSiteMainFrameTotalMemoryLimit{
&kProcessPerSiteUpToMainFrameThreshold,
"ProcessPerSiteMainFrameTotalMemoryLimit", 2 * 1024 * 1024 * 1024u};
// Enables auto preloading for fetch requests before invoking the fetch handler
// in ServiceWorker. The fetch request inside the fetch handler is resolved with
// this preload response. If the fetch handler result is fallback, uses this
// preload request as a fallback network request.
//
// Unlike navigation preload, this preloading is applied to subresources. Also,
// it doesn't require a developer opt-in.
//
// crbug.com/1472634 for more details.
BASE_FEATURE(kServiceWorkerAutoPreload,
"ServiceWorkerAutoPreload",
base::FEATURE_DISABLED_BY_DEFAULT);
// Enables ServiceWorker static routing API.
// https://github.com/WICG/service-worker-static-routing-api
BASE_FEATURE(kServiceWorkerStaticRouter,

@ -247,6 +247,7 @@ extern const base::FeatureParam<SkiaFontServiceTypefaceType>
CONTENT_EXPORT BASE_DECLARE_FEATURE(kUtilityWithUiPumpInitializesCom);
#endif // BUILDFLAG(IS_WIN)
CONTENT_EXPORT BASE_DECLARE_FEATURE(kDisableProcessReuse);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kServiceWorkerAutoPreload);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kServiceWorkerStaticRouter);
CONTENT_EXPORT BASE_DECLARE_FEATURE(
kServiceWorkerStaticRouterRaceNetworkRequestPerformanceImprovement);

@ -18087,6 +18087,7 @@ from previous Chrome versions.
<int value="-885209667" label="FilesZipMount:disabled"/>
<int value="-884864731" label="WebPaymentsSingleAppUiSkip:enabled"/>
<int value="-884783216" label="ForceEnableFastCheckoutCapabilities:enabled"/>
<int value="-884480360" label="ServiceWorkerAutoPreload:disabled"/>
<int value="-884142134" label="TaskManagerDesktopRefresh:enabled"/>
<int value="-883694393" label="SyncPseudoUSSSupervisedUsers:disabled"/>
<int value="-883608641" label="enable-cros-action-recorder"/>
@ -24902,6 +24903,7 @@ from previous Chrome versions.
<int value="1843847665" label="SyncPromoAfterSigninIntercept:disabled"/>
<int value="1844110073" label="enable-app-view"/>
<int value="1844222711" label="AssistantConsentV2:disabled"/>
<int value="1845138535" label="ServiceWorkerAutoPreload:enabled"/>
<int value="1845205143" label="ShowSuggestionsOnAutofocus:disabled"/>
<int value="1845781020" label="DesktopSharePreview:disabled"/>
<int value="1846717591" label="CaptureMode:disabled"/>