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