Chromium Code Reviews| 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..a20fc2a2df12a75a759e71e46e9ffc463e58468f 100644 |
| --- a/net/disk_cache/blockfile/backend_impl.cc |
| +++ b/net/disk_cache/blockfile/backend_impl.cc |
| @@ -1250,16 +1250,29 @@ int BackendImpl::DoomEntriesSince(const base::Time initial_time, |
| return net::ERR_IO_PENDING; |
| } |
| -int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, |
| - const CompletionCallback& callback) { |
| - 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; |
| +scoped_ptr<Backend::Iterator> BackendImpl::CreateIterator() { |
| + class BackendIterator FINAL : public Backend::Iterator { |
|
rvargas (doing something else)
2014/09/18 02:32:11
declare this outside the method
rvargas (doing something else)
2014/09/18 02:32:12
Is there any real value to annotate this class wit
gavinp
2014/09/18 18:13:04
Done.
gavinp
2014/09/18 18:13:04
No. Removed.
|
| + public: |
| + explicit BackendIterator(base::WeakPtr<InFlightBackendIO> background_queue) |
| + : background_queue_(background_queue), data_(NULL) {} |
| + |
| + virtual int OpenNextEntry( |
| + Entry** next_entry, |
| + const net::CompletionCallback& callback) OVERRIDE { |
| + if (!background_queue_) |
| + return net::ERR_FAILED; |
| + background_queue_->OpenNextEntry(&data_, next_entry, callback); |
| + return net::ERR_IO_PENDING; |
| + } |
| + |
| + private: |
| + const base::WeakPtr<InFlightBackendIO> background_queue_; |
| + void* data_; |
| + }; |
| + |
| + return |
| + scoped_ptr<Backend::Iterator>(new BackendIterator(GetBackgroundQueue())); |
| } |
| void BackendImpl::GetStats(StatsItems* stats) { |