Chromium Code Reviews| 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..9e48b79829d684cc7794ce6153c319601c03b99d 100644 |
| --- a/net/disk_cache/blockfile/backend_impl_v3.cc |
| +++ b/net/disk_cache/blockfile/backend_impl_v3.cc |
| @@ -660,17 +660,28 @@ int BackendImplV3::DoomEntriesSince(base::Time initial_time, |
| } |
| } |
| -int BackendImplV3::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; |
| -} |
| +scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() { |
| + class BackendIterator FINAL : public Backend::Iterator { |
| + 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; |
| + } |
| -void BackendImplV3::EndEnumeration(void** iter) { |
| - scoped_ptr<IndexIterator> iterator( |
| - reinterpret_cast<IndexIterator*>(*iter)); |
| - *iter = NULL; |
| + private: |
| + const base::WeakPtr<InFlightBackendIO> background_queue_; |
| + void* data_; |
| + }; |
| + |
| + return |
| + scoped_ptr<Backend::Iterator>(new BackendIterator(GetBackgroundQueue())); |
| } |
| void BackendImplV3::GetStats(StatsItems* stats) { |
| @@ -1497,13 +1508,16 @@ int BackendImplV3::DoomEntriesSince(base::Time initial_time, |
| return net::ERR_FAILED; |
| } |
| -int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry, |
| - const CompletionCallback& callback) { |
| - return net::ERR_FAILED; |
| -} |
| - |
| -void BackendImplV3::EndEnumeration(void** iter) { |
| - NOTIMPLEMENTED(); |
| +scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() { |
| + class NotImplementedIterator FINAL : public Iterator { |
|
rvargas (doing something else)
2014/09/18 02:32:12
ditto. (out of the method and no FINAL)
gavinp
2014/09/18 18:13:04
Done.
|
| + public: |
| + virtual int OpenNextEntry( |
| + disk_cache::Entry** next_entry, |
| + const net::CompletionCallback& callback) OVERRIDE { |
| + return net::ERR_NOT_IMPLEMENTED; |
| + } |
| + }; |
| + return scoped_ptr<Iterator>(new NotImplementedIterator()); |
| } |
| void BackendImplV3::GetStats(StatsItems* stats) { |