OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 #endif | 108 #endif |
109 if (save_prefs) | 109 if (save_prefs) |
110 io_data_->predictor_->SaveStateForNextStartupAndTrim(); | 110 io_data_->predictor_->SaveStateForNextStartupAndTrim(); |
111 io_data_->predictor_->ShutdownOnUIThread(); | 111 io_data_->predictor_->ShutdownOnUIThread(); |
112 } | 112 } |
113 | 113 |
114 if (io_data_->http_server_properties_manager_) | 114 if (io_data_->http_server_properties_manager_) |
115 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); | 115 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); |
116 | 116 |
117 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); | 117 io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); |
118 io_data_->data_reduction_proxy_enabled()->Destroy(); | |
mmenke
2014/10/09 14:49:35
Think it's more consistent to do this before Shutd
Not at Google. Contact bengr
2014/10/09 22:24:41
Done.
| |
118 } | 119 } |
119 | 120 |
120 void ProfileImplIOData::Handle::Init( | 121 void ProfileImplIOData::Handle::Init( |
121 const base::FilePath& cookie_path, | 122 const base::FilePath& cookie_path, |
122 const base::FilePath& channel_id_path, | 123 const base::FilePath& channel_id_path, |
123 const base::FilePath& cache_path, | 124 const base::FilePath& cache_path, |
124 int cache_max_size, | 125 int cache_max_size, |
125 const base::FilePath& media_cache_path, | 126 const base::FilePath& media_cache_path, |
126 int media_cache_max_size, | 127 int media_cache_max_size, |
127 const base::FilePath& extensions_cookie_path, | 128 const base::FilePath& extensions_cookie_path, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 BrowserThread::PostTask( | 327 BrowserThread::PostTask( |
327 BrowserThread::IO, FROM_HERE, | 328 BrowserThread::IO, FROM_HERE, |
328 base::Bind( | 329 base::Bind( |
329 &ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread, | 330 &ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread, |
330 base::Unretained(io_data_), | 331 base::Unretained(io_data_), |
331 time, | 332 time, |
332 completion)); | 333 completion)); |
333 } | 334 } |
334 | 335 |
335 void ProfileImplIOData::Handle::LazyInitialize() const { | 336 void ProfileImplIOData::Handle::LazyInitialize() const { |
337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
336 if (initialized_) | 338 if (initialized_) |
337 return; | 339 return; |
338 | 340 |
339 // Set initialized_ to true at the beginning in case any of the objects | 341 // Set initialized_ to true at the beginning in case any of the objects |
340 // below try to get the ResourceContext pointer. | 342 // below try to get the ResourceContext pointer. |
341 initialized_ = true; | 343 initialized_ = true; |
342 PrefService* pref_service = profile_->GetPrefs(); | 344 PrefService* pref_service = profile_->GetPrefs(); |
343 io_data_->http_server_properties_manager_ = | 345 io_data_->http_server_properties_manager_ = |
344 chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager( | 346 chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager( |
345 pref_service); | 347 pref_service); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); | 433 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)))); |
432 set_data_reduction_proxy_usage_stats( | 434 set_data_reduction_proxy_usage_stats( |
433 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> | 435 scoped_ptr<data_reduction_proxy::DataReductionProxyUsageStats> |
434 (new data_reduction_proxy::DataReductionProxyUsageStats( | 436 (new data_reduction_proxy::DataReductionProxyUsageStats( |
435 data_reduction_proxy_params(), | 437 data_reduction_proxy_params(), |
436 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) | 438 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI) |
437 .get()))); | 439 .get()))); |
438 data_reduction_proxy_usage_stats()->set_unavailable_callback( | 440 data_reduction_proxy_usage_stats()->set_unavailable_callback( |
439 data_reduction_proxy_unavailable_callback()); | 441 data_reduction_proxy_unavailable_callback()); |
440 | 442 |
443 network_delegate()->set_data_reduction_proxy_enabled_pref( | |
444 &data_reduction_proxy_enabled_); | |
441 network_delegate()->set_data_reduction_proxy_params( | 445 network_delegate()->set_data_reduction_proxy_params( |
442 data_reduction_proxy_params()); | 446 data_reduction_proxy_params()); |
443 network_delegate()->set_data_reduction_proxy_usage_stats( | 447 network_delegate()->set_data_reduction_proxy_usage_stats( |
444 data_reduction_proxy_usage_stats()); | 448 data_reduction_proxy_usage_stats()); |
445 network_delegate()->set_data_reduction_proxy_auth_request_handler( | 449 network_delegate()->set_data_reduction_proxy_auth_request_handler( |
446 data_reduction_proxy_auth_request_handler()); | 450 data_reduction_proxy_auth_request_handler()); |
447 network_delegate()->set_data_reduction_proxy_statistics_prefs( | 451 network_delegate()->set_data_reduction_proxy_statistics_prefs( |
448 data_reduction_proxy_statistics_prefs()); | 452 data_reduction_proxy_statistics_prefs()); |
449 network_delegate()->set_on_resolve_proxy_handler( | 453 network_delegate()->set_on_resolve_proxy_handler( |
450 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); | 454 base::Bind(data_reduction_proxy::OnResolveProxyHandler)); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 const base::Closure& completion) { | 827 const base::Closure& completion) { |
824 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 828 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
825 DCHECK(initialized()); | 829 DCHECK(initialized()); |
826 | 830 |
827 DCHECK(transport_security_state()); | 831 DCHECK(transport_security_state()); |
828 // Completes synchronously. | 832 // Completes synchronously. |
829 transport_security_state()->DeleteAllDynamicDataSince(time); | 833 transport_security_state()->DeleteAllDynamicDataSince(time); |
830 DCHECK(http_server_properties_manager_); | 834 DCHECK(http_server_properties_manager_); |
831 http_server_properties_manager_->Clear(completion); | 835 http_server_properties_manager_->Clear(completion); |
832 } | 836 } |
837 | |
838 bool ProfileImplIOData::IsDataReductionProxyEnabled() const { | |
839 return data_reduction_proxy_enabled_.GetValue() || | |
840 CommandLine::ForCurrentProcess()->HasSwitch( | |
841 data_reduction_proxy::switches::kEnableDataReductionProxy); | |
842 } | |
OLD | NEW |