Commit e6b51727 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

Add base::Feature for AppCache (default on)

This is to enable developers to turn it off for testing what future
deprecation will look like.

Bug: 582750,1055010
Change-Id: I7ea0570ec6cda99ec8027219ba5f272d875b679c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2124237
Commit-Queue: enne <enne@chromium.org>
Reviewed-by: default avatarTao Bai <michaelbai@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755426}
parent 16b569f8
......@@ -409,7 +409,8 @@ void AwSettings::PopulateWebPreferencesLocked(JNIEnv* env,
web_prefs->plugins_enabled = false;
web_prefs->application_cache_enabled =
Java_AwSettings_getAppCacheEnabledLocked(env, obj);
Java_AwSettings_getAppCacheEnabledLocked(env, obj) &&
content::StoragePartition::IsAppCacheEnabled();
web_prefs->local_storage_enabled =
Java_AwSettings_getDomStorageEnabledLocked(env, obj);
......
......@@ -82,6 +82,7 @@
#include "net/base/url_util.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/device_form_factor.h"
......@@ -487,7 +488,8 @@ const WebPreferences RenderViewHostImpl::ComputeWebPreferences() {
prefs.remote_fonts_enabled =
!command_line.HasSwitch(switches::kDisableRemoteFonts);
prefs.application_cache_enabled = true;
prefs.application_cache_enabled =
base::FeatureList::IsEnabled(blink::features::kAppCache);
prefs.local_storage_enabled =
!command_line.HasSwitch(switches::kDisableLocalStorage);
prefs.databases_enabled =
......
......@@ -102,6 +102,7 @@
#include "storage/browser/database/database_tracker.h"
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom.h"
#if defined(OS_ANDROID)
......@@ -2694,4 +2695,8 @@ void StoragePartition::SetDefaultQuotaSettingsForTesting(
g_test_quota_settings = settings;
}
bool StoragePartition::IsAppCacheEnabled() {
return base::FeatureList::IsEnabled(blink::features::kAppCache);
}
} // namespace content
......@@ -36,6 +36,7 @@
#include "content/public/common/content_switches.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/messaging/message_port_channel.h"
#include "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom.h"
#include "third_party/blink/public/mojom/script/script_type.mojom.h"
......@@ -293,11 +294,13 @@ SharedWorkerHost* SharedWorkerServiceImpl::CreateWorker(
DCHECK(insertion_result.second);
SharedWorkerHost* host = insertion_result.first->get();
auto appcache_handle = std::make_unique<AppCacheNavigationHandle>(
appcache_service_.get(), worker_process_host->GetID());
base::WeakPtr<AppCacheHost> appcache_host =
appcache_handle->host()->GetWeakPtr();
host->SetAppCacheHandle(std::move(appcache_handle));
base::WeakPtr<AppCacheHost> appcache_host;
if (base::FeatureList::IsEnabled(blink::features::kAppCache)) {
auto appcache_handle = std::make_unique<AppCacheNavigationHandle>(
appcache_service_.get(), worker_process_host->GetID());
appcache_host = appcache_handle->host()->GetWeakPtr();
host->SetAppCacheHandle(std::move(appcache_handle));
}
auto service_worker_handle =
std::make_unique<ServiceWorkerMainResourceHandle>(
......
......@@ -341,6 +341,7 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
{"AllowContentInitiatedDataUrlNavigations",
features::kAllowContentInitiatedDataUrlNavigations,
kUseFeatureState},
{"AppCache", blink::features::kAppCache, kDisableOnly},
{"AudioWorkletRealtimeThread",
blink::features::kAudioWorkletRealtimeThread, kEnableOnly},
{"BlockCredentialedSubresources",
......
......@@ -272,6 +272,8 @@ class CONTENT_EXPORT StoragePartition {
static void SetDefaultQuotaSettingsForTesting(
const storage::QuotaSettings* settings);
static bool IsAppCacheEnabled();
protected:
virtual ~StoragePartition() {}
};
......
......@@ -494,5 +494,7 @@ const base::Feature kFlexNG{"FlexNG", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAppCache{"AppCache", base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features
} // namespace blink
......@@ -165,6 +165,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kFlexNG;
BLINK_COMMON_EXPORT extern const base::Feature kKeepScriptResourceAlive;
BLINK_COMMON_EXPORT extern const base::Feature kAppCache;
} // namespace features
} // namespace blink
......
......@@ -159,6 +159,7 @@
status: "experimental",
},
{
// Enabled when blink::features::kAppCache is enabled.
name: "AppCache",
status: "stable",
},
......
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