Index: net/disk_cache/blockfile/backend_impl_v3.cc |
diff --git a/net/disk_cache/blockfile/backend_impl_v3.cc b/net/disk_cache/blockfile/backend_impl_v3.cc |
index 9a7cff1c79000c8e9e41f9f7728da3bf025cc680..513cbe3a8e369d167cbba3b1cd71c2689bb8569c 100644 |
--- a/net/disk_cache/blockfile/backend_impl_v3.cc |
+++ b/net/disk_cache/blockfile/backend_impl_v3.cc |
@@ -660,10 +660,32 @@ int BackendImplV3::DoomEntriesSince(base::Time initial_time, |
} |
} |
-int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry, |
+int BackendImplV3::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); |
+ 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(*iter()); |
+ } |
+ |
+ 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; |
} |
@@ -1497,15 +1519,11 @@ int BackendImplV3::DoomEntriesSince(base::Time initial_time, |
return net::ERR_FAILED; |
} |
-int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry, |
+int BackendImplV3::OpenNextEntry(Iterator* iter, Entry** next_entry, |
const CompletionCallback& callback) { |
return net::ERR_FAILED; |
} |
-void BackendImplV3::EndEnumeration(void** iter) { |
- NOTIMPLEMENTED(); |
-} |
- |
void BackendImplV3::GetStats(StatsItems* stats) { |
NOTIMPLEMENTED(); |
} |