Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl.cc |
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
| index 670bbb966b0d57be891afbdbd54cab6cf2cd70c9..a65fb65c7378b52e85dfa8059a5af95fc5761712 100644 |
| --- a/chrome/browser/profiles/profile_impl.cc |
| +++ b/chrome/browser/profiles/profile_impl.cc |
| @@ -44,6 +44,7 @@ |
| #include "chrome/browser/net/predictor.h" |
| #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| #include "chrome/browser/net/proxy_service_factory.h" |
| +#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h" |
| #include "chrome/browser/net/ssl_config_service_manager.h" |
| @@ -84,6 +85,7 @@ |
| #include "components/bookmarks/browser/bookmark_model.h" |
| #include "components/content_settings/core/browser/host_content_settings_map.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h" |
| @@ -642,66 +644,24 @@ void ProfileImpl::DoFinalInit() { |
| ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); |
| - base::Callback<void(bool)> data_reduction_proxy_unavailable; |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
| - data_reduction_proxy_params; |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> configurator; |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
| - data_reduction_proxy_statistics_prefs; |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> event_store; |
| - DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = |
| - DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); |
| - data_reduction_proxy_params = |
| - data_reduction_proxy_chrome_settings->params()->Clone(); |
| - data_reduction_proxy_unavailable = |
| - base::Bind( |
| - &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, |
| - base::Unretained(data_reduction_proxy_chrome_settings)); |
| - // The event_store is used by DataReductionProxyChromeSettings, configurator, |
| - // and ProfileIOData. Ownership is passed to the latter via |
| - // ProfileIOData::Handle, which is only destroyed after |
| - // BrowserContextKeyedServices, including DataReductionProxyChromeSettings |
| - event_store.reset( |
| - new data_reduction_proxy::DataReductionProxyEventStore( |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); |
| - // The configurator is used by DataReductionProxyChromeSettings and |
| - // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, |
| - // which is only destroyed after BrowserContextKeyedServices, |
| - // including DataReductionProxyChromeSettings. |
| - configurator.reset( |
| - new data_reduction_proxy::DataReductionProxyConfigurator( |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| - net_log, |
| - event_store.get())); |
| - // Retain a raw pointer to use for initialization of data reduction proxy |
| - // settings after ownership is passed |
| - data_reduction_proxy::DataReductionProxyEventStore* |
| - data_reduction_proxy_event_store = event_store.get(); |
| // Retain a raw pointer to use for initialization of data reduction proxy |
| // settings after ownership is passed. |
| data_reduction_proxy::DataReductionProxyConfigurator* |
| - data_reduction_proxy_configurator = configurator.get(); |
| -#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 |
| - // TODO(bengr): Remove this in M-43. |
| - data_reduction_proxy::MigrateStatisticsPrefs(g_browser_process->local_state(), |
| - prefs_.get()); |
| - data_reduction_proxy_statistics_prefs = |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>( |
| - new data_reduction_proxy::DataReductionProxyStatisticsPrefs( |
| - prefs_.get(), |
| - base::MessageLoopProxy::current(), |
| - commit_delay)); |
| - data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs( |
| - data_reduction_proxy_statistics_prefs.get()); |
| + data_reduction_proxy_configurator = nullptr; |
| + |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| + data_reduction_proxy_io_data = |
| + CreateDataReductionProxyChromeIOData( |
| + net_log, this, prefs_.get(), |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| + &data_reduction_proxy_configurator).Pass(); |
|
mmenke
2015/01/16 19:03:20
Does any of this stuff need to be done in profile_
bengr
2015/01/17 00:20:47
I think the answer is yes, for now, because InitDa
mmenke
2015/01/17 00:29:54
Right, I was thinking we could move that, too.
bengr
2015/01/21 23:28:02
Done.
|
| + |
| + // Retain a raw pointer to use for initialization of data reduction proxy |
| + // settings after ownership is passed |
| + data_reduction_proxy::DataReductionProxyEventStore* |
| + data_reduction_proxy_event_store = |
| + data_reduction_proxy_io_data->event_store(); |
| // Make sure we initialize the ProfileIOData after everything else has been |
| // initialized that we might be reading from the IO thread. |
| @@ -711,18 +671,12 @@ void ProfileImpl::DoFinalInit() { |
| extensions_cookie_path, GetPath(), infinite_cache_path, |
| predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
| CreateDomainReliabilityMonitor(local_state), |
| - data_reduction_proxy_unavailable, |
| - configurator.Pass(), |
| - data_reduction_proxy_params.Pass(), |
| - data_reduction_proxy_statistics_prefs.Pass(), |
| - event_store.Pass()); |
| - data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( |
| - data_reduction_proxy_configurator, |
| - prefs_.get(), |
| - g_browser_process->local_state(), |
| - GetRequestContext(), |
| - net_log, |
| - data_reduction_proxy_event_store); |
| + data_reduction_proxy_io_data.Pass()); |
| + DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this)-> |
|
mmenke
2015/01/16 19:03:20
Cant this call be moved before io_data_.Init? I a
bengr
2015/01/17 00:20:47
Ack that this is kinda weird and not ideal. Unfort
|
| + InitDataReductionProxySettings( |
| + data_reduction_proxy_configurator, prefs_.get(), |
| + g_browser_process->local_state(), GetRequestContext(), net_log, |
|
mmenke
2015/01/16 19:03:20
Question: Not for this CL, but for the future...D
bengr
2015/01/17 00:20:47
See above reply. Even better is that we'd remove t
|
| + data_reduction_proxy_event_store); |
| #if defined(ENABLE_PLUGINS) |
| ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |