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

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: Fix OnExternalCacheHit handling. 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/disk_cache/backend_impl.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..e5fbe0906fb1e5caa0eab7dc4aedfb2a489f53c3 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);
+ UpdateRankOnCacheHit(cache_entry, false);
rvargas (doing something else) 2013/02/13 02:27:17 Not so happy. How about UpdateRank(cache_entry, c
dsinclair 2013/02/13 18:20:09 Done. That's much nicer. Thanks. On 2013/02/13 02
}
cache_entry->Release();
}
@@ -921,10 +923,16 @@ LruData* BackendImpl::GetLruData() {
return &data_->header.lru;
}
+void BackendImpl::UpdateRankOnCacheHit(EntryImpl* entry, bool modified) {
+ if (read_only_)
+ return;
+ eviction_.UpdateRank(entry, modified);
+}
+
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/disk_cache/backend_impl.h ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698