Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: net/disk_cache/blockfile/backend_impl.cc

Issue 2626173003: Calculate the size of all cache entries between two points in time. (Closed)
Patch Set: fix unit_tests compilation Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/blockfile/backend_impl.h" 5 #include "net/disk_cache/blockfile/backend_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 background_queue_.DoomEntriesSince(initial_time, callback); 1263 background_queue_.DoomEntriesSince(initial_time, callback);
1264 return net::ERR_IO_PENDING; 1264 return net::ERR_IO_PENDING;
1265 } 1265 }
1266 1266
1267 int BackendImpl::CalculateSizeOfAllEntries(const CompletionCallback& callback) { 1267 int BackendImpl::CalculateSizeOfAllEntries(const CompletionCallback& callback) {
1268 DCHECK(!callback.is_null()); 1268 DCHECK(!callback.is_null());
1269 background_queue_.CalculateSizeOfAllEntries(callback); 1269 background_queue_.CalculateSizeOfAllEntries(callback);
1270 return net::ERR_IO_PENDING; 1270 return net::ERR_IO_PENDING;
1271 } 1271 }
1272 1272
1273 int BackendImpl::CalculateSizeOfEntriesBetween(
1274 base::Time initial_time,
1275 base::Time end_time,
1276 const CompletionCallback& callback) {
1277 // Calculating the size of a subset of cache entries is not implemented
1278 // because it would require to open and read all entries from disk.
1279 return net::ERR_NOT_IMPLEMENTED;
gavinp 2017/01/12 16:07:35 Why not move all of these ERR_NOT_IMPLEMENTED vers
1280 }
1281
1273 class BackendImpl::IteratorImpl : public Backend::Iterator { 1282 class BackendImpl::IteratorImpl : public Backend::Iterator {
1274 public: 1283 public:
1275 explicit IteratorImpl(base::WeakPtr<InFlightBackendIO> background_queue) 1284 explicit IteratorImpl(base::WeakPtr<InFlightBackendIO> background_queue)
1276 : background_queue_(background_queue), 1285 : background_queue_(background_queue),
1277 iterator_(new Rankings::Iterator()) { 1286 iterator_(new Rankings::Iterator()) {
1278 } 1287 }
1279 1288
1280 ~IteratorImpl() override { 1289 ~IteratorImpl() override {
1281 if (background_queue_) 1290 if (background_queue_)
1282 background_queue_->EndEnumeration(std::move(iterator_)); 1291 background_queue_->EndEnumeration(std::move(iterator_));
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 if (total_memory > kMaxBuffersSize || total_memory <= 0) 2118 if (total_memory > kMaxBuffersSize || total_memory <= 0)
2110 total_memory = kMaxBuffersSize; 2119 total_memory = kMaxBuffersSize;
2111 2120
2112 done = true; 2121 done = true;
2113 } 2122 }
2114 2123
2115 return static_cast<int>(total_memory); 2124 return static_cast<int>(total_memory);
2116 } 2125 }
2117 2126
2118 } // namespace disk_cache 2127 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698