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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 io_data_->app_cache_max_size_ = cache_max_size; | 186 io_data_->app_cache_max_size_ = cache_max_size; |
| 187 io_data_->app_media_cache_max_size_ = media_cache_max_size; | 187 io_data_->app_media_cache_max_size_ = media_cache_max_size; |
| 188 | 188 |
| 189 io_data_->predictor_.reset(predictor); | 189 io_data_->predictor_.reset(predictor); |
| 190 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor); | 190 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor); |
| 191 | 191 |
| 192 io_data_->InitializeMetricsEnabledStateOnUIThread(); | 192 io_data_->InitializeMetricsEnabledStateOnUIThread(); |
| 193 if (io_data_->domain_reliability_monitor_) | 193 if (io_data_->domain_reliability_monitor_) |
| 194 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); | 194 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); |
| 195 | 195 |
| 196 io_data_->set_data_reduction_proxy_io_data( | |
| 197 CreateDataReductionProxyChromeIOData( | |
| 198 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), | |
| 199 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | |
| 200 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | |
| 201 | |
| 202 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | |
| 203 scoped_refptr<base::SequencedTaskRunner> db_task_runner = | |
| 204 pool->GetSequencedTaskRunnerWithShutdownBehavior( | |
| 205 pool->GetSequenceToken(), | |
| 206 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | |
| 207 std::unique_ptr<data_reduction_proxy::DataStore> store( | |
| 208 new data_reduction_proxy::DataStoreImpl(profile_path)); | |
| 209 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_) | |
| 210 ->InitDataReductionProxySettings( | |
| 211 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(), | |
| 212 profile_->GetRequestContext(), std::move(store), | |
| 213 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | |
| 214 db_task_runner); | |
| 215 | |
| 216 io_data_->previews_io_data_ = base::MakeUnique<previews::PreviewsIOData>( | 196 io_data_->previews_io_data_ = base::MakeUnique<previews::PreviewsIOData>( |
| 217 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 197 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 218 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 198 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 219 PreviewsServiceFactory::GetForProfile(profile_)->Initialize( | 199 PreviewsServiceFactory::GetForProfile(profile_)->Initialize( |
| 220 io_data_->previews_io_data_.get(), | 200 io_data_->previews_io_data_.get(), |
| 221 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), profile_path); | 201 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), profile_path); |
| 202 | |
| 203 io_data_->set_data_reduction_proxy_io_data( | |
| 204 CreateDataReductionProxyChromeIOData( | |
| 205 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), | |
| 206 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), | |
| 207 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | |
|
mmenke
2016/11/04 19:02:44
I'm not objecting, but is there a reason you're mo
bengr
2016/11/07 18:13:40
Likewise, I'm curious why you're moving this.
RyanSturm
2016/11/07 18:21:53
I talked to mmenke about this, and he's actually a
| |
| 222 } | 208 } |
| 223 | 209 |
| 224 content::ResourceContext* | 210 content::ResourceContext* |
| 225 ProfileImplIOData::Handle::GetResourceContext() const { | 211 ProfileImplIOData::Handle::GetResourceContext() const { |
| 226 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 212 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 227 LazyInitialize(); | 213 LazyInitialize(); |
| 228 return GetResourceContextNoInit(); | 214 return GetResourceContextNoInit(); |
| 229 } | 215 } |
| 230 | 216 |
| 231 content::ResourceContext* | 217 content::ResourceContext* |
| 232 ProfileImplIOData::Handle::GetResourceContextNoInit() const { | 218 ProfileImplIOData::Handle::GetResourceContextNoInit() const { |
| 233 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 234 // Don't call LazyInitialize here, since the resource context is created at | 220 // Don't call LazyInitialize here, since the resource context is created at |
| 235 // the beginning of initalization and is used by some members while they're | 221 // the beginning of initalization and is used by some members while they're |
| 236 // being initialized (i.e. AppCacheService). | 222 // being initialized (i.e. AppCacheService). |
| 237 return io_data_->GetResourceContext(); | 223 return io_data_->GetResourceContext(); |
| 238 } | 224 } |
| 239 | 225 |
| 240 scoped_refptr<ChromeURLRequestContextGetter> | 226 scoped_refptr<ChromeURLRequestContextGetter> |
| 241 ProfileImplIOData::Handle::CreateMainRequestContextGetter( | 227 ProfileImplIOData::Handle::CreateMainRequestContextGetter( |
| 242 content::ProtocolHandlerMap* protocol_handlers, | 228 content::ProtocolHandlerMap* protocol_handlers, |
| 243 content::URLRequestInterceptorScopedVector request_interceptors, | 229 content::URLRequestInterceptorScopedVector request_interceptors, |
| 244 IOThread* io_thread) const { | 230 IOThread* io_thread) const { |
| 245 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 231 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 246 LazyInitialize(); | 232 LazyInitialize(); |
| 247 DCHECK(!main_request_context_getter_.get()); | 233 DCHECK(!main_request_context_getter_.get()); |
| 248 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( | 234 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( |
| 249 profile_, io_data_, protocol_handlers, std::move(request_interceptors)); | 235 profile_, io_data_, protocol_handlers, std::move(request_interceptors)); |
| 250 | 236 |
| 237 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | |
| 238 scoped_refptr<base::SequencedTaskRunner> db_task_runner = | |
| 239 pool->GetSequencedTaskRunnerWithShutdownBehavior( | |
| 240 pool->GetSequenceToken(), | |
| 241 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | |
| 242 std::unique_ptr<data_reduction_proxy::DataStore> store( | |
| 243 new data_reduction_proxy::DataStoreImpl(io_data_->profile_path_)); | |
| 244 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_) | |
| 245 ->InitDataReductionProxySettings( | |
| 246 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(), | |
| 247 main_request_context_getter_.get(), std::move(store), | |
| 248 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | |
| 249 db_task_runner); | |
|
mmenke
2016/11/04 17:25:10
What happens if we start making requests on the IO
RyanSturm
2016/11/04 18:46:39
We still wait for config to be set up in DRP, whic
| |
| 250 | |
| 251 io_data_->predictor_ | 251 io_data_->predictor_ |
| 252 ->InitNetworkPredictor(profile_->GetPrefs(), | 252 ->InitNetworkPredictor(profile_->GetPrefs(), |
| 253 io_thread, | 253 io_thread, |
| 254 main_request_context_getter_.get(), | 254 main_request_context_getter_.get(), |
| 255 io_data_); | 255 io_data_); |
| 256 | 256 |
| 257 content::NotificationService::current()->Notify( | 257 content::NotificationService::current()->Notify( |
| 258 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, | 258 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, |
| 259 content::Source<Profile>(profile_), | 259 content::Source<Profile>(profile_), |
| 260 content::NotificationService::NoDetails()); | 260 content::NotificationService::NoDetails()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 const base::Closure& completion) { | 804 const base::Closure& completion) { |
| 805 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 805 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 806 DCHECK(initialized()); | 806 DCHECK(initialized()); |
| 807 | 807 |
| 808 DCHECK(transport_security_state()); | 808 DCHECK(transport_security_state()); |
| 809 // Completes synchronously. | 809 // Completes synchronously. |
| 810 transport_security_state()->DeleteAllDynamicDataSince(time); | 810 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 811 DCHECK(http_server_properties_manager_); | 811 DCHECK(http_server_properties_manager_); |
| 812 http_server_properties_manager_->Clear(completion); | 812 http_server_properties_manager_->Clear(completion); |
| 813 } | 813 } |
| OLD | NEW |