Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 173 |
| 174 io_data_->lazy_params_.reset(lazy_params); | 174 io_data_->lazy_params_.reset(lazy_params); |
| 175 | 175 |
| 176 // Keep track of profile path and cache sizes separately so we can use them | 176 // Keep track of profile path and cache sizes separately so we can use them |
| 177 // on demand when creating storage isolated URLRequestContextGetters. | 177 // on demand when creating storage isolated URLRequestContextGetters. |
| 178 io_data_->profile_path_ = profile_path; | 178 io_data_->profile_path_ = profile_path; |
| 179 io_data_->app_cache_max_size_ = cache_max_size; | 179 io_data_->app_cache_max_size_ = cache_max_size; |
| 180 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 180 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
| 181 | 181 |
| 182 io_data_->predictor_.reset(predictor); | 182 io_data_->predictor_.reset(predictor); |
| 183 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor); | 183 io_data_->domain_reliability_monitor_ = domain_reliability_monitor.release(); |
|
davidben
2016/09/26 21:14:48
This part and the WrapUnique below seems kind of o
mmenke
2016/09/26 21:30:09
Yea, this seems like a problem, and adding it to L
Julia Tuttle
2016/09/27 16:49:59
Done.
Julia Tuttle
2016/09/27 16:49:59
Cool, done.
| |
| 184 | 184 |
| 185 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 185 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 186 if (io_data_->domain_reliability_monitor_) | 186 if (domain_reliability_monitor) |
| 187 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 187 domain_reliability_monitor->MoveToNetworkThread(); |
| 188 | 188 |
| 189 io_data_->set_data_reduction_proxy_io_data( | 189 io_data_->set_data_reduction_proxy_io_data( |
| 190 CreateDataReductionProxyChromeIOData( | 190 CreateDataReductionProxyChromeIOData( |
| 191 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), | 191 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), |
| 192 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | 192 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
| 193 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 193 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
| 194 | 194 |
| 195 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 195 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 196 scoped_refptr<base::SequencedTaskRunner> db_task_runner = | 196 scoped_refptr<base::SequencedTaskRunner> db_task_runner = |
| 197 pool->GetSequencedTaskRunnerWithShutdownBehavior( | 197 pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 : cache_max_size(0), | 418 : cache_max_size(0), |
| 419 media_cache_max_size(0), | 419 media_cache_max_size(0), |
| 420 session_cookie_mode( | 420 session_cookie_mode( |
| 421 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} | 421 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES) {} |
| 422 | 422 |
| 423 ProfileImplIOData::LazyParams::~LazyParams() {} | 423 ProfileImplIOData::LazyParams::~LazyParams() {} |
| 424 | 424 |
| 425 ProfileImplIOData::ProfileImplIOData() | 425 ProfileImplIOData::ProfileImplIOData() |
| 426 : ProfileIOData(Profile::REGULAR_PROFILE), | 426 : ProfileIOData(Profile::REGULAR_PROFILE), |
| 427 http_server_properties_manager_(NULL), | 427 http_server_properties_manager_(NULL), |
| 428 domain_reliability_monitor_(nullptr), | |
| 428 app_cache_max_size_(0), | 429 app_cache_max_size_(0), |
| 429 app_media_cache_max_size_(0) { | 430 app_media_cache_max_size_(0) { |
| 430 } | 431 } |
| 431 | 432 |
| 432 ProfileImplIOData::~ProfileImplIOData() { | 433 ProfileImplIOData::~ProfileImplIOData() { |
| 434 if (domain_reliability_monitor_) | |
| 435 domain_reliability_monitor_->Shutdown(); | |
| 436 | |
| 433 DestroyResourceContext(); | 437 DestroyResourceContext(); |
| 434 | 438 |
| 435 if (media_request_context_) | 439 if (media_request_context_) |
| 436 media_request_context_->AssertNoURLRequests(); | 440 media_request_context_->AssertNoURLRequests(); |
| 437 } | 441 } |
| 438 | 442 |
| 439 void ProfileImplIOData::InitializeInternal( | 443 void ProfileImplIOData::InitializeInternal( |
| 440 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, | 444 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate, |
| 441 ProfileParams* profile_params, | 445 ProfileParams* profile_params, |
| 442 content::ProtocolHandlerMap* protocol_handlers, | 446 content::ProtocolHandlerMap* protocol_handlers, |
| 443 content::URLRequestInterceptorScopedVector request_interceptors) const { | 447 content::URLRequestInterceptorScopedVector request_interceptors) const { |
| 444 // Set up a persistent store for use by the network stack on the IO thread. | 448 // Set up a persistent store for use by the network stack on the IO thread. |
| 445 base::FilePath network_json_store_filepath( | 449 base::FilePath network_json_store_filepath( |
| 446 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); | 450 profile_path_.Append(chrome::kNetworkPersistentStateFilename)); |
| 447 network_json_store_ = new JsonPrefStore( | 451 network_json_store_ = new JsonPrefStore( |
| 448 network_json_store_filepath, | 452 network_json_store_filepath, |
| 449 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, | 453 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, |
| 450 BrowserThread::GetBlockingPool()), | 454 BrowserThread::GetBlockingPool()), |
| 451 std::unique_ptr<PrefFilter>()); | 455 std::unique_ptr<PrefFilter>()); |
| 452 network_json_store_->ReadPrefsAsync(nullptr); | 456 network_json_store_->ReadPrefsAsync(nullptr); |
| 453 | 457 |
| 454 net::URLRequestContext* main_context = main_request_context(); | 458 net::URLRequestContext* main_context = main_request_context(); |
| 455 | 459 |
| 456 IOThread* const io_thread = profile_params->io_thread; | 460 IOThread* const io_thread = profile_params->io_thread; |
| 457 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 461 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
| 458 | 462 |
| 459 if (domain_reliability_monitor_) { | 463 if (domain_reliability_monitor_) { |
| 460 domain_reliability::DomainReliabilityMonitor* monitor = | 464 domain_reliability::DomainReliabilityMonitor* monitor = |
| 461 domain_reliability_monitor_.get(); | 465 domain_reliability_monitor_; |
| 462 monitor->InitURLRequestContext(main_context); | 466 monitor->InitURLRequestContext(main_context); |
| 463 monitor->AddBakedInConfigs(); | 467 monitor->AddBakedInConfigs(); |
| 464 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); | 468 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); |
| 465 chrome_network_delegate->set_domain_reliability_monitor(monitor); | 469 chrome_network_delegate->set_domain_reliability_monitor( |
| 470 base::WrapUnique(monitor)); | |
| 466 } | 471 } |
| 467 | 472 |
| 468 ApplyProfileParamsToContext(main_context); | 473 ApplyProfileParamsToContext(main_context); |
| 469 | 474 |
| 470 if (http_server_properties_manager_) | 475 if (http_server_properties_manager_) |
| 471 http_server_properties_manager_->InitializeOnNetworkThread(); | 476 http_server_properties_manager_->InitializeOnNetworkThread(); |
| 472 | 477 |
| 473 main_context->set_transport_security_state(transport_security_state()); | 478 main_context->set_transport_security_state(transport_security_state()); |
| 474 main_context->set_ct_policy_enforcer( | 479 main_context->set_ct_policy_enforcer( |
| 475 io_thread_globals->ct_policy_enforcer.get()); | 480 io_thread_globals->ct_policy_enforcer.get()); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 const base::Closure& completion) { | 809 const base::Closure& completion) { |
| 805 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 810 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 806 DCHECK(initialized()); | 811 DCHECK(initialized()); |
| 807 | 812 |
| 808 DCHECK(transport_security_state()); | 813 DCHECK(transport_security_state()); |
| 809 // Completes synchronously. | 814 // Completes synchronously. |
| 810 transport_security_state()->DeleteAllDynamicDataSince(time); | 815 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 811 DCHECK(http_server_properties_manager_); | 816 DCHECK(http_server_properties_manager_); |
| 812 http_server_properties_manager_->Clear(completion); | 817 http_server_properties_manager_->Clear(completion); |
| 813 } | 818 } |
| OLD | NEW |