| 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 50e7b026a83e4b199a3c893f0eae18655e1f5912..4e3b7a958f9aa91fa5c169e3fd87560daec7925e 100644
|
| --- a/net/disk_cache/blockfile/backend_impl.cc
|
| +++ b/net/disk_cache/blockfile/backend_impl.cc
|
| @@ -436,6 +436,40 @@ int BackendImpl::SyncDoomEntriesSince(const base::Time initial_time) {
|
| }
|
| }
|
|
|
| +int BackendImpl::SyncCalculateSizeOfEntriesBetween(
|
| + const base::Time initial_time, const base::Time end_time) {
|
| + DCHECK_NE(net::APP_CACHE, cache_type_);
|
| + DCHECK_GE(end_time, initial_time);
|
| + if (disabled_)
|
| + return net::ERR_FAILED;
|
| +
|
| + EntryImpl* node;
|
| + scoped_ptr<Rankings::Iterator> iterator(new Rankings::Iterator());
|
| + EntryImpl* next = OpenNextEntryImpl(iterator.get());
|
| + if (!next)
|
| + return net::OK;
|
| +
|
| + int size = 0;
|
| + while (next) {
|
| + node = next;
|
| + next = OpenNextEntryImpl(iterator.get());
|
| +
|
| + if (node->GetLastUsed() >= initial_time &&
|
| + node->GetLastUsed() < end_time) {
|
| + size += node->GetEntrySize();
|
| + } else if (node->GetLastUsed() < initial_time) {
|
| + if (next)
|
| + next->Release();
|
| + next = NULL;
|
| + SyncEndEnumeration(iterator.Pass());
|
| + }
|
| +
|
| + node->Release();
|
| + }
|
| +
|
| + return size;
|
| +}
|
| +
|
| int BackendImpl::SyncOpenNextEntry(Rankings::Iterator* iterator,
|
| Entry** next_entry) {
|
| *next_entry = OpenNextEntryImpl(iterator);
|
| @@ -1254,6 +1288,16 @@ int BackendImpl::DoomEntriesSince(const base::Time initial_time,
|
| return net::ERR_IO_PENDING;
|
| }
|
|
|
| +int BackendImpl::CalculateSizeOfEntriesBetween(
|
| + base::Time initial_time,
|
| + base::Time end_time,
|
| + const CompletionCallback& callback) {
|
| + DCHECK(!callback.is_null());
|
| + background_queue_.CalculateSizeOfEntriesBetween(
|
| + initial_time, end_time, callback);
|
| + return net::ERR_IO_PENDING;
|
| +}
|
| +
|
| class BackendImpl::IteratorImpl : public Backend::Iterator {
|
| public:
|
| explicit IteratorImpl(base::WeakPtr<InFlightBackendIO> background_queue)
|
|
|