Index: components/browsing_data/storage_partition_http_cache_data_remover.h |
diff --git a/components/browsing_data/storage_partition_http_cache_data_remover.h b/components/browsing_data/storage_partition_http_cache_data_remover.h |
index eb9f575fae82478e918e5dd139d979ad09137f6b..6ee4df30ab494be0c96773c1af922d79d93917e7 100644 |
--- a/components/browsing_data/storage_partition_http_cache_data_remover.h |
+++ b/components/browsing_data/storage_partition_http_cache_data_remover.h |
@@ -8,6 +8,7 @@ |
#include "base/callback.h" |
#include "base/sequenced_task_runner_helpers.h" |
#include "base/time/time.h" |
+#include "net/base/completion_callback.h" |
namespace content { |
class StoragePartition; |
@@ -34,6 +35,10 @@ class StoragePartitionHttpCacheDataRemover { |
// Calls |done_callback| upon completion and also destroys itself. |
void Remove(const base::Closure& done_callback); |
+ // Counts the total size of entries that would be removed by calling |Remove|. |
+ // Reports it via |result_callback| and then destroys itself. |
+ void Count(const net::Int64CompletionCallback& result_callback); |
+ |
private: |
enum CacheState { |
STATE_NONE, |
@@ -61,6 +66,7 @@ class StoragePartitionHttpCacheDataRemover { |
void ClearedHttpCache(); |
// Performs the actual work to delete the cache. |
void DoClearCache(int rv); |
+ void OnCalculationComplete(int rv); |
const base::Time delete_begin_; |
const base::Time delete_end_; |
@@ -69,11 +75,21 @@ class StoragePartitionHttpCacheDataRemover { |
const scoped_refptr<net::URLRequestContextGetter> media_context_getter_; |
base::Closure done_callback_; |
+ net::Int64CompletionCallback result_callback_; |
// IO. |
int next_cache_state_; |
disk_cache::Backend* cache_; |
+ // Whether we should only compute the size of the cache, but not actually |
+ // delete it. |
+ bool count_only_; |
+ |
+ // Stores the cache size computation result before it can be returned |
+ // via a callback. This is either the sum of size of the the two cache |
+ // backends, or an error code if the calculation failed. |
+ int64 calculation_result_; |
+ |
DISALLOW_COPY_AND_ASSIGN(StoragePartitionHttpCacheDataRemover); |
}; |