Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: content/browser/appcache/appcache_disk_cache.cc

Issue 1140853002: ServiceWorker: Use SimpleCache for the script cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for review comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/appcache/appcache_disk_cache.cc
diff --git a/content/browser/appcache/appcache_disk_cache.cc b/content/browser/appcache/appcache_disk_cache.cc
index 382ed45fed2197ae8be5b861e1f310d18a118694..23b5470f8bea61c9b93cef4117f76c8ca8e2e970 100644
--- a/content/browser/appcache/appcache_disk_cache.cc
+++ b/content/browser/appcache/appcache_disk_cache.cc
@@ -177,7 +177,10 @@ class AppCacheDiskCache::ActiveCall {
};
AppCacheDiskCache::AppCacheDiskCache()
- : is_disabled_(false) {
+#if defined(APPCACHE_USE_SIMPLE_CACHE)
+ : use_simple_cache_(true)
kinuko 2015/05/15 02:28:48 nit: we can use delegated ctor too
nhiroki 2015/05/15 03:02:47 Done (I thought delegated ctor was still under dis
+#endif
+{
}
AppCacheDiskCache::~AppCacheDiskCache() {
@@ -281,6 +284,10 @@ int AppCacheDiskCache::DoomEntry(int64 key,
return (new ActiveCall(this))->DoomEntry(key, callback);
}
+AppCacheDiskCache::AppCacheDiskCache(bool use_simple_cache)
+ : use_simple_cache_(use_simple_cache) {
+}
+
AppCacheDiskCache::PendingCall::PendingCall()
: call_type(CREATE),
key(0),
@@ -310,14 +317,10 @@ 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,
- backend_type,
+ use_simple_cache_ ? net::CACHE_BACKEND_SIMPLE
+ : net::CACHE_BACKEND_DEFAULT,
cache_directory,
cache_size,
force,

Powered by Google App Engine
This is Rietveld 408576698