| 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 <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 lazy_params->cookie_path = cookie_path; | 165 lazy_params->cookie_path = cookie_path; |
| 166 lazy_params->channel_id_path = channel_id_path; | 166 lazy_params->channel_id_path = channel_id_path; |
| 167 lazy_params->cache_path = cache_path; | 167 lazy_params->cache_path = cache_path; |
| 168 lazy_params->cache_max_size = cache_max_size; | 168 lazy_params->cache_max_size = cache_max_size; |
| 169 lazy_params->media_cache_path = media_cache_path; | 169 lazy_params->media_cache_path = media_cache_path; |
| 170 lazy_params->media_cache_max_size = media_cache_max_size; | 170 lazy_params->media_cache_max_size = media_cache_max_size; |
| 171 lazy_params->extensions_cookie_path = extensions_cookie_path; | 171 lazy_params->extensions_cookie_path = extensions_cookie_path; |
| 172 lazy_params->session_cookie_mode = session_cookie_mode; | 172 lazy_params->session_cookie_mode = session_cookie_mode; |
| 173 lazy_params->special_storage_policy = special_storage_policy; | 173 lazy_params->special_storage_policy = special_storage_policy; |
| 174 lazy_params->domain_reliability_monitor = |
| 175 std::move(domain_reliability_monitor); |
| 174 | 176 |
| 175 io_data_->lazy_params_.reset(lazy_params); | 177 io_data_->lazy_params_.reset(lazy_params); |
| 176 | 178 |
| 177 // Keep track of profile path and cache sizes separately so we can use them | 179 // Keep track of profile path and cache sizes separately so we can use them |
| 178 // on demand when creating storage isolated URLRequestContextGetters. | 180 // on demand when creating storage isolated URLRequestContextGetters. |
| 179 io_data_->profile_path_ = profile_path; | 181 io_data_->profile_path_ = profile_path; |
| 180 io_data_->app_cache_max_size_ = cache_max_size; | 182 io_data_->app_cache_max_size_ = cache_max_size; |
| 181 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 183 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
| 182 | 184 |
| 183 io_data_->predictor_.reset(predictor); | 185 io_data_->predictor_.reset(predictor); |
| 184 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor); | |
| 185 | 186 |
| 186 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 187 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 187 if (io_data_->domain_reliability_monitor_) | 188 if (domain_reliability_monitor) |
| 188 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 189 domain_reliability_monitor->MoveToNetworkThread(); |
| 189 | 190 |
| 190 io_data_->set_data_reduction_proxy_io_data( | 191 io_data_->set_data_reduction_proxy_io_data( |
| 191 CreateDataReductionProxyChromeIOData( | 192 CreateDataReductionProxyChromeIOData( |
| 192 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), | 193 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), |
| 193 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 194 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 194 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 195 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
| 195 | 196 |
| 196 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 197 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 197 scoped_refptr<base::SequencedTaskRunner> db_task_runner = | 198 scoped_refptr<base::SequencedTaskRunner> db_task_runner = |
| 198 pool->GetSequencedTaskRunnerWithShutdownBehavior( | 199 pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 : cache_max_size(0), | 420 : cache_max_size(0), |
| 420 media_cache_max_size(0), | 421 media_cache_max_size(0), |
| 421 session_cookie_mode( | 422 session_cookie_mode( |
| 422 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} | 423 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} |
| 423 | 424 |
| 424 ProfileImplIOData::LazyParams::~LazyParams() {} | 425 ProfileImplIOData::LazyParams::~LazyParams() {} |
| 425 | 426 |
| 426 ProfileImplIOData::ProfileImplIOData() | 427 ProfileImplIOData::ProfileImplIOData() |
| 427 : ProfileIOData(Profile::REGULAR_PROFILE), | 428 : ProfileIOData(Profile::REGULAR_PROFILE), |
| 428 http_server_properties_manager_(NULL), | 429 http_server_properties_manager_(NULL), |
| 430 domain_reliability_monitor_(nullptr), |
| 429 app_cache_max_size_(0), | 431 app_cache_max_size_(0), |
| 430 app_media_cache_max_size_(0) { | 432 app_media_cache_max_size_(0) { |
| 431 } | 433 } |
| 432 | 434 |
| 433 ProfileImplIOData::~ProfileImplIOData() { | 435 ProfileImplIOData::~ProfileImplIOData() { |
| 436 if (domain_reliability_monitor_) |
| 437 domain_reliability_monitor_->Shutdown(); |
| 438 |
| 434 DestroyResourceContext(); | 439 DestroyResourceContext(); |
| 435 | 440 |
| 436 if (media_request_context_) | 441 if (media_request_context_) |
| 437 media_request_context_->AssertNoURLRequests(); | 442 media_request_context_->AssertNoURLRequests(); |
| 438 } | 443 } |
| 439 | 444 |
| 440 void ProfileImplIOData::InitializeInternal( | 445 void ProfileImplIOData::InitializeInternal( |
| 441 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, | 446 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, |
| 442 ProfileParams* profile_params, | 447 ProfileParams* profile_params, |
| 443 content::ProtocolHandlerMap* protocol_handlers, | 448 content::ProtocolHandlerMap* protocol_handlers, |
| 444 content::URLRequestInterceptorScopedVector request_interceptors) const { | 449 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 445 // Set up a persistent store for use by the network stack on the IO thread. | 450 // Set up a persistent store for use by the network stack on the IO thread. |
| 446 base::FilePath network_json_store_filepath( | 451 base::FilePath network_json_store_filepath( |
| 447 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); | 452 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); |
| 448 network_json_store_ = new JsonPrefStore( | 453 network_json_store_ = new JsonPrefStore( |
| 449 network_json_store_filepath, | 454 network_json_store_filepath, |
| 450 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, | 455 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, |
| 451 BrowserThread::GetBlockingPool()), | 456 BrowserThread::GetBlockingPool()), |
| 452 std::unique_ptr<PrefFilter>()); | 457 std::unique_ptr<PrefFilter>()); |
| 453 network_json_store_->ReadPrefsAsync(nullptr); | 458 network_json_store_->ReadPrefsAsync(nullptr); |
| 454 | 459 |
| 455 net::URLRequestContext* main_context = main_request_context(); | 460 net::URLRequestContext* main_context = main_request_context(); |
| 456 | 461 |
| 457 IOThread* const io_thread = profile_params->io_thread; | 462 IOThread* const io_thread = profile_params->io_thread; |
| 458 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 463 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 459 | 464 |
| 460 if (domain_reliability_monitor_) { | 465 if (lazy_params_->domain_reliability_monitor) { |
| 461 domain_reliability::DomainReliabilityMonitor* monitor = | 466 std::unique_ptr<domain_reliability::DomainReliabilityMonitor> monitor = |
| 462 domain_reliability_monitor_.get(); | 467 std::move(lazy_params_->domain_reliability_monitor); |
| 463 monitor->InitURLRequestContext(main_context); | 468 monitor->InitURLRequestContext(main_context); |
| 464 monitor->AddBakedInConfigs(); | 469 monitor->AddBakedInConfigs(); |
| 465 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); | 470 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); |
| 466 chrome_network_delegate->set_domain_reliability_monitor(monitor); | 471 chrome_network_delegate->set_domain_reliability_monitor( |
| 472 std::move(monitor)); |
| 467 } | 473 } |
| 468 | 474 |
| 469 ApplyProfileParamsToContext(main_context); | 475 ApplyProfileParamsToContext(main_context); |
| 470 | 476 |
| 471 if (http_server_properties_manager_) | 477 if (http_server_properties_manager_) |
| 472 http_server_properties_manager_->InitializeOnNetworkThread(); | 478 http_server_properties_manager_->InitializeOnNetworkThread(); |
| 473 | 479 |
| 474 main_context->set_transport_security_state(transport_security_state()); | 480 main_context->set_transport_security_state(transport_security_state()); |
| 475 main_context->set_ct_policy_enforcer( | 481 main_context->set_ct_policy_enforcer( |
| 476 io_thread_globals->ct_policy_enforcer.get()); | 482 io_thread_globals->ct_policy_enforcer.get()); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 const base::Closure& completion) { | 813 const base::Closure& completion) { |
| 808 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 814 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 809 DCHECK(initialized()); | 815 DCHECK(initialized()); |
| 810 | 816 |
| 811 DCHECK(transport_security_state()); | 817 DCHECK(transport_security_state()); |
| 812 // Completes synchronously. | 818 // Completes synchronously. |
| 813 transport_security_state()->DeleteAllDynamicDataSince(time); | 819 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 814 DCHECK(http_server_properties_manager_); | 820 DCHECK(http_server_properties_manager_); |
| 815 http_server_properties_manager_->Clear(completion); | 821 http_server_properties_manager_->Clear(completion); |
| 816 } | 822 } |
| OLD | NEW |