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

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

Issue 2570203002: clear-data-reduction-proxy-data-savings flag should clear savings on Android (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
index 40fbb7882ca0712e4eadf4f47640abc89fde054d..840a1c57b5ad15360d7c3decacd49f0402d9262b 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc
@@ -365,6 +365,11 @@ void DataReductionProxyCompressionStats::Init() {
weak_factory_.GetWeakPtr()));
}
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kClearDataReductionProxyDataSavings)) {
+ ClearDataSavingStatistics();
+ }
+
if (delay_.is_zero())
return;
@@ -413,11 +418,6 @@ void DataReductionProxyCompressionStats::Init() {
InitListPref(prefs::kDailyHttpReceivedContentLength);
InitListPref(prefs::kDailyOriginalContentLengthViaDataReductionProxy);
InitListPref(prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled);
-
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kClearDataReductionProxyDataSavings)) {
- ClearDataSavingStatistics();
- }
}
void DataReductionProxyCompressionStats::UpdateDataSavings(
@@ -676,29 +676,28 @@ void DataReductionProxyCompressionStats::OnCurrentDataUsageLoaded(
void DataReductionProxyCompressionStats::ClearDataSavingStatistics() {
DeleteHistoricalDataUsage();
- list_pref_map_.get(
- prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled)->Clear();
- list_pref_map_
- .get(prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled)
- ->Clear();
- list_pref_map_
- .get(prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled)
- ->Clear();
- list_pref_map_
- .get(prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled)
- ->Clear();
- list_pref_map_.get(prefs::kDailyContentLengthViaDataReductionProxy)->Clear();
- list_pref_map_.get(prefs::kDailyContentLengthWithDataReductionProxyEnabled)
- ->Clear();
- list_pref_map_.get(prefs::kDailyHttpOriginalContentLength)->Clear();
- list_pref_map_.get(prefs::kDailyHttpReceivedContentLength)->Clear();
- list_pref_map_.get(prefs::kDailyOriginalContentLengthViaDataReductionProxy)
- ->Clear();
- list_pref_map_
- .get(prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled)
- ->Clear();
+ pref_service_->ClearPref(
+ prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled);
+ pref_service_->ClearPref(
+ prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled);
+ pref_service_->ClearPref(
+ prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled);
+ pref_service_->ClearPref(
+ prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled);
+ pref_service_->ClearPref(prefs::kDailyContentLengthViaDataReductionProxy);
+ pref_service_->ClearPref(
+ prefs::kDailyContentLengthWithDataReductionProxyEnabled);
+ pref_service_->ClearPref(prefs::kDailyHttpOriginalContentLength);
+ pref_service_->ClearPref(prefs::kDailyHttpReceivedContentLength);
+ pref_service_->ClearPref(
+ prefs::kDailyOriginalContentLengthViaDataReductionProxy);
+ pref_service_->ClearPref(
+ prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled);
- WritePrefs();
+ for (DataReductionProxyListPrefMap::iterator iter = list_pref_map_.begin();
+ iter != list_pref_map_.end(); ++iter) {
+ iter->second->Clear();
+ }
}
void DataReductionProxyCompressionStats::DelayedWritePrefs() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698