summaryrefslogtreecommitdiffstats
path: root/net/tools/dump_cache
diff options
context:
space:
mode:
authorgavinp <gavinp@chromium.org>2014-09-18 21:20:28 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-19 04:20:45 +0000
commit732c8306d4864296511e7a3a252724b1bb34c342 (patch)
tree0943171a92638adcf6d629562b93ccf790fef191 /net/tools/dump_cache
parent64d2f3ff943ceb38edacf829ff1f190f3ee17cf0 (diff)
downloadchromium_src-732c8306d4864296511e7a3a252724b1bb34c342.zip
chromium_src-732c8306d4864296511e7a3a252724b1bb34c342.tar.gz
chromium_src-732c8306d4864296511e7a3a252724b1bb34c342.tar.bz2
Remove void** from disk_cache interface.
Enumeration and iteration were passing around void**. With this CL, we instead use an Iterator object. R=clamy@chromium.org,jkarlin@chromium.org,jsbell@chromium.org BUG=413644 Review URL: https://codereview.chromium.org/542733002 Cr-Commit-Position: refs/heads/master@{#295659}
Diffstat (limited to 'net/tools/dump_cache')
-rw-r--r--net/tools/dump_cache/simple_cache_dumper.cc9
-rw-r--r--net/tools/dump_cache/simple_cache_dumper.h8
2 files changed, 6 insertions, 11 deletions
diff --git a/net/tools/dump_cache/simple_cache_dumper.cc b/net/tools/dump_cache/simple_cache_dumper.cc
index 56162ca..dd5ecbf 100644
--- a/net/tools/dump_cache/simple_cache_dumper.cc
+++ b/net/tools/dump_cache/simple_cache_dumper.cc
@@ -26,7 +26,6 @@ SimpleCacheDumper::SimpleCacheDumper(base::FilePath input_path,
output_path_(output_path),
writer_(new DiskDumper(output_path)),
cache_thread_(new base::Thread("CacheThead")),
- iter_(NULL),
src_entry_(NULL),
dst_entry_(NULL),
io_callback_(base::Bind(&SimpleCacheDumper::OnIOComplete,
@@ -150,15 +149,15 @@ int SimpleCacheDumper::DoOpenEntry() {
DCHECK(!dst_entry_);
DCHECK(!src_entry_);
state_ = STATE_OPEN_ENTRY_COMPLETE;
- return cache_->OpenNextEntry(&iter_, &src_entry_, io_callback_);
+ if (!iter_)
+ iter_ = cache_->CreateIterator();
+ return iter_->OpenNextEntry(&src_entry_, io_callback_);
}
int SimpleCacheDumper::DoOpenEntryComplete(int rv) {
// ERR_FAILED indicates iteration finished.
- if (rv == ERR_FAILED) {
- cache_->EndEnumeration(&iter_);
+ if (rv == ERR_FAILED)
return OK;
- }
if (rv < 0)
return rv;
diff --git a/net/tools/dump_cache/simple_cache_dumper.h b/net/tools/dump_cache/simple_cache_dumper.h
index c95e6a9..cc865a3 100644
--- a/net/tools/dump_cache/simple_cache_dumper.h
+++ b/net/tools/dump_cache/simple_cache_dumper.h
@@ -9,14 +9,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread.h"
#include "net/base/completion_callback.h"
+#include "net/disk_cache/disk_cache.h"
class DiskDumper;
-namespace disk_cache {
-class Backend;
-class Entry;
-} // namespace disk_cache
-
namespace net {
class IOBufferWithSize;
@@ -79,7 +75,7 @@ class SimpleCacheDumper {
scoped_ptr<disk_cache::Backend> cache_;
scoped_ptr<DiskDumper> writer_;
base::Thread* cache_thread_;
- void* iter_;
+ scoped_ptr<disk_cache::Backend::Iterator> iter_;
disk_cache::Entry* src_entry_;
disk_cache::Entry* dst_entry_;
CompletionCallback io_callback_;