| 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 fb89dd096a4fd02641f3af48d077004e888aecd8..41f5fb6533208d9f9fa62063be15e68f9da0c45a 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_usage_store.cc
|
| +++ b/components/data_reduction_proxy/core/browser/data_usage_store.cc
|
| @@ -152,10 +152,16 @@ void DataUsageStore::StoreCurrentDataUsageBucket(
|
| }
|
|
|
| void DataUsageStore::DeleteHistoricalDataUsage() {
|
| - for (int i = 0; i < kNumDataUsageBuckets; ++i)
|
| - db_->Delete(DbKeyForBucketIndex(i));
|
| + std::string current_index_string;
|
| + DataStore::Status index_read_status =
|
| + db_->Get(kCurrentBucketIndexKey, ¤t_index_string);
|
| +
|
| + // If the index doesn't exist, then no buckets have been written and the
|
| + // data usage doesn't need to be deleted.
|
| + if (index_read_status != DataStore::Status::OK)
|
| + return;
|
|
|
| - db_->Delete(kCurrentBucketIndexKey);
|
| + db_->RecreateDB();
|
| }
|
|
|
| void DataUsageStore::DeleteBrowsingHistory(const base::Time& start,
|
|
|