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

Unified Diff: net/disk_cache/simple/simple_backend_impl.cc

Issue 2626173003: Calculate the size of all cache entries between two points in time. (Closed)
Patch Set: revert cache_storage_cache_unittest.cc 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.h ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_backend_impl.cc
diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc
index 30fade471fd327243756ff54356de7e576af3880..e5645e357ebd44aecac4b580e3fb88444f7dc7b9 100644
--- a/net/disk_cache/simple/simple_backend_impl.cc
+++ b/net/disk_cache/simple/simple_backend_impl.cc
@@ -458,6 +458,15 @@ int SimpleBackendImpl::CalculateSizeOfAllEntries(
&SimpleBackendImpl::IndexReadyForSizeCalculation, AsWeakPtr(), callback));
}
+int SimpleBackendImpl::CalculateSizeOfEntriesBetween(
+ base::Time initial_time,
+ base::Time end_time,
+ const CompletionCallback& callback) {
+ return index_->ExecuteWhenReady(
+ base::Bind(&SimpleBackendImpl::IndexReadyForSizeBetweenCalculation,
+ AsWeakPtr(), initial_time, end_time, callback));
+}
+
class SimpleBackendImpl::SimpleIterator final : public Iterator {
public:
explicit SimpleIterator(base::WeakPtr<SimpleBackendImpl> backend)
@@ -573,6 +582,18 @@ void SimpleBackendImpl::IndexReadyForSizeCalculation(
callback.Run(result);
}
+void SimpleBackendImpl::IndexReadyForSizeBetweenCalculation(
+ base::Time initial_time,
+ base::Time end_time,
+ const CompletionCallback& callback,
+ int result) {
+ if (result == net::OK) {
+ result =
+ static_cast<int>(index_->GetCacheSizeBetween(initial_time, end_time));
+ }
+ callback.Run(result);
+}
+
// static
SimpleBackendImpl::DiskStatResult SimpleBackendImpl::InitCacheStructureOnDisk(
const base::FilePath& path,
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.h ('k') | net/disk_cache/simple/simple_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698