summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/simple/simple_index.cc
diff options
context:
space:
mode:
authorttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 08:28:41 +0000
committerttuttle@chromium.org <ttuttle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 08:28:41 +0000
commitdc02c6f484678bdbb7c1df7b454f665c61a6d5f5 (patch)
tree53bfb88bcfbf3477a21a79cfed6f3ca4a8f688be /net/disk_cache/simple/simple_index.cc
parent45a07944f41929553254bdb13a823d259c4093d3 (diff)
downloadchromium_src-dc02c6f484678bdbb7c1df7b454f665c61a6d5f5.zip
chromium_src-dc02c6f484678bdbb7c1df7b454f665c61a6d5f5.tar.gz
chromium_src-dc02c6f484678bdbb7c1df7b454f665c61a6d5f5.tar.bz2
Use struct SimpleIndexLoadResult* for SimpleIndexFile callbacks.
Accept an out_load_result parameter for LoadIndexFile (and other methods internal to SimpleIndexFile) and fill it in, instead of passing the result to the callback directly. Review URL: https://chromiumcodereview.appspot.com/19653002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/simple/simple_index.cc')
-rw-r--r--net/disk_cache/simple/simple_index.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/net/disk_cache/simple/simple_index.cc b/net/disk_cache/simple/simple_index.cc
index 8dbb88a..caec19f60 100644
--- a/net/disk_cache/simple/simple_index.cc
+++ b/net/disk_cache/simple/simple_index.cc
@@ -152,10 +152,13 @@ void SimpleIndex::Initialize(base::Time cache_mtime) {
base::Bind(&SimpleIndex::OnActivityStateChange, AsWeakPtr())));
#endif
- index_file_->LoadIndexEntries(cache_mtime,
- io_thread_,
- base::Bind(&SimpleIndex::MergeInitializingSet,
- AsWeakPtr()));
+ SimpleIndexLoadResult* load_result = new SimpleIndexLoadResult();
+ scoped_ptr<SimpleIndexLoadResult> load_result_scoped(load_result);
+ base::Closure reply = base::Bind(
+ &SimpleIndex::MergeInitializingSet,
+ AsWeakPtr(),
+ base::Passed(&load_result_scoped));
+ index_file_->LoadIndexEntries(cache_mtime, reply, load_result);
}
bool SimpleIndex::SetMaxSize(int max_bytes) {
@@ -342,10 +345,12 @@ void SimpleIndex::UpdateEntryIteratorSize(EntrySet::iterator* it,
(*it)->second.SetEntrySize(entry_size);
}
-void SimpleIndex::MergeInitializingSet(scoped_ptr<EntrySet> index_file_entries,
- bool force_index_flush) {
+void SimpleIndex::MergeInitializingSet(
+ scoped_ptr<SimpleIndexLoadResult> load_result) {
DCHECK(io_thread_checker_.CalledOnValidThread());
- DCHECK(index_file_entries);
+ DCHECK(load_result->did_load);
+
+ SimpleIndex::EntrySet* index_file_entries = &load_result->entries;
// First, remove the entries that are in the |removed_entries_| from both
// sets.
for (base::hash_set<uint64>::const_iterator it =
@@ -369,9 +374,9 @@ void SimpleIndex::MergeInitializingSet(scoped_ptr<EntrySet> index_file_entries,
initialized_ = true;
removed_entries_.clear();
- // The actual IO is asynchronous, so calling WriteToDisk() shouldn't slow down
- // much the merge.
- if (force_index_flush)
+ // The actual IO is asynchronous, so calling WriteToDisk() shouldn't slow the
+ // merge down much.
+ if (load_result->flush_required)
WriteToDisk();
UMA_HISTOGRAM_CUSTOM_COUNTS("SimpleCache.IndexInitializationWaiters",