Chromium Code Reviews| 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 88aa3176d0f6ae6ec6f3c7122300840a353426b4..cd824fd3f620862e708dd0706470eead5e0d824f 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 |
| @@ -6,6 +6,7 @@ |
| #include "base/bind.h" |
| #include "base/command_line.h" |
| +#include "base/message_loop/message_loop_proxy.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram.h" |
| #include "base/metrics/sparse_histogram.h" |
| @@ -105,6 +106,10 @@ DataReductionProxySettings::DataReductionProxySettings( |
| } |
| DataReductionProxySettings::~DataReductionProxySettings() { |
| + if (statistics_prefs_) { |
|
bengr
2015/02/04 23:39:11
#include statistics_prefs.h if you remove the incl
megjablon
2015/02/06 23:40:42
Done.
|
| + statistics_prefs_->WritePrefs(); |
|
bengr
2015/02/04 23:39:11
Verify that this works.
megjablon
2015/02/06 23:40:42
Verified. Also moved to statistics prefs destructo
|
| + statistics_prefs_->ShutdownOnUIThread(); |
| + } |
| if (params()->allowed()) |
| spdy_proxy_auth_enabled_.Destroy(); |
| net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| @@ -127,6 +132,7 @@ void DataReductionProxySettings::InitPrefMembers() { |
| void DataReductionProxySettings::InitDataReductionProxySettings( |
|
bengr
2015/02/04 23:39:11
In the case of WebView, which is called first? Thi
megjablon
2015/02/06 23:40:42
This is called first. Done.
|
| PrefService* prefs, |
| + scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs, |
| net::URLRequestContextGetter* url_request_context_getter, |
| net::NetLog* net_log, |
| DataReductionProxyEventStore* event_store) { |
| @@ -135,6 +141,7 @@ void DataReductionProxySettings::InitDataReductionProxySettings( |
| DCHECK(url_request_context_getter); |
| DCHECK(event_store); |
| prefs_ = prefs; |
| + statistics_prefs_ = statistics_prefs.Pass(); |
| url_request_context_getter_ = url_request_context_getter; |
| net_log_ = net_log; |
| event_store_ = event_store; |
| @@ -150,8 +157,17 @@ void DataReductionProxySettings::InitDataReductionProxySettings( |
| } |
| void DataReductionProxySettings::SetDataReductionProxyStatisticsPrefs( |
| - DataReductionProxyStatisticsPrefs* statistics_prefs) { |
| - statistics_prefs_ = statistics_prefs; |
| + scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs) { |
| + statistics_prefs_ = statistics_prefs.Pass(); |
| +} |
| + |
| +void DataReductionProxySettings::EnableCompressionStatisticsLogging( |
| + PrefService* prefs, |
| + scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| + const base::TimeDelta& commit_delay) { |
| + statistics_prefs_.reset( |
|
bengr
2015/02/04 23:39:11
DCHECK(!statistics_prefs_)
megjablon
2015/02/06 23:40:42
Done.
|
| + new DataReductionProxyStatisticsPrefs( |
| + prefs, ui_task_runner, commit_delay)); |
|
bengr
2015/02/04 23:39:11
Can this fit on the previous line?
megjablon
2015/02/06 23:40:42
No. 2 characters too long.
|
| } |
| void DataReductionProxySettings::SetOnDataReductionEnabledCallback( |