Chromium Code Reviews| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| index ce1f7c96096ffd7cfbd2c5fd8857c227b0b4cf9e..a18b84daf803ddb98bec744aeeac7ef1406045e9 100644 |
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/message_loop/message_loop_proxy.h" |
| #include "base/prefs/pref_service.h" |
| #include "base/prefs/scoped_user_pref_update.h" |
| #include "chrome/browser/browser_process.h" |
| @@ -64,9 +65,24 @@ void DataReductionProxyChromeSettings::InitDataReductionProxySettings( |
| PrefService* profile_prefs, |
| PrefService* local_state_prefs, |
| net::URLRequestContextGetter* request_context) { |
| +#if defined(OS_ANDROID) || defined(OS_IOS) |
| + // On mobile we write data reduction proxy prefs directly to the pref service. |
| + // On desktop we store data reduction proxy prefs in memory, writing to disk |
| + // every 60 minutes and on termination. Shutdown hooks must be added for |
| + // Android and iOS in order for non-zero delays to be supported. |
| + // (http://crbug.com/408264) |
| + base::TimeDelta commit_delay = base::TimeDelta(); |
| +#else |
| + base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| +#endif |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
| + statistics_prefs( |
| + new data_reduction_proxy::DataReductionProxyStatisticsPrefs( |
| + profile_prefs, base::MessageLoopProxy::current(), commit_delay)); |
| SetProxyConfigurator(io_data->configurator()); |
| DataReductionProxySettings::InitDataReductionProxySettings( |
| profile_prefs, |
| + statistics_prefs.Pass(), |
| request_context, |
| io_data->net_log(), |
| io_data->event_store()); |
| @@ -77,6 +93,8 @@ void DataReductionProxyChromeSettings::InitDataReductionProxySettings( |
| DataReductionProxyParams::IsIncludedInAlternativeFieldTrial()); |
| // TODO(bengr): Remove after M46. See http://crbug.com/445599. |
| MigrateDataReductionProxyOffProxyPrefs(profile_prefs); |
| + io_data->SetDataReductionProxyStatisticsPrefs( |
| + DataReductionProxySettings::statistics_prefs()->GetWeakPtr()); |
|
bengr
2015/02/04 23:39:10
Add a comment to the declaration of InitDRPSetting
megjablon
2015/02/06 23:40:41
Done.
|
| } |
| void DataReductionProxyChromeSettings::RegisterSyntheticFieldTrial( |