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

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

Issue 651443005: Use no-op statistics collecting object for WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor2
Patch Set: Selim and Ben's comments Created 6 years, 2 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_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(

Powered by Google App Engine
This is Rietveld 408576698