| Index: components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
|
| diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
|
| index 2093d841ad81082b308dd79055433b449c75aa38..780284b60889c559654278a28241da360b5f0b17 100644
|
| --- a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
|
| +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
|
| @@ -5,10 +5,9 @@
|
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h"
|
|
|
| #include "base/metrics/histogram.h"
|
| -#include "base/prefs/pref_service.h"
|
| -#include "base/prefs/scoped_user_pref_update.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_util.h"
|
| +#include "components/data_reduction_proxy/browser/data_reduction_proxy_delayed_pref_service.h"
|
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
|
| #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h"
|
| #include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
|
| @@ -194,14 +193,14 @@ class DailyContentLengthUpdate {
|
| public:
|
| DailyContentLengthUpdate(
|
| const char* pref,
|
| - PrefService* pref_service)
|
| - : update_(pref_service, pref) {
|
| + DataReductionProxyDelayedPrefService* pref_service)
|
| + : update_(pref_service->GetList(pref)) {
|
| }
|
|
|
| void UpdateForDataChange(int days_since_last_update) {
|
| // New empty lists may have been created. Maintain the invariant that
|
| // there should be exactly |kNumDaysInHistory| days in the histories.
|
| - MaintainContentLengthPrefsWindow(update_.Get(), kNumDaysInHistory);
|
| + MaintainContentLengthPrefsWindow(update_, kNumDaysInHistory);
|
| if (days_since_last_update) {
|
| MaintainContentLengthPrefForDateChange(days_since_last_update);
|
| }
|
| @@ -209,7 +208,7 @@ class DailyContentLengthUpdate {
|
|
|
| // Update the lengths for the current day.
|
| void Add(int content_length) {
|
| - AddInt64ToListPref(kNumDaysInHistory - 1, content_length, update_.Get());
|
| + AddInt64ToListPref(kNumDaysInHistory - 1, content_length, update_);
|
| }
|
|
|
| int64 GetListPrefValue(size_t index) {
|
| @@ -248,10 +247,10 @@ class DailyContentLengthUpdate {
|
|
|
| // Entries for new days may have been appended. Maintain the invariant that
|
| // there should be exactly |kNumDaysInHistory| days in the histories.
|
| - MaintainContentLengthPrefsWindow(update_.Get(), kNumDaysInHistory);
|
| + MaintainContentLengthPrefsWindow(update_, kNumDaysInHistory);
|
| }
|
|
|
| - ListPrefUpdate update_;
|
| + base::ListValue* update_;
|
| };
|
|
|
| // DailyDataSavingUpdate maintains a pair of data saving prefs, original_update_
|
| @@ -264,7 +263,7 @@ class DailyDataSavingUpdate {
|
| DailyDataSavingUpdate(
|
| const char* pref_original,
|
| const char* pref_received,
|
| - PrefService* pref_service)
|
| + DataReductionProxyDelayedPrefService* pref_service)
|
| : original_(pref_original, pref_service),
|
| received_(pref_received, pref_service) {
|
| }
|
| @@ -339,7 +338,8 @@ void UpdateContentLengthPrefsForDataReductionProxy(
|
| int original_content_length,
|
| bool with_data_reduction_proxy_enabled,
|
| DataReductionProxyRequestType request_type,
|
| - base::Time now, PrefService* prefs) {
|
| + base::Time now,
|
| + DataReductionProxyDelayedPrefService* prefs) {
|
| // TODO(bengr): Remove this check once the underlying cause of
|
| // http://crbug.com/287821 is fixed. For now, only continue if the current
|
| // year is reported as being between 1972 and 2970.
|
| @@ -478,7 +478,7 @@ void UpdateContentLengthPrefs(
|
| int original_content_length,
|
| bool with_data_reduction_proxy_enabled,
|
| DataReductionProxyRequestType request_type,
|
| - PrefService* prefs) {
|
| + DataReductionProxyDelayedPrefService* prefs) {
|
| int64 total_received = prefs->GetInt64(
|
| data_reduction_proxy::prefs::kHttpReceivedContentLength);
|
| int64 total_original = prefs->GetInt64(
|
|
|