Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3007)

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2475143002: Defer DRP start up until after the context getter is created (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 0ef95436f2099fc191372e468a08daedd2a573af..63a2cbd13bf18b36a4c7a2c689536c72222b215d 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -186,46 +186,32 @@ void ProfileImplIOData::Handle::Init(
io_data_->app_cache_max_size_ = cache_max_size;
io_data_->app_media_cache_max_size_ = media_cache_max_size;
io_data_->predictor_.reset(predictor);
io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor);
io_data_->InitializeMetricsEnabledStateOnUIThread();
if (io_data_->domain_reliability_monitor_)
io_data_->domain_reliability_monitor_->MoveToNetworkThread();
- io_data_->set_data_reduction_proxy_io_data(
- CreateDataReductionProxyChromeIOData(
- g_browser_process->io_thread()->net_log(), profile_->GetPrefs(),
- BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
- BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
-
- base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
- scoped_refptr<base::SequencedTaskRunner> db_task_runner =
- pool->GetSequencedTaskRunnerWithShutdownBehavior(
- pool->GetSequenceToken(),
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
- std::unique_ptr<data_reduction_proxy::DataStore> store(
- new data_reduction_proxy::DataStoreImpl(profile_path));
- DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)
- ->InitDataReductionProxySettings(
- io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(),
- profile_->GetRequestContext(), std::move(store),
- BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
- db_task_runner);
-
io_data_->previews_io_data_ = base::MakeUnique<previews::PreviewsIOData>(
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
PreviewsServiceFactory::GetForProfile(profile_)->Initialize(
io_data_->previews_io_data_.get(),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), profile_path);
+
+ io_data_->set_data_reduction_proxy_io_data(
+ CreateDataReductionProxyChromeIOData(
+ g_browser_process->io_thread()->net_log(), profile_->GetPrefs(),
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
+ 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
}
content::ResourceContext*
ProfileImplIOData::Handle::GetResourceContext() const {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
LazyInitialize();
return GetResourceContextNoInit();
}
content::ResourceContext*
@@ -241,20 +227,34 @@ scoped_refptr<ChromeURLRequestContextGetter>
ProfileImplIOData::Handle::CreateMainRequestContextGetter(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors,
IOThread* io_thread) const {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
LazyInitialize();
DCHECK(!main_request_context_getter_.get());
main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
profile_, io_data_, protocol_handlers, std::move(request_interceptors));
+ base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
+ scoped_refptr<base::SequencedTaskRunner> db_task_runner =
+ pool->GetSequencedTaskRunnerWithShutdownBehavior(
+ pool->GetSequenceToken(),
+ base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
+ std::unique_ptr<data_reduction_proxy::DataStore> store(
+ new data_reduction_proxy::DataStoreImpl(io_data_->profile_path_));
+ DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)
+ ->InitDataReductionProxySettings(
+ io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(),
+ main_request_context_getter_.get(), std::move(store),
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
+ 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
+
io_data_->predictor_
->InitNetworkPredictor(profile_->GetPrefs(),
io_thread,
main_request_context_getter_.get(),
io_data_);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
content::Source<Profile>(profile_),
content::NotificationService::NoDetails());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698