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

Unified Diff: net/disk_cache/rankings.cc

Issue 8658001: Disk cache: Add a hash to the entry's internal data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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: net/disk_cache/rankings.cc
===================================================================
--- net/disk_cache/rankings.cc (revision 110637)
+++ net/disk_cache/rankings.cc (working copy)
@@ -494,6 +494,9 @@
}
bool Rankings::SanityCheck(CacheRankingsBlock* node, bool from_list) const {
+ if (!node->VerifyHash())
+ return false;
+
const RankingsNode* data = node->Data();
if ((!data->next && data->prev) || (data->next && !data->prev))
@@ -572,17 +575,14 @@
backend_->OnEvent(Stats::OPEN_RANKINGS);
- // "dummy" is the old "pointer" value, so it has to be 0.
- if (!rankings->Data()->dirty && !rankings->Data()->dummy)
+ if (!rankings->Data()->dirty)
return true;
EntryImpl* entry = backend_->GetOpenEntry(rankings);
if (!entry) {
// We cannot trust this entry, but we cannot initiate a cleanup from this
- // point (we may be in the middle of a cleanup already). Just get rid of
- // the invalid pointer and continue; the entry will be deleted when detected
- // from a regular open/create path.
- rankings->Data()->dummy = 0;
+ // point (we may be in the middle of a cleanup already). The entry will be
+ // deleted when detected from a regular open/create path.
rankings->Data()->dirty = backend_->GetCurrentEntryId() - 1;
if (!rankings->Data()->dirty)
rankings->Data()->dirty--;
@@ -623,7 +623,6 @@
if (!node.Load())
return;
- node.Data()->dummy = 0;
node.Store();
Addr& my_head = heads_[control_data_->operation_list];
@@ -720,7 +719,7 @@
}
bool Rankings::CheckEntry(CacheRankingsBlock* rankings) {
- if (!rankings->Data()->dummy)
+ if (rankings->VerifyHash())
return true;
// If this entry is not dirty, it is a serious problem.

Powered by Google App Engine
This is Rietveld 408576698