| Index: net/disk_cache/blockfile/backend_impl.cc
|
| diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc
|
| index c38b2bb9e33b49fa7e4945edc7380b235b5d3b8a..c3ad6e253762c8456426f5af44c1b29c23e36ed3 100644
|
| --- a/net/disk_cache/blockfile/backend_impl.cc
|
| +++ b/net/disk_cache/blockfile/backend_impl.cc
|
| @@ -1250,16 +1250,35 @@ int BackendImpl::DoomEntriesSince(const base::Time initial_time,
|
| return net::ERR_IO_PENDING;
|
| }
|
|
|
| -int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry,
|
| +int BackendImpl::OpenNextEntry(Iterator* iter, Entry** next_entry,
|
| const CompletionCallback& callback) {
|
| + // TODO(gavinp): Remove all void** iter from cache.
|
| DCHECK(!callback.is_null());
|
| - background_queue_.OpenNextEntry(iter, next_entry, callback);
|
| - return net::ERR_IO_PENDING;
|
| -}
|
|
|
| -void BackendImpl::EndEnumeration(void** iter) {
|
| - background_queue_.EndEnumeration(*iter);
|
| - *iter = NULL;
|
| + class State : public EnumerationState {
|
| + public:
|
| + explicit State(base::WeakPtr<InFlightBackendIO> background_queue)
|
| + : background_queue_(background_queue),
|
| + data_(NULL) {}
|
| +
|
| + virtual ~State() {
|
| + if (background_queue_)
|
| + background_queue_->EndEnumeration(*data());
|
| + }
|
| +
|
| + void** data() { return &data_; }
|
| +
|
| + private:
|
| + base::WeakPtr<InFlightBackendIO> background_queue_;
|
| + void* data_;
|
| + };
|
| +
|
| + if (!*iter)
|
| + iter->reset(new State(GetBackgroundQueue()));
|
| + State* state = static_cast<State*>(iter->get());
|
| +
|
| + background_queue_.OpenNextEntry(state->data(), next_entry, callback);
|
| + return net::ERR_IO_PENDING;
|
| }
|
|
|
| void BackendImpl::GetStats(StatsItems* stats) {
|
|
|