Commit 5cc65279 authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

Move ServiceWorkerServicification to blink::features.

It's sometimes useful for Blink to define features instead of putting them in
//content. In this case, ServiceWorkerServicification.

Follow-up to r568796 <https://chromium-review.googlesource.com/1107435>.

Change-Id: Ia174481414f2ceeb2f463307436170628da84346
Reviewed-on: https://chromium-review.googlesource.com/1108237
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569209}
parent 5fabee49
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
#include "services/network/public/cpp/network_switches.h" #include "services/network/public/cpp/network_switches.h"
#include "services/service_manager/sandbox/switches.h" #include "services/service_manager/sandbox/switches.h"
#include "third_party/blink/public/common/experiments/memory_ablation_experiment.h" #include "third_party/blink/public/common/experiments/memory_ablation_experiment.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/libaom/av1_buildflags.h" #include "third_party/libaom/av1_buildflags.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
...@@ -1624,7 +1625,7 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -1624,7 +1625,7 @@ const FeatureEntry kFeatureEntries[] = {
{"enable-service-worker-servicification", {"enable-service-worker-servicification",
flag_descriptions::kServiceWorkerServicificationName, flag_descriptions::kServiceWorkerServicificationName,
flag_descriptions::kServiceWorkerServicificationDescription, kOsAll, flag_descriptions::kServiceWorkerServicificationDescription, kOsAll,
FEATURE_VALUE_TYPE(features::kServiceWorkerServicification)}, FEATURE_VALUE_TYPE(blink::features::kServiceWorkerServicification)},
{"enable-pwa-full-code-cache", {"enable-pwa-full-code-cache",
flag_descriptions::kEnablePWAFullCodeCacheName, flag_descriptions::kEnablePWAFullCodeCacheName,
flag_descriptions::kEnablePWAFullCodeCacheDescription, kOsAll, flag_descriptions::kEnablePWAFullCodeCacheDescription, kOsAll,
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
# //content/browser/resources/service_worker/ # //content/browser/resources/service_worker/
# //content/common/service_worker/ # //content/common/service_worker/
# //content/renderer/service_worker/ # //content/renderer/service_worker/
# //third_party/blink/common/service_worker/
# //third_party/blink/public/common/service_worker/
# //third_party/blink/public/mojom/service_worker/ # //third_party/blink/public/mojom/service_worker/
# //third_party/blink/public/web/modules/serviceworker/ # //third_party/blink/public/web/modules/serviceworker/
# //third_party/blink/public/platform/modules/serviceworker/ # //third_party/blink/public/platform/modules/serviceworker/
......
...@@ -681,10 +681,6 @@ bool BlinkPlatformImpl::AllowScriptExtensionForServiceWorker( ...@@ -681,10 +681,6 @@ bool BlinkPlatformImpl::AllowScriptExtensionForServiceWorker(
return GetContentClient()->AllowScriptExtensionForServiceWorker(scriptUrl); return GetContentClient()->AllowScriptExtensionForServiceWorker(scriptUrl);
} }
bool BlinkPlatformImpl::IsServiceWorkerNetServicificationEnabled() {
return ServiceWorkerUtils::IsServicificationEnabled();
}
blink::WebCrypto* BlinkPlatformImpl::Crypto() { blink::WebCrypto* BlinkPlatformImpl::Crypto() {
return &web_crypto_; return &web_crypto_;
} }
......
...@@ -97,7 +97,6 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform { ...@@ -97,7 +97,6 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform {
const blink::WebSize& cumulative_scroll) override; const blink::WebSize& cumulative_scroll) override;
bool AllowScriptExtensionForServiceWorker( bool AllowScriptExtensionForServiceWorker(
const blink::WebURL& script_url) override; const blink::WebURL& script_url) override;
bool IsServiceWorkerNetServicificationEnabled() override;
blink::WebCrypto* Crypto() override; blink::WebCrypto* Crypto() override;
const char* GetBrowserServiceName() const override; const char* GetBrowserServiceName() const override;
blink::WebMediaCapabilitiesClient* MediaCapabilitiesClient() override; blink::WebMediaCapabilitiesClient* MediaCapabilitiesClient() override;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "net/http/http_byte_range.h" #include "net/http/http_byte_range.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/service_worker/service_worker_utils.h"
namespace content { namespace content {
...@@ -140,8 +141,7 @@ bool ServiceWorkerUtils::AllOriginsMatchAndCanAccessServiceWorkers( ...@@ -140,8 +141,7 @@ bool ServiceWorkerUtils::AllOriginsMatchAndCanAccessServiceWorkers(
// static // static
bool ServiceWorkerUtils::IsServicificationEnabled() { bool ServiceWorkerUtils::IsServicificationEnabled() {
return base::FeatureList::IsEnabled(network::features::kNetworkService) || return blink::ServiceWorkerUtils::IsServicificationEnabled();
base::FeatureList::IsEnabled(features::kServiceWorkerServicification);
} }
bool ServiceWorkerUtils::ExtractSinglePartHttpRange( bool ServiceWorkerUtils::ExtractSinglePartHttpRange(
......
...@@ -51,6 +51,8 @@ class ServiceWorkerUtils { ...@@ -51,6 +51,8 @@ class ServiceWorkerUtils {
const std::vector<GURL>& urls); const std::vector<GURL>& urls);
// Returns true if servicified service worker is enabled. // Returns true if servicified service worker is enabled.
//
// TODO(falken): Remove this and have callsites use blink::ServiceWorkerUtils.
CONTENT_EXPORT static bool IsServicificationEnabled(); CONTENT_EXPORT static bool IsServicificationEnabled();
// Returns true if the |provider_id| was assigned by the browser process. // Returns true if the |provider_id| was assigned by the browser process.
......
...@@ -362,10 +362,6 @@ const base::Feature kServiceWorkerPaymentApps{ ...@@ -362,10 +362,6 @@ const base::Feature kServiceWorkerPaymentApps{
const base::Feature kServiceWorkerScriptFullCodeCache{ const base::Feature kServiceWorkerScriptFullCodeCache{
"ServiceWorkerScriptFullCodeCache", base::FEATURE_ENABLED_BY_DEFAULT}; "ServiceWorkerScriptFullCodeCache", base::FEATURE_ENABLED_BY_DEFAULT};
// Establish direct connection from clients to the service worker.
const base::Feature kServiceWorkerServicification{
"ServiceWorkerServicification", base::FEATURE_DISABLED_BY_DEFAULT};
// http://tc39.github.io/ecmascript_sharedmem/shmem.html // http://tc39.github.io/ecmascript_sharedmem/shmem.html
const base::Feature kSharedArrayBuffer{"SharedArrayBuffer", const base::Feature kSharedArrayBuffer{"SharedArrayBuffer",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -89,7 +89,6 @@ CONTENT_EXPORT extern const base::Feature ...@@ -89,7 +89,6 @@ CONTENT_EXPORT extern const base::Feature
CONTENT_EXPORT extern const base::Feature kSecMetadata; CONTENT_EXPORT extern const base::Feature kSecMetadata;
CONTENT_EXPORT extern const base::Feature kServiceWorkerPaymentApps; CONTENT_EXPORT extern const base::Feature kServiceWorkerPaymentApps;
CONTENT_EXPORT extern const base::Feature kServiceWorkerScriptFullCodeCache; CONTENT_EXPORT extern const base::Feature kServiceWorkerScriptFullCodeCache;
CONTENT_EXPORT extern const base::Feature kServiceWorkerServicification;
CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer; CONTENT_EXPORT extern const base::Feature kSharedArrayBuffer;
CONTENT_EXPORT extern const base::Feature kSignedHTTPExchange; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchange;
CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangeOriginTrial; CONTENT_EXPORT extern const base::Feature kSignedHTTPExchangeOriginTrial;
......
...@@ -21,6 +21,7 @@ jumbo_source_set("common") { ...@@ -21,6 +21,7 @@ jumbo_source_set("common") {
"device_memory/approximated_device_memory.cc", "device_memory/approximated_device_memory.cc",
"experiments/memory_ablation_experiment.cc", "experiments/memory_ablation_experiment.cc",
"feature_policy/feature_policy.cc", "feature_policy/feature_policy.cc",
"features.cc",
"frame/frame_policy.cc", "frame/frame_policy.cc",
"frame/user_activation_state.cc", "frame/user_activation_state.cc",
"manifest/manifest.cc", "manifest/manifest.cc",
...@@ -38,6 +39,7 @@ jumbo_source_set("common") { ...@@ -38,6 +39,7 @@ jumbo_source_set("common") {
"origin_manifest/origin_manifest.cc", "origin_manifest/origin_manifest.cc",
"origin_trials/trial_token.cc", "origin_trials/trial_token.cc",
"origin_trials/trial_token_validator.cc", "origin_trials/trial_token_validator.cc",
"service_worker/service_worker_utils.cc",
] ]
public_deps = [ public_deps = [
...@@ -48,6 +50,7 @@ jumbo_source_set("common") { ...@@ -48,6 +50,7 @@ jumbo_source_set("common") {
"//base", "//base",
"//mojo/public/cpp/system", "//mojo/public/cpp/system",
"//net", "//net",
"//services/network/public/cpp:cpp",
] ]
# iOS doesn't use and must not depend on //media # iOS doesn't use and must not depend on //media
......
...@@ -10,6 +10,7 @@ include_rules = [ ...@@ -10,6 +10,7 @@ include_rules = [
"+build", "+build",
"+net", "+net",
"+mojo", "+mojo",
"+services/network/public/cpp",
"+skia/public/interfaces/bitmap_skbitmap_struct_traits.h", "+skia/public/interfaces/bitmap_skbitmap_struct_traits.h",
"+testing/gmock/include/gmock", "+testing/gmock/include/gmock",
"+testing/gtest/include/gtest", "+testing/gtest/include/gtest",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/features.h"
namespace blink {
namespace features {
// Enable new service worker glue for NetworkService. Can be
// enabled independently of NetworkService.
const base::Feature kServiceWorkerServicification{
"ServiceWorkerServicification", base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace blink
file://content/browser/service_worker/OWNERS
# TEAM: worker-dev@chromium.org
# COMPONENT: Blink>ServiceWorker
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/common/service_worker/service_worker_utils.h"
#include "base/feature_list.h"
#include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/features.h"
namespace blink {
// static
bool ServiceWorkerUtils::IsServicificationEnabled() {
return base::FeatureList::IsEnabled(network::features::kNetworkService) ||
base::FeatureList::IsEnabled(
blink::features::kServiceWorkerServicification);
}
} // namespace blink
...@@ -38,6 +38,7 @@ source_set("headers") { ...@@ -38,6 +38,7 @@ source_set("headers") {
"device_memory/approximated_device_memory.h", "device_memory/approximated_device_memory.h",
"experiments/memory_ablation_experiment.h", "experiments/memory_ablation_experiment.h",
"feature_policy/feature_policy.h", "feature_policy/feature_policy.h",
"features.h",
"frame/frame_policy.h", "frame/frame_policy.h",
"frame/sandbox_flags.h", "frame/sandbox_flags.h",
"frame/user_activation_state.h", "frame/user_activation_state.h",
...@@ -59,6 +60,7 @@ source_set("headers") { ...@@ -59,6 +60,7 @@ source_set("headers") {
"screen_orientation/web_screen_orientation_enum_traits.h", "screen_orientation/web_screen_orientation_enum_traits.h",
"screen_orientation/web_screen_orientation_lock_type.h", "screen_orientation/web_screen_orientation_lock_type.h",
"screen_orientation/web_screen_orientation_type.h", "screen_orientation/web_screen_orientation_type.h",
"service_worker/service_worker_utils.h",
] ]
public_deps = [ public_deps = [
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_FEATURES_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_FEATURES_H_
#include "base/feature_list.h"
#include "third_party/blink/common/common_export.h"
namespace blink {
namespace features {
BLINK_COMMON_EXPORT extern const base::Feature kServiceWorkerServicification;
} // namespace features
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_FEATURES_H_
file://content/browser/service_worker/OWNERS
# TEAM: worker-dev@chromium.org
# COMPONENT: Blink>ServiceWorker
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#include "third_party/blink/common/common_export.h"
namespace blink {
class ServiceWorkerUtils {
public:
// Whether the new service worker glue for NetworkService is enabled (i.e.,
// the NetworkService or ServiceWorkerServicification feature is enabled).
// TODO(crbug.com/715640): Remove this after non-NetS13nSW is removed.
static bool BLINK_COMMON_EXPORT IsServicificationEnabled();
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
...@@ -626,12 +626,6 @@ class BLINK_PLATFORM_EXPORT Platform { ...@@ -626,12 +626,6 @@ class BLINK_PLATFORM_EXPORT Platform {
virtual bool AllowScriptExtensionForServiceWorker(const WebURL& script_url) { virtual bool AllowScriptExtensionForServiceWorker(const WebURL& script_url) {
return false; return false;
} }
// Whether the new service worker glue for NetworkService is enabled (i.e.,
// the NetworkService or ServiceWorkerServicification feature is enabled).
// TODO(falken): Make ServiceWorkerServicification a base::Feature inside
// the blink namespace, then this function can move out of platform.h and be
// implemented directly in blink.
virtual bool IsServiceWorkerNetServicificationEnabled() { return false; }
// WebCrypto ---------------------------------------------------------- // WebCrypto ----------------------------------------------------------
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "services/network/public/mojom/cors.mojom-blink.h" #include "services/network/public/mojom/cors.mojom-blink.h"
#include "services/network/public/mojom/fetch_api.mojom-blink.h" #include "services/network/public/mojom/fetch_api.mojom-blink.h"
#include "third_party/blink/public/common/service_worker/service_worker_utils.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_cors.h" #include "third_party/blink/public/platform/web_cors.h"
...@@ -354,7 +355,7 @@ void DocumentThreadableLoader::Start(const ResourceRequest& request) { ...@@ -354,7 +355,7 @@ void DocumentThreadableLoader::Start(const ResourceRequest& request) {
is_controlled_by_service_worker = true; is_controlled_by_service_worker = true;
break; break;
case blink::mojom::ControllerServiceWorkerMode::kNoFetchEventHandler: case blink::mojom::ControllerServiceWorkerMode::kNoFetchEventHandler:
if (Platform::Current()->IsServiceWorkerNetServicificationEnabled()) if (ServiceWorkerUtils::IsServicificationEnabled())
is_controlled_by_service_worker = false; is_controlled_by_service_worker = false;
else else
is_controlled_by_service_worker = true; is_controlled_by_service_worker = true;
......
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