From 732c8306d4864296511e7a3a252724b1bb34c342 Mon Sep 17 00:00:00 2001 From: gavinp Date: Thu, 18 Sep 2014 21:20:28 -0700 Subject: 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} --- net/tools/dump_cache/simple_cache_dumper.cc | 9 ++++----- net/tools/dump_cache/simple_cache_dumper.h | 8 ++------ 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'net/tools/dump_cache') 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 cache_; scoped_ptr writer_; base::Thread* cache_thread_; - void* iter_; + scoped_ptr iter_; disk_cache::Entry* src_entry_; disk_cache::Entry* dst_entry_; CompletionCallback io_callback_; -- cgit v1.1