diff options
author | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-21 17:20:42 +0000 |
---|---|---|
committer | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-21 17:20:42 +0000 |
commit | d68b64ed7ca42b23b6c544e316d6d3c9fdd084ef (patch) | |
tree | 4b492a22fb74226f5d1a7e53c66ef33bc9f37dc1 | |
parent | 41977ddd243018d25356cf0bc0f3b39574728751 (diff) | |
download | chromium_src-d68b64ed7ca42b23b6c544e316d6d3c9fdd084ef.zip chromium_src-d68b64ed7ca42b23b6c544e316d6d3c9fdd084ef.tar.gz chromium_src-d68b64ed7ca42b23b6c544e316d6d3c9fdd084ef.tar.bz2 |
Migrate AppCache to simple cache backend on Android.
BUG=283896
Review URL: https://chromiumcodereview.appspot.com/23503069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224604 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/disk_cache/cache_creator.cc | 6 | ||||
-rw-r--r-- | webkit/browser/appcache/appcache_database.cc | 9 | ||||
-rw-r--r-- | webkit/browser/appcache/appcache_database_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/browser/appcache/appcache_disk_cache.cc | 7 | ||||
-rw-r--r-- | webkit/storage_browser.gyp | 6 |
5 files changed, 32 insertions, 4 deletions
diff --git a/net/disk_cache/cache_creator.cc b/net/disk_cache/cache_creator.cc index 07a26c9..857d171 100644 --- a/net/disk_cache/cache_creator.cc +++ b/net/disk_cache/cache_creator.cc @@ -79,10 +79,10 @@ CacheCreator::~CacheCreator() { } int CacheCreator::Run() { - // TODO(gavinp,pasko): While simple backend development proceeds, we're only - // testing it against net::DISK_CACHE. Turn it on for more cache types as + // TODO(gavinp,pasko): Turn Simple Cache on for more cache types as // appropriate. - if (backend_type_ == net::CACHE_BACKEND_SIMPLE && type_ == net::DISK_CACHE) { + if (backend_type_ == net::CACHE_BACKEND_SIMPLE && + (type_ == net::DISK_CACHE || type_ == net::APP_CACHE)) { disk_cache::SimpleBackendImpl* simple_cache = new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_.get(), net_log_); diff --git a/webkit/browser/appcache/appcache_database.cc b/webkit/browser/appcache/appcache_database.cc index de73084..68738d1d 100644 --- a/webkit/browser/appcache/appcache_database.cc +++ b/webkit/browser/appcache/appcache_database.cc @@ -21,8 +21,13 @@ namespace appcache { // Schema ------------------------------------------------------------------- namespace { +#if defined(APPCACHE_USE_SIMPLE_CACHE) +const int kCurrentVersion = 6; +const int kCompatibleVersion = 6; +#else const int kCurrentVersion = 5; const int kCompatibleVersion = 5; +#endif // A mechanism to run experiments that may affect in data being persisted // in different ways such that when the experiment is toggled on/off via @@ -1094,6 +1099,9 @@ bool AppCacheDatabase::CreateSchema() { } bool AppCacheDatabase::UpgradeSchema() { +#if defined(APPCACHE_USE_SIMPLE_CACHE) + return DeleteExistingAndCreateNewDatabase(); +#else if (meta_table_->GetVersionNumber() == 3) { // version 3 was pre 12/17/2011 DCHECK_EQ(strcmp(kNamespacesTable, kTables[3].table_name), 0); @@ -1170,6 +1178,7 @@ bool AppCacheDatabase::UpgradeSchema() { // If there is no upgrade path for the version on disk to the current // version, nuke everything and start over. return DeleteExistingAndCreateNewDatabase(); +#endif } void AppCacheDatabase::ResetConnectionAndTables() { diff --git a/webkit/browser/appcache/appcache_database_unittest.cc b/webkit/browser/appcache/appcache_database_unittest.cc index e67a68d..9dc9080 100644 --- a/webkit/browser/appcache/appcache_database_unittest.cc +++ b/webkit/browser/appcache/appcache_database_unittest.cc @@ -668,6 +668,9 @@ TEST(AppCacheDatabaseTest, OriginUsage) { EXPECT_EQ(5000, usage_map[kOtherOrigin]); } +#if defined(APPCACHE_USE_SIMPLE_CACHE) +// There is no such upgrade path in this case. +#else TEST(AppCacheDatabaseTest, UpgradeSchema3to5) { // Real file on disk for this test. base::ScopedTempDir temp_dir; @@ -886,7 +889,11 @@ TEST(AppCacheDatabaseTest, UpgradeSchema3to5) { EXPECT_FALSE(fallbacks[i].namespace_.is_pattern); } } +#endif // !APPCACHE_USE_SIMPLE_CACHE +#if defined(APPCACHE_USE_SIMPLE_CACHE) +// There is no such upgrade path in this case. +#else TEST(AppCacheDatabaseTest, UpgradeSchema4to5) { // Real file on disk for this test. base::ScopedTempDir temp_dir; @@ -1124,5 +1131,6 @@ TEST(AppCacheDatabaseTest, UpgradeSchema4to5) { EXPECT_FALSE(whitelists[i].is_pattern); } } +#endif // !APPCACHE_USE_SIMPLE_CACHE } // namespace appcache diff --git a/webkit/browser/appcache/appcache_disk_cache.cc b/webkit/browser/appcache/appcache_disk_cache.cc index e486f1d..4aa3e8e 100644 --- a/webkit/browser/appcache/appcache_disk_cache.cc +++ b/webkit/browser/appcache/appcache_disk_cache.cc @@ -270,8 +270,13 @@ int AppCacheDiskCache::Init(net::CacheType cache_type, 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, net::CACHE_BACKEND_DEFAULT, cache_directory, cache_size, + cache_type, backend_type, cache_directory, cache_size, force, cache_thread, NULL, &(create_backend_callback_->backend_ptr_), base::Bind(&CreateBackendCallbackShim::Callback, create_backend_callback_)); diff --git a/webkit/storage_browser.gyp b/webkit/storage_browser.gyp index 8765c4a..a1a2bcc 100644 --- a/webkit/storage_browser.gyp +++ b/webkit/storage_browser.gyp @@ -201,6 +201,12 @@ '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', ], }], + ['OS=="android"', { + 'defines': ['APPCACHE_USE_SIMPLE_CACHE'], + 'direct_dependent_settings': { + 'defines': ['APPCACHE_USE_SIMPLE_CACHE'], + }, + }], ], }, { |