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

Unified Diff: net/disk_cache/backend_impl.cc

Issue 12224017: Create a new disk_cache type, SHADER_CACHE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better fix for OnExternalCacheHit Created 7 years, 10 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
« no previous file with comments | « net/base/cache_type.h ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.cc
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 232b3f8b295ee2ad0580b47deb9bbbcf9898bda5..c92c9eede3d76e0b04b448ef0667610758f565f3 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -478,6 +478,8 @@ int BackendImpl::SyncInit() {
if (cache_type() == net::APP_CACHE) {
DCHECK(!new_eviction_);
read_only_ = true;
+ } else if (cache_type() == net::SHADER_CACHE) {
+ DCHECK(!new_eviction_);
}
eviction_.Init(this);
@@ -670,7 +672,7 @@ void BackendImpl::SyncOnExternalCacheHit(const std::string& key) {
EntryImpl* cache_entry = MatchEntry(key, hash, false, Addr(), &error);
if (cache_entry) {
if (ENTRY_NORMAL == cache_entry->entry()->Data()->state) {
- UpdateRank(cache_entry, false);
+ UpdateRank(cache_entry, cache_type() == net::SHADER_CACHE);
}
cache_entry->Release();
}
@@ -922,9 +924,9 @@ LruData* BackendImpl::GetLruData() {
}
void BackendImpl::UpdateRank(EntryImpl* entry, bool modified) {
- if (!read_only_) {
- eviction_.UpdateRank(entry, modified);
- }
+ if (read_only_ || (!modified && cache_type() == net::SHADER_CACHE))
+ return;
+ eviction_.UpdateRank(entry, modified);
}
void BackendImpl::RecoveredEntry(CacheRankingsBlock* rankings) {
« no previous file with comments | « net/base/cache_type.h ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698