Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc |
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc |
index 955a58162d0978884b1d60f73981bcd3ad188341..c35df55983bd1ba192b351b3cf3c95bc67b09612 100644 |
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc |
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc |
@@ -93,6 +93,8 @@ DataReductionProxySettings::DataReductionProxySettings( |
disabled_on_vpn_(false), |
unreachable_(false), |
prefs_(NULL), |
+ dummy_drp_statistics_(new DataReductionProxyStatistics), |
+ drp_statistics_(dummy_drp_statistics_.get()), |
url_request_context_getter_(NULL), |
configurator_(NULL) { |
DCHECK(params); |
@@ -151,9 +153,9 @@ void DataReductionProxySettings::InitDataReductionProxySettings( |
SetProxyConfigurator(configurator); |
} |
-void DataReductionProxySettings::SetDataReductionProxyStatisticsPrefs( |
- DataReductionProxyStatisticsPrefs* statistics_prefs) { |
- statistics_prefs_ = statistics_prefs; |
+void DataReductionProxySettings::SetDataReductionProxyStatistics( |
+ DataReductionProxyStatistics* drp_statistics) { |
+ drp_statistics_ = drp_statistics; |
} |
void DataReductionProxySettings::SetOnDataReductionEnabledCallback( |
@@ -207,9 +209,9 @@ void DataReductionProxySettings::SetDataReductionProxyAlternativeEnabled( |
int64 DataReductionProxySettings::GetDataReductionLastUpdateTime() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- DCHECK(statistics_prefs_); |
+ DCHECK(drp_statistics_); |
int64 last_update_internal = |
- statistics_prefs_->GetInt64(prefs::kDailyHttpContentLengthLastUpdateDate); |
+ drp_statistics_->GetInt64(prefs::kDailyHttpContentLengthLastUpdateDate); |
base::Time last_update = base::Time::FromInternalValue(last_update_internal); |
return static_cast<int64>(last_update.ToJsTime()); |
} |
@@ -365,11 +367,11 @@ void DataReductionProxySettings::OnProxyAlternativeEnabledPrefChange() { |
void DataReductionProxySettings::ResetDataReductionStatistics() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
- DCHECK(statistics_prefs_); |
+ DCHECK(drp_statistics_); |
base::ListValue* original_update = |
- statistics_prefs_->GetList(prefs::kDailyHttpOriginalContentLength); |
+ drp_statistics_->GetList(prefs::kDailyHttpOriginalContentLength); |
base::ListValue* received_update = |
- statistics_prefs_->GetList(prefs::kDailyHttpReceivedContentLength); |
+ drp_statistics_->GetList(prefs::kDailyHttpReceivedContentLength); |
original_update->Clear(); |
received_update->Clear(); |
for (size_t i = 0; i < kNumDaysInHistory; ++i) { |
@@ -475,8 +477,8 @@ DataReductionProxySettings::ContentLengthList |
DataReductionProxySettings::GetDailyContentLengths(const char* pref_name) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
DataReductionProxySettings::ContentLengthList content_lengths; |
- DCHECK(statistics_prefs_); |
- const base::ListValue* list_value = statistics_prefs_->GetList(pref_name); |
+ DCHECK(drp_statistics_); |
+ const base::ListValue* list_value = drp_statistics_->GetList(pref_name); |
if (list_value->GetSize() == kNumDaysInHistory) { |
for (size_t i = 0; i < kNumDaysInHistory; ++i) { |
content_lengths.push_back(GetInt64PrefValue(*list_value, i)); |
@@ -492,12 +494,12 @@ void DataReductionProxySettings::GetContentLengths( |
int64* last_update_time) { |
DCHECK(thread_checker_.CalledOnValidThread()); |
DCHECK_LE(days, kNumDaysInHistory); |
- DCHECK(statistics_prefs_); |
+ DCHECK(drp_statistics_); |
const base::ListValue* original_list = |
- statistics_prefs_->GetList(prefs::kDailyHttpOriginalContentLength); |
+ drp_statistics_->GetList(prefs::kDailyHttpOriginalContentLength); |
const base::ListValue* received_list = |
- statistics_prefs_->GetList(prefs::kDailyHttpReceivedContentLength); |
+ drp_statistics_->GetList(prefs::kDailyHttpReceivedContentLength); |
if (original_list->GetSize() != kNumDaysInHistory || |
received_list->GetSize() != kNumDaysInHistory) { |
@@ -518,7 +520,7 @@ void DataReductionProxySettings::GetContentLengths( |
*original_content_length = orig; |
*received_content_length = recv; |
*last_update_time = |
- statistics_prefs_->GetInt64(prefs::kDailyHttpContentLengthLastUpdateDate); |
+ drp_statistics_->GetInt64(prefs::kDailyHttpContentLengthLastUpdateDate); |
} |
net::URLFetcher* DataReductionProxySettings::GetBaseURLFetcher( |