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

Unified Diff: net/disk_cache/blockfile/rankings.cc

Issue 588243002: Reland of "Remove void** from disk_cache interface" w/ blockfile iter fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1-webcacheimpl
Patch Set: cleanup presubmit Created 6 years, 3 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/blockfile/rankings.h ('k') | net/disk_cache/disk_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/rankings.cc
diff --git a/net/disk_cache/blockfile/rankings.cc b/net/disk_cache/blockfile/rankings.cc
index 7c93b431bcbbb8fd3cb1eba85e6dfb9e69ee3ef4..496008d93ec3f6b7d2d7726e9e68cde32d8f6aa9 100644
--- a/net/disk_cache/blockfile/rankings.cc
+++ b/net/disk_cache/blockfile/rankings.cc
@@ -202,14 +202,16 @@ Rankings::ScopedRankingsBlock::ScopedRankingsBlock(
Rankings* rankings, CacheRankingsBlock* node)
: scoped_ptr<CacheRankingsBlock>(node), rankings_(rankings) {}
-Rankings::Iterator::Iterator(Rankings* rankings) {
+Rankings::Iterator::Iterator() {
memset(this, 0, sizeof(Iterator));
- my_rankings = rankings;
}
-Rankings::Iterator::~Iterator() {
- for (int i = 0; i < 3; i++)
- ScopedRankingsBlock(my_rankings, nodes[i]);
+void Rankings::Iterator::Reset() {
+ if (my_rankings) {
+ for (int i = 0; i < 3; i++)
+ ScopedRankingsBlock(my_rankings, nodes[i]);
+ }
+ memset(this, 0, sizeof(Iterator));
}
Rankings::Rankings() : init_(false) {}
@@ -897,10 +899,8 @@ void Rankings::InvalidateIterators(CacheRankingsBlock* node) {
CacheAddr address = node->address().value();
for (IteratorList::iterator it = iterators_.begin(); it != iterators_.end();
++it) {
- if (it->first == address) {
- DLOG(INFO) << "Invalidating iterator at 0x" << std::hex << address;
+ if (it->first == address)
it->second->Discard();
- }
}
}
« no previous file with comments | « net/disk_cache/blockfile/rankings.h ('k') | net/disk_cache/disk_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698