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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h

Issue 1221663009: Expose API to store and load data usage stats from UI task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Breakdown
Patch Set: Add missing Pass. Created 5 years, 5 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: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
index 0ed7d1b386c3d349b91409ca857c29068d290f5c..3698dd9eed1056a0e2f9e6ff8c01abd4357e4ac0 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.h
@@ -26,6 +26,7 @@ class Value;
}
namespace data_reduction_proxy {
+class DataReductionProxyService;
// Data reduction proxy delayed pref service reduces the number calls to pref
// service by storing prefs in memory and writing to the given PrefService after
@@ -34,15 +35,19 @@ namespace data_reduction_proxy {
// prefs must be stored and read on the UI thread.
class DataReductionProxyCompressionStats {
public:
- // Constructs a data reduction proxy delayed pref service object using
- // |pref_service|. Writes prefs to |pref_service| after |delay|
- // and stores them in |pref_map_| and |list_pref_map| between writes.
+ // Collects and store data usage and compression statistics. Basic data usage
+ // stats are stored in browser preferences. More detailed stats broken down
+ // by site and internet type are stored in |DataReductionProxyStore|.
+ //
+ // To store basic stats, it constructs a data reduction proxy delayed pref
+ // service object using |pref_service|. Writes prefs to |pref_service| after
+ // |delay| and stores them in |pref_map_| and |list_pref_map| between writes.
// If |delay| is zero, writes directly to the PrefService and does not store
// in the maps.
DataReductionProxyCompressionStats(
PrefService* pref_service,
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- const base::TimeDelta& delay);
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ base::TimeDelta delay);
~DataReductionProxyCompressionStats();
// Records daily data savings statistics to prefs and reports data savings
@@ -77,6 +82,11 @@ class DataReductionProxyCompressionStats {
int64* received_content_length,
int64* last_update_time);
+ // Sets the |DataReductionProxyService|.
+ void set_data_reduction_proxy_service(DataReductionProxyService* service) {
+ service_ = service;
+ }
jeremyim 2015/07/13 20:19:40 Looks like this is part of a future CL that crept
Not at Google. Contact bengr 2015/07/14 16:41:30 I intended to have this be part of this cl, since
jeremyim 2015/07/14 22:39:54 I'll likely have some comments about this in the n
Not at Google. Contact bengr 2015/07/15 00:08:17 Done.
+
private:
friend class DataReductionProxyCompressionStatsTest;
@@ -145,6 +155,7 @@ class DataReductionProxyCompressionStats {
DataReductionProxyListPrefMap list_pref_map_;
scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
base::ThreadChecker thread_checker_;
+ DataReductionProxyService* service_;
base::WeakPtrFactory<DataReductionProxyCompressionStats> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698