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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 2133083002: Remove all remaining traces of MessageLoopProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 io_data_->predictor_.reset(predictor); 180 io_data_->predictor_.reset(predictor);
181 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor); 181 io_data_->domain_reliability_monitor_ = std::move(domain_reliability_monitor);
182 182
183 io_data_->InitializeMetricsEnabledStateOnUIThread(); 183 io_data_->InitializeMetricsEnabledStateOnUIThread();
184 if (io_data_->domain_reliability_monitor_) 184 if (io_data_->domain_reliability_monitor_)
185 io_data_->domain_reliability_monitor_->MoveToNetworkThread(); 185 io_data_->domain_reliability_monitor_->MoveToNetworkThread();
186 186
187 io_data_->set_data_reduction_proxy_io_data( 187 io_data_->set_data_reduction_proxy_io_data(
188 CreateDataReductionProxyChromeIOData( 188 CreateDataReductionProxyChromeIOData(
189 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(), 189 g_browser_process->io_thread()->net_log(), profile_->GetPrefs(),
190 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 190 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
191 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); 191 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
192 192
193 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 193 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
194 scoped_refptr<base::SequencedTaskRunner> db_task_runner = 194 scoped_refptr<base::SequencedTaskRunner> db_task_runner =
195 pool->GetSequencedTaskRunnerWithShutdownBehavior( 195 pool->GetSequencedTaskRunnerWithShutdownBehavior(
196 pool->GetSequenceToken(), 196 pool->GetSequenceToken(),
197 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); 197 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
198 std::unique_ptr<data_reduction_proxy::DataStore> store( 198 std::unique_ptr<data_reduction_proxy::DataStore> store(
199 new data_reduction_proxy::DataStoreImpl(profile_path)); 199 new data_reduction_proxy::DataStoreImpl(profile_path));
200 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_) 200 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_)
201 ->InitDataReductionProxySettings( 201 ->InitDataReductionProxySettings(
202 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(), 202 io_data_->data_reduction_proxy_io_data(), profile_->GetPrefs(),
203 profile_->GetRequestContext(), std::move(store), 203 profile_->GetRequestContext(), std::move(store),
204 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 204 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
205 db_task_runner); 205 db_task_runner);
206 } 206 }
207 207
208 content::ResourceContext* 208 content::ResourceContext*
209 ProfileImplIOData::Handle::GetResourceContext() const { 209 ProfileImplIOData::Handle::GetResourceContext() const {
210 DCHECK_CURRENTLY_ON(BrowserThread::UI); 210 DCHECK_CURRENTLY_ON(BrowserThread::UI);
211 LazyInitialize(); 211 LazyInitialize();
212 return GetResourceContextNoInit(); 212 return GetResourceContextNoInit();
213 } 213 }
214 214
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 PrefService* pref_service = profile_->GetPrefs(); 363 PrefService* pref_service = profile_->GetPrefs();
364 io_data_->http_server_properties_manager_ = 364 io_data_->http_server_properties_manager_ =
365 chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager( 365 chrome_browser_net::HttpServerPropertiesManagerFactory::CreateManager(
366 pref_service); 366 pref_service);
367 io_data_->set_http_server_properties( 367 io_data_->set_http_server_properties(
368 std::unique_ptr<net::HttpServerProperties>( 368 std::unique_ptr<net::HttpServerProperties>(
369 io_data_->http_server_properties_manager_)); 369 io_data_->http_server_properties_manager_));
370 io_data_->session_startup_pref()->Init( 370 io_data_->session_startup_pref()->Init(
371 prefs::kRestoreOnStartup, pref_service); 371 prefs::kRestoreOnStartup, pref_service);
372 io_data_->session_startup_pref()->MoveToThread( 372 io_data_->session_startup_pref()->MoveToThread(
373 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 373 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
374 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled, 374 io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
375 pref_service); 375 pref_service);
376 io_data_->safe_browsing_enabled()->MoveToThread( 376 io_data_->safe_browsing_enabled()->MoveToThread(
377 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 377 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO));
378 io_data_->InitializeOnUIThread(profile_); 378 io_data_->InitializeOnUIThread(profile_);
379 } 379 }
380 380
381 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector> 381 std::unique_ptr<ProfileIOData::ChromeURLRequestContextGetterVector>
382 ProfileImplIOData::Handle::GetAllContextGetters() { 382 ProfileImplIOData::Handle::GetAllContextGetters() {
383 ChromeURLRequestContextGetterMap::iterator iter; 383 ChromeURLRequestContextGetterMap::iterator iter;
384 std::unique_ptr<ChromeURLRequestContextGetterVector> context_getters( 384 std::unique_ptr<ChromeURLRequestContextGetterVector> context_getters(
385 new ChromeURLRequestContextGetterVector()); 385 new ChromeURLRequestContextGetterVector());
386 386
387 iter = isolated_media_request_context_getter_map_.begin(); 387 iter = isolated_media_request_context_getter_map_.begin();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 513 }
514 514
515 set_channel_id_service(channel_id_service); 515 set_channel_id_service(channel_id_service);
516 main_context->set_channel_id_service(channel_id_service); 516 main_context->set_channel_id_service(channel_id_service);
517 main_cookie_store_->SetChannelIDServiceID(channel_id_service->GetUniqueID()); 517 main_cookie_store_->SetChannelIDServiceID(channel_id_service->GetUniqueID());
518 518
519 std::unique_ptr<net::HttpCache::BackendFactory> main_backend( 519 std::unique_ptr<net::HttpCache::BackendFactory> main_backend(
520 new net::HttpCache::DefaultBackend( 520 new net::HttpCache::DefaultBackend(
521 net::DISK_CACHE, ChooseCacheBackendType(), lazy_params_->cache_path, 521 net::DISK_CACHE, ChooseCacheBackendType(), lazy_params_->cache_path,
522 lazy_params_->cache_max_size, 522 lazy_params_->cache_max_size,
523 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 523 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)));
524 http_network_session_ = CreateHttpNetworkSession(*profile_params); 524 http_network_session_ = CreateHttpNetworkSession(*profile_params);
525 main_http_factory_ = CreateMainHttpFactory(http_network_session_.get(), 525 main_http_factory_ = CreateMainHttpFactory(http_network_session_.get(),
526 std::move(main_backend)); 526 std::move(main_backend));
527 main_context->set_http_transaction_factory(main_http_factory_.get()); 527 main_context->set_http_transaction_factory(main_http_factory_.get());
528 528
529 #if !defined(DISABLE_FTP_SUPPORT) 529 #if !defined(DISABLE_FTP_SUPPORT)
530 ftp_factory_.reset( 530 ftp_factory_.reset(
531 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 531 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
532 #endif // !defined(DISABLE_FTP_SUPPORT) 532 #endif // !defined(DISABLE_FTP_SUPPORT)
533 533
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 partition_descriptor.path.Append(chrome::kChannelIDFilename); 628 partition_descriptor.path.Append(chrome::kChannelIDFilename);
629 base::FilePath cache_path = 629 base::FilePath cache_path =
630 partition_descriptor.path.Append(chrome::kCacheDirname); 630 partition_descriptor.path.Append(chrome::kCacheDirname);
631 631
632 // Use a separate HTTP disk cache for isolated apps. 632 // Use a separate HTTP disk cache for isolated apps.
633 std::unique_ptr<net::HttpCache::BackendFactory> app_backend; 633 std::unique_ptr<net::HttpCache::BackendFactory> app_backend;
634 if (partition_descriptor.in_memory) { 634 if (partition_descriptor.in_memory) {
635 app_backend = net::HttpCache::DefaultBackend::InMemory(0); 635 app_backend = net::HttpCache::DefaultBackend::InMemory(0);
636 } else { 636 } else {
637 app_backend.reset(new net::HttpCache::DefaultBackend( 637 app_backend.reset(new net::HttpCache::DefaultBackend(
638 net::DISK_CACHE, 638 net::DISK_CACHE, ChooseCacheBackendType(), cache_path,
639 ChooseCacheBackendType(),
640 cache_path,
641 app_cache_max_size_, 639 app_cache_max_size_,
642 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 640 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)));
643 } 641 }
644 642
645 std::unique_ptr<net::CookieStore> cookie_store; 643 std::unique_ptr<net::CookieStore> cookie_store;
646 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db; 644 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db;
647 if (partition_descriptor.in_memory) { 645 if (partition_descriptor.in_memory) {
648 cookie_store = content::CreateCookieStore(content::CookieStoreConfig()); 646 cookie_store = content::CreateCookieStore(content::CookieStoreConfig());
649 } else { 647 } else {
650 // Use an app-specific cookie store. 648 // Use an app-specific cookie store.
651 DCHECK(!cookie_path.empty()); 649 DCHECK(!cookie_path.empty());
652 650
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 cache_max_size = lazy_params_->media_cache_max_size; 727 cache_max_size = lazy_params_->media_cache_max_size;
730 } else { 728 } else {
731 cache_path = partition_descriptor.path.Append(chrome::kMediaCacheDirname); 729 cache_path = partition_descriptor.path.Append(chrome::kMediaCacheDirname);
732 } 730 }
733 731
734 // Use a separate HTTP disk cache for isolated apps. 732 // Use a separate HTTP disk cache for isolated apps.
735 std::unique_ptr<net::HttpCache::BackendFactory> media_backend( 733 std::unique_ptr<net::HttpCache::BackendFactory> media_backend(
736 new net::HttpCache::DefaultBackend( 734 new net::HttpCache::DefaultBackend(
737 net::MEDIA_CACHE, ChooseCacheBackendType(), cache_path, 735 net::MEDIA_CACHE, ChooseCacheBackendType(), cache_path,
738 cache_max_size, 736 cache_max_size,
739 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 737 BrowserThread::GetTaskRunnerForThread(BrowserThread::CACHE)));
740 std::unique_ptr<net::HttpCache> media_http_cache = 738 std::unique_ptr<net::HttpCache> media_http_cache =
741 CreateHttpFactory(http_network_session_.get(), std::move(media_backend)); 739 CreateHttpFactory(http_network_session_.get(), std::move(media_backend));
742 740
743 // Transfer ownership of the cache to MediaRequestContext. 741 // Transfer ownership of the cache to MediaRequestContext.
744 context->SetHttpTransactionFactory(std::move(media_http_cache)); 742 context->SetHttpTransactionFactory(std::move(media_http_cache));
745 743
746 // Note that we do not create a new URLRequestJobFactory because 744 // Note that we do not create a new URLRequestJobFactory because
747 // the media context should behave exactly like its parent context 745 // the media context should behave exactly like its parent context
748 // in all respects except for cache behavior on media subresources. 746 // in all respects except for cache behavior on media subresources.
749 // The CopyFrom() step above means that our media context will use 747 // The CopyFrom() step above means that our media context will use
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 const base::Closure& completion) { 792 const base::Closure& completion) {
795 DCHECK_CURRENTLY_ON(BrowserThread::IO); 793 DCHECK_CURRENTLY_ON(BrowserThread::IO);
796 DCHECK(initialized()); 794 DCHECK(initialized());
797 795
798 DCHECK(transport_security_state()); 796 DCHECK(transport_security_state());
799 // Completes synchronously. 797 // Completes synchronously.
800 transport_security_state()->DeleteAllDynamicDataSince(time); 798 transport_security_state()->DeleteAllDynamicDataSince(time);
801 DCHECK(http_server_properties_manager_); 799 DCHECK(http_server_properties_manager_);
802 http_server_properties_manager_->Clear(completion); 800 http_server_properties_manager_->Clear(completion);
803 } 801 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698