Index: chrome/browser/browser_process_impl.cc |
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc |
index fca71f7f0bc86826087b5b26a0982e32d90d305e..7334e710ca10c5dba8d962dc81a5e4c351d4e15c 100644 |
--- a/chrome/browser/browser_process_impl.cc |
+++ b/chrome/browser/browser_process_impl.cc |
@@ -278,6 +278,7 @@ BrowserProcessImpl::BrowserProcessImpl( |
} |
BrowserProcessImpl::~BrowserProcessImpl() { |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if BUILDFLAG(ENABLE_EXTENSIONS) |
extensions::ExtensionsBrowserClient::Set(nullptr); |
#endif |
@@ -542,7 +543,7 @@ void BrowserProcessImpl::EndSession() { |
metrics_services_manager::MetricsServicesManager* |
BrowserProcessImpl::GetMetricsServicesManager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!metrics_services_manager_) { |
metrics_services_manager_.reset( |
new metrics_services_manager::MetricsServicesManager( |
@@ -553,28 +554,28 @@ BrowserProcessImpl::GetMetricsServicesManager() { |
} |
metrics::MetricsService* BrowserProcessImpl::metrics_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return GetMetricsServicesManager()->GetMetricsService(); |
} |
rappor::RapporServiceImpl* BrowserProcessImpl::rappor_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return GetMetricsServicesManager()->GetRapporServiceImpl(); |
} |
ukm::UkmRecorder* BrowserProcessImpl::ukm_recorder() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return GetMetricsServicesManager()->GetUkmService(); |
} |
IOThread* BrowserProcessImpl::io_thread() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
DCHECK(io_thread_.get()); |
return io_thread_.get(); |
} |
WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_watchdog_thread_) |
CreateWatchdogThread(); |
DCHECK(watchdog_thread_.get() != NULL); |
@@ -582,26 +583,26 @@ WatchDogThread* BrowserProcessImpl::watchdog_thread() { |
} |
ProfileManager* BrowserProcessImpl::profile_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_profile_manager_) |
CreateProfileManager(); |
return profile_manager_.get(); |
} |
PrefService* BrowserProcessImpl::local_state() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_local_state_) |
CreateLocalState(); |
return local_state_.get(); |
} |
net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return io_thread()->system_url_request_context_getter(); |
} |
variations::VariationsService* BrowserProcessImpl::variations_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return GetMetricsServicesManager()->GetVariationsService(); |
} |
@@ -619,7 +620,7 @@ BrowserProcessImpl::extension_event_router_forwarder() { |
} |
NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
// TODO(miguelg) return NULL for MAC as well once native notifications |
// are enabled by default. |
#if defined(OS_ANDROID) |
@@ -642,12 +643,12 @@ NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() { |
} |
message_center::MessageCenter* BrowserProcessImpl::message_center() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return message_center::MessageCenter::Get(); |
} |
policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_browser_policy_connector_) { |
DCHECK(!browser_policy_connector_); |
browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); |
@@ -661,21 +662,21 @@ policy::PolicyService* BrowserProcessImpl::policy_service() { |
} |
IconManager* BrowserProcessImpl::icon_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_icon_manager_) |
CreateIconManager(); |
return icon_manager_.get(); |
} |
GpuProfileCache* BrowserProcessImpl::gpu_profile_cache() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!gpu_profile_cache_.get()) |
gpu_profile_cache_.reset(GpuProfileCache::Create()); |
return gpu_profile_cache_.get(); |
} |
GpuModeManager* BrowserProcessImpl::gpu_mode_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!gpu_mode_manager_.get()) |
gpu_mode_manager_.reset(new GpuModeManager()); |
return gpu_mode_manager_.get(); |
@@ -684,7 +685,7 @@ GpuModeManager* BrowserProcessImpl::gpu_mode_manager() { |
void BrowserProcessImpl::CreateDevToolsHttpProtocolHandler( |
const std::string& ip, |
uint16_t port) { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if !defined(OS_ANDROID) |
// StartupBrowserCreator::LaunchBrowser can be run multiple times when browser |
// is started with several profiles or existing browser process is reused. |
@@ -695,7 +696,7 @@ void BrowserProcessImpl::CreateDevToolsHttpProtocolHandler( |
} |
void BrowserProcessImpl::CreateDevToolsAutoOpener() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if !defined(OS_ANDROID) |
// StartupBrowserCreator::LaunchBrowser can be run multiple times when browser |
// is started with several profiles or existing browser process is reused. |
@@ -705,21 +706,21 @@ void BrowserProcessImpl::CreateDevToolsAutoOpener() { |
} |
bool BrowserProcessImpl::IsShuttingDown() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
// TODO(crbug.com/560486): Fix the tests that make the check of |
// |tearing_down_| necessary here. |
return shutting_down_ || tearing_down_; |
} |
printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
return print_job_manager_.get(); |
} |
printing::PrintPreviewDialogController* |
BrowserProcessImpl::print_preview_dialog_controller() { |
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!print_preview_dialog_controller_.get()) |
CreatePrintPreviewDialogController(); |
return print_preview_dialog_controller_.get(); |
@@ -732,7 +733,7 @@ printing::PrintPreviewDialogController* |
printing::BackgroundPrintingManager* |
BrowserProcessImpl::background_printing_manager() { |
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!background_printing_manager_.get()) |
CreateBackgroundPrintingManager(); |
return background_printing_manager_.get(); |
@@ -743,7 +744,7 @@ printing::BackgroundPrintingManager* |
} |
IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!intranet_redirect_detector_.get()) |
CreateIntranetRedirectDetector(); |
return intranet_redirect_detector_.get(); |
@@ -801,14 +802,14 @@ network_time::NetworkTimeTracker* BrowserProcessImpl::network_time_tracker() { |
} |
gcm::GCMDriver* BrowserProcessImpl::gcm_driver() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!gcm_driver_) |
CreateGCMDriver(); |
return gcm_driver_.get(); |
} |
memory::TabManager* BrowserProcessImpl::GetTabManager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
if (!tab_manager_.get()) |
tab_manager_.reset(new memory::TabManager()); |
@@ -825,7 +826,7 @@ BrowserProcessImpl::CachedDefaultWebClientState() { |
physical_web::PhysicalWebDataSource* |
BrowserProcessImpl::GetPhysicalWebDataSource() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if defined(OS_ANDROID) |
if (!physical_web_data_source_) { |
CreatePhysicalWebDataSource(); |
@@ -875,14 +876,14 @@ void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
} |
DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!download_request_limiter_.get()) |
download_request_limiter_ = new DownloadRequestLimiter(); |
return download_request_limiter_.get(); |
} |
BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
#if BUILDFLAG(ENABLE_BACKGROUND) |
if (!background_mode_manager_.get()) |
CreateBackgroundModeManager(); |
@@ -901,7 +902,7 @@ void BrowserProcessImpl::set_background_mode_manager_for_test( |
} |
StatusTray* BrowserProcessImpl::status_tray() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!status_tray_.get()) |
CreateStatusTray(); |
return status_tray_.get(); |
@@ -909,7 +910,7 @@ StatusTray* BrowserProcessImpl::status_tray() { |
safe_browsing::SafeBrowsingService* |
BrowserProcessImpl::safe_browsing_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_safe_browsing_service_) |
CreateSafeBrowsingService(); |
return safe_browsing_service_.get(); |
@@ -917,7 +918,7 @@ BrowserProcessImpl::safe_browsing_service() { |
safe_browsing::ClientSideDetectionService* |
BrowserProcessImpl::safe_browsing_detection_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (safe_browsing_service()) |
return safe_browsing_service()->safe_browsing_detection_service(); |
return NULL; |
@@ -925,7 +926,7 @@ safe_browsing::ClientSideDetectionService* |
subresource_filter::ContentRulesetService* |
BrowserProcessImpl::subresource_filter_ruleset_service() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
if (!created_subresource_filter_ruleset_service_) |
CreateSubresourceFilterRulesetService(); |
return subresource_filter_ruleset_service_.get(); |
@@ -1321,7 +1322,7 @@ void BrowserProcessImpl::CacheDefaultWebClientState() { |
} |
void BrowserProcessImpl::Pin() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
// CHECK(!IsShuttingDown()); |
if (IsShuttingDown()) { |
@@ -1333,7 +1334,7 @@ void BrowserProcessImpl::Pin() { |
} |
void BrowserProcessImpl::Unpin() { |
- DCHECK(CalledOnValidThread()); |
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
release_last_reference_callstack_ = base::debug::StackTrace(); |
shutting_down_ = true; |