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

Unified Diff: chrome/browser/browsing_data/cache_counter.h

Issue 2556363003: Refactor cache counting into a separate helper class (Closed)
Patch Set: Remove code depending on GetEntrySize() 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
Index: chrome/browser/browsing_data/cache_counter.h
diff --git a/chrome/browser/browsing_data/cache_counter.h b/chrome/browser/browsing_data/cache_counter.h
index b8963ef366185dec680741693053adc22ad0f7e2..04248e4f94eee53c27a48a42a169f14f91b152b9 100644
--- a/chrome/browser/browsing_data/cache_counter.h
+++ b/chrome/browser/browsing_data/cache_counter.h
@@ -12,25 +12,49 @@
class Profile;
+namespace browsing_data {
+class ConditionalCacheCountingHelper;
+}
+
class CacheCounter : public browsing_data::BrowsingDataCounter {
public:
+ class CacheResult : public FinishedResult {
+ public:
+ CacheResult(const CacheCounter* source,
+ int64_t cache_size,
+ bool is_upper_limit);
+ ~CacheResult() override;
+
+ int64_t cache_size() const { return cache_size_; }
+ bool is_upper_limit() const { return is_upper_limit_; }
+
+ private:
+ int64_t cache_size_;
+ bool is_upper_limit_;
+
+ DISALLOW_COPY_AND_ASSIGN(CacheResult);
+ };
+
explicit CacheCounter(Profile* profile);
~CacheCounter() override;
+ const char* GetPrefName() const override;
+
// Whether this counter awaits the calculation result callback.
// Used only for testing.
bool Pending();
- const char* GetPrefName() const override;
-
private:
+ void Count() override;
+ void OnCacheSizeCalculated(bool is_upper_limit, int64_t bytes);
+ void FetchEstimate(
+ base::WeakPtr<browsing_data::ConditionalCacheCountingHelper>);
+
Profile* profile_;
bool pending_;
base::WeakPtrFactory<CacheCounter> weak_ptr_factory_;
- void Count() override;
- void OnCacheSizeCalculated(int64_t bytes);
};
#endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_counter_utils.cc ('k') | chrome/browser/browsing_data/cache_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698