Commit d89b8b3d authored by nhiroki's avatar nhiroki Committed by Commit bot

Revert of ServiceWorker: Use SimpleCache for the script cache (patchset #7...

Revert of ServiceWorker: Use SimpleCache for the script cache (patchset #7 id:230001 of https://codereview.chromium.org/1140853002/)

Reason for revert:
We'll reland this CL with DiskCache migration code.

Original issue's description:
> ServiceWorker: Use SimpleCache for the script cache
>
> This CL migrates the backend of ServiceWorkerDiskCache from Default to
> SimpleCache on all platforms.
>
> If old DiskCache images exist,
> (1) DiskCache backend fails to open an pre-existing data due to incompatible
> format (in both Default->SimpleCache and SimpleCache->Default cases),
> (2) ServiceWorkerStorage wipes out all cached scripts and registrations via
> DeleteAndStartOver, and
> (3) navigation falls back to network.
>
> BUG=487482
> TEST=manual (use DiskCache and SimpleCache alternately and make sure the system can recover)
>
> Committed: https://crrev.com/a00e5be5a06e626de1b62cbfc7c350bef08647ea
> Cr-Commit-Position: refs/heads/master@{#330274}

TBR=michaeln@chromium.org
BUG=487482

Review URL: https://codereview.chromium.org/1142193002

Cr-Commit-Position: refs/heads/master@{#330505}
parent 7254b49f
......@@ -198,12 +198,8 @@ class AppCacheDiskCache::ActiveCall
};
AppCacheDiskCache::AppCacheDiskCache()
#if defined(APPCACHE_USE_SIMPLE_CACHE)
: AppCacheDiskCache(true)
#else
: AppCacheDiskCache(false)
#endif
{
: is_disabled_(false),
weak_factory_(this) {
}
AppCacheDiskCache::~AppCacheDiskCache() {
......@@ -308,12 +304,6 @@ int AppCacheDiskCache::DoomEntry(int64 key,
return ActiveCall::DoomEntry(weak_factory_.GetWeakPtr(), key, callback);
}
AppCacheDiskCache::AppCacheDiskCache(bool use_simple_cache)
: use_simple_cache_(use_simple_cache),
is_disabled_(false),
weak_factory_(this) {
}
AppCacheDiskCache::PendingCall::PendingCall()
: call_type(CREATE),
key(0),
......@@ -343,10 +333,14 @@ int AppCacheDiskCache::Init(
is_disabled_ = false;
create_backend_callback_ = new CreateBackendCallbackShim(this);
#if defined(APPCACHE_USE_SIMPLE_CACHE)
const net::BackendType backend_type = net::CACHE_BACKEND_SIMPLE;
#else
const net::BackendType backend_type = net::CACHE_BACKEND_DEFAULT;
#endif
int rv = disk_cache::CreateCacheBackend(
cache_type,
use_simple_cache_ ? net::CACHE_BACKEND_SIMPLE
: net::CACHE_BACKEND_DEFAULT,
backend_type,
cache_directory,
cache_size,
force,
......
......@@ -52,9 +52,6 @@ class CONTENT_EXPORT AppCacheDiskCache
const net::CompletionCallback& callback) override;
int DoomEntry(int64 key, const net::CompletionCallback& callback) override;
protected:
explicit AppCacheDiskCache(bool use_simple_cache);
private:
class CreateBackendCallbackShim;
class EntryImpl;
......@@ -102,7 +99,6 @@ class CONTENT_EXPORT AppCacheDiskCache
void AddOpenEntry(EntryImpl* entry) { open_entries_.insert(entry); }
void RemoveOpenEntry(EntryImpl* entry) { open_entries_.erase(entry); }
bool use_simple_cache_;
bool is_disabled_;
net::CompletionCallback init_callback_;
scoped_refptr<CreateBackendCallbackShim> create_backend_callback_;
......
......@@ -6,10 +6,6 @@
namespace content {
ServiceWorkerDiskCache::ServiceWorkerDiskCache()
: AppCacheDiskCache(true /* use_simple_cache */) {
}
ServiceWorkerResponseReader::ServiceWorkerResponseReader(
int64 response_id, ServiceWorkerDiskCache* disk_cache)
: AppCacheResponseReader(response_id, 0, disk_cache) {
......
......@@ -18,8 +18,6 @@ namespace content {
class CONTENT_EXPORT ServiceWorkerDiskCache
: public AppCacheDiskCache {
public:
ServiceWorkerDiskCache();
};
class CONTENT_EXPORT ServiceWorkerResponseReader
......
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