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

Unified Diff: components/data_reduction_proxy/core/browser/data_usage_store.cc

Issue 2791563002: Create feature and enable data collection for Data Saver site breakdown (Closed)
Patch Set: sclittle comments Created 3 years, 8 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_usage_store.cc
diff --git a/components/data_reduction_proxy/core/browser/data_usage_store.cc b/components/data_reduction_proxy/core/browser/data_usage_store.cc
index 98bcbbd0ed433bf750933983259f567349dc910b..fb89dd096a4fd02641f3af48d077004e888aecd8 100644
--- a/components/data_reduction_proxy/core/browser/data_usage_store.cc
+++ b/components/data_reduction_proxy/core/browser/data_usage_store.cc
@@ -22,23 +22,23 @@
#include "base/time/time.h"
#include "components/data_reduction_proxy/proto/data_store.pb.h"
+namespace data_reduction_proxy {
+
namespace {
+
const char kCurrentBucketIndexKey[] = "current_bucket_index";
const char kBucketKeyPrefix[] = "data_usage_bucket:";
const int kMinutesInHour = 60;
const int kMinutesInDay = 24 * kMinutesInHour;
-// Time interval for each DataUsageBucket.
-const int kDataUsageBucketLengthInMinutes = 15;
-static_assert(kDataUsageBucketLengthInMinutes > 0,
+static_assert(data_reduction_proxy::kDataUsageBucketLengthInMinutes > 0,
"Length of time should be positive");
-static_assert(kMinutesInHour % kDataUsageBucketLengthInMinutes == 0,
+static_assert(kMinutesInHour %
+ data_reduction_proxy::kDataUsageBucketLengthInMinutes ==
+ 0,
"kDataUsageBucketLengthMins must be a factor of kMinsInHour");
-// Number of days for which to maintain data usage history.
-const int kDataUsageHistoryNumDays = 60;
-
// Total number of buckets persisted to DB.
const int kNumDataUsageBuckets =
kDataUsageHistoryNumDays * kMinutesInDay / kDataUsageBucketLengthInMinutes;
@@ -65,8 +65,6 @@ base::Time BucketLowerBoundary(base::Time time) {
} // namespace
-namespace data_reduction_proxy {
-
DataUsageStore::DataUsageStore(DataStore* db)
: db_(db), current_bucket_index_(-1) {
sequence_checker_.DetachFromSequence();

Powered by Google App Engine
This is Rietveld 408576698