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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 2911983003: Replace deprecated base::NonThreadSafe in chrome in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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
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/browser_process_impl.h" 5 #include "chrome/browser/browser_process_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 update_client::UpdateQueryParams::SetDelegate( 272 update_client::UpdateQueryParams::SetDelegate(
273 ChromeUpdateQueryParamsDelegate::GetInstance()); 273 ChromeUpdateQueryParamsDelegate::GetInstance());
274 274
275 #if !defined(OS_ANDROID) 275 #if !defined(OS_ANDROID)
276 KeepAliveRegistry::GetInstance()->AddObserver(this); 276 KeepAliveRegistry::GetInstance()->AddObserver(this);
277 #endif // !defined(OS_ANDROID) 277 #endif // !defined(OS_ANDROID)
278 } 278 }
279 279
280 BrowserProcessImpl::~BrowserProcessImpl() { 280 BrowserProcessImpl::~BrowserProcessImpl() {
281 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
281 #if BUILDFLAG(ENABLE_EXTENSIONS) 282 #if BUILDFLAG(ENABLE_EXTENSIONS)
282 extensions::ExtensionsBrowserClient::Set(nullptr); 283 extensions::ExtensionsBrowserClient::Set(nullptr);
283 #endif 284 #endif
284 285
285 #if !defined(OS_ANDROID) 286 #if !defined(OS_ANDROID)
286 KeepAliveRegistry::GetInstance()->RemoveObserver(this); 287 KeepAliveRegistry::GetInstance()->RemoveObserver(this);
287 #endif // !defined(OS_ANDROID) 288 #endif // !defined(OS_ANDROID)
288 289
289 tracked_objects::ThreadData::EnsureCleanupWasCalled(4); 290 tracked_objects::ThreadData::EnsureCleanupWasCalled(4);
290 291
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 for (auto& profile_writer_runner : profile_writer_runners) 536 for (auto& profile_writer_runner : profile_writer_runners)
536 profile_write_rundown_counter->Post(profile_writer_runner.get()); 537 profile_write_rundown_counter->Post(profile_writer_runner.get());
537 profile_write_rundown_counter->TimedWaitUntil(end_time); 538 profile_write_rundown_counter->TimedWaitUntil(end_time);
538 #else 539 #else
539 NOTIMPLEMENTED(); 540 NOTIMPLEMENTED();
540 #endif 541 #endif
541 } 542 }
542 543
543 metrics_services_manager::MetricsServicesManager* 544 metrics_services_manager::MetricsServicesManager*
544 BrowserProcessImpl::GetMetricsServicesManager() { 545 BrowserProcessImpl::GetMetricsServicesManager() {
545 DCHECK(CalledOnValidThread()); 546 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
546 if (!metrics_services_manager_) { 547 if (!metrics_services_manager_) {
547 metrics_services_manager_.reset( 548 metrics_services_manager_.reset(
548 new metrics_services_manager::MetricsServicesManager( 549 new metrics_services_manager::MetricsServicesManager(
549 base::MakeUnique<ChromeMetricsServicesManagerClient>( 550 base::MakeUnique<ChromeMetricsServicesManagerClient>(
550 local_state()))); 551 local_state())));
551 } 552 }
552 return metrics_services_manager_.get(); 553 return metrics_services_manager_.get();
553 } 554 }
554 555
555 metrics::MetricsService* BrowserProcessImpl::metrics_service() { 556 metrics::MetricsService* BrowserProcessImpl::metrics_service() {
556 DCHECK(CalledOnValidThread()); 557 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
557 return GetMetricsServicesManager()->GetMetricsService(); 558 return GetMetricsServicesManager()->GetMetricsService();
558 } 559 }
559 560
560 rappor::RapporServiceImpl* BrowserProcessImpl::rappor_service() { 561 rappor::RapporServiceImpl* BrowserProcessImpl::rappor_service() {
561 DCHECK(CalledOnValidThread()); 562 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
562 return GetMetricsServicesManager()->GetRapporServiceImpl(); 563 return GetMetricsServicesManager()->GetRapporServiceImpl();
563 } 564 }
564 565
565 ukm::UkmRecorder* BrowserProcessImpl::ukm_recorder() { 566 ukm::UkmRecorder* BrowserProcessImpl::ukm_recorder() {
566 DCHECK(CalledOnValidThread()); 567 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
567 return GetMetricsServicesManager()->GetUkmService(); 568 return GetMetricsServicesManager()->GetUkmService();
568 } 569 }
569 570
570 IOThread* BrowserProcessImpl::io_thread() { 571 IOThread* BrowserProcessImpl::io_thread() {
571 DCHECK(CalledOnValidThread()); 572 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
572 DCHECK(io_thread_.get()); 573 DCHECK(io_thread_.get());
573 return io_thread_.get(); 574 return io_thread_.get();
574 } 575 }
575 576
576 WatchDogThread* BrowserProcessImpl::watchdog_thread() { 577 WatchDogThread* BrowserProcessImpl::watchdog_thread() {
577 DCHECK(CalledOnValidThread()); 578 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
578 if (!created_watchdog_thread_) 579 if (!created_watchdog_thread_)
579 CreateWatchdogThread(); 580 CreateWatchdogThread();
580 DCHECK(watchdog_thread_.get() != NULL); 581 DCHECK(watchdog_thread_.get() != NULL);
581 return watchdog_thread_.get(); 582 return watchdog_thread_.get();
582 } 583 }
583 584
584 ProfileManager* BrowserProcessImpl::profile_manager() { 585 ProfileManager* BrowserProcessImpl::profile_manager() {
585 DCHECK(CalledOnValidThread()); 586 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
586 if (!created_profile_manager_) 587 if (!created_profile_manager_)
587 CreateProfileManager(); 588 CreateProfileManager();
588 return profile_manager_.get(); 589 return profile_manager_.get();
589 } 590 }
590 591
591 PrefService* BrowserProcessImpl::local_state() { 592 PrefService* BrowserProcessImpl::local_state() {
592 DCHECK(CalledOnValidThread()); 593 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
593 if (!created_local_state_) 594 if (!created_local_state_)
594 CreateLocalState(); 595 CreateLocalState();
595 return local_state_.get(); 596 return local_state_.get();
596 } 597 }
597 598
598 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() { 599 net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() {
599 DCHECK(CalledOnValidThread()); 600 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
600 return io_thread()->system_url_request_context_getter(); 601 return io_thread()->system_url_request_context_getter();
601 } 602 }
602 603
603 variations::VariationsService* BrowserProcessImpl::variations_service() { 604 variations::VariationsService* BrowserProcessImpl::variations_service() {
604 DCHECK(CalledOnValidThread()); 605 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
605 return GetMetricsServicesManager()->GetVariationsService(); 606 return GetMetricsServicesManager()->GetVariationsService();
606 } 607 }
607 608
608 BrowserProcessPlatformPart* BrowserProcessImpl::platform_part() { 609 BrowserProcessPlatformPart* BrowserProcessImpl::platform_part() {
609 return platform_part_.get(); 610 return platform_part_.get();
610 } 611 }
611 612
612 extensions::EventRouterForwarder* 613 extensions::EventRouterForwarder*
613 BrowserProcessImpl::extension_event_router_forwarder() { 614 BrowserProcessImpl::extension_event_router_forwarder() {
614 #if BUILDFLAG(ENABLE_EXTENSIONS) 615 #if BUILDFLAG(ENABLE_EXTENSIONS)
615 return extension_event_router_forwarder_.get(); 616 return extension_event_router_forwarder_.get();
616 #else 617 #else
617 return NULL; 618 return NULL;
618 #endif 619 #endif
619 } 620 }
620 621
621 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() { 622 NotificationUIManager* BrowserProcessImpl::notification_ui_manager() {
622 DCHECK(CalledOnValidThread()); 623 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
623 // TODO(miguelg) return NULL for MAC as well once native notifications 624 // TODO(miguelg) return NULL for MAC as well once native notifications
624 // are enabled by default. 625 // are enabled by default.
625 #if defined(OS_ANDROID) 626 #if defined(OS_ANDROID)
626 return nullptr; 627 return nullptr;
627 #else 628 #else
628 if (!created_notification_ui_manager_) 629 if (!created_notification_ui_manager_)
629 CreateNotificationUIManager(); 630 CreateNotificationUIManager();
630 return notification_ui_manager_.get(); 631 return notification_ui_manager_.get();
631 #endif 632 #endif
632 } 633 }
633 634
634 NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() { 635 NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() {
635 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) 636 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
636 if (!created_notification_bridge_) 637 if (!created_notification_bridge_)
637 CreateNotificationPlatformBridge(); 638 CreateNotificationPlatformBridge();
638 return notification_bridge_.get(); 639 return notification_bridge_.get();
639 #else 640 #else
640 return nullptr; 641 return nullptr;
641 #endif 642 #endif
642 } 643 }
643 644
644 message_center::MessageCenter* BrowserProcessImpl::message_center() { 645 message_center::MessageCenter* BrowserProcessImpl::message_center() {
645 DCHECK(CalledOnValidThread()); 646 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
646 return message_center::MessageCenter::Get(); 647 return message_center::MessageCenter::Get();
647 } 648 }
648 649
649 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() { 650 policy::BrowserPolicyConnector* BrowserProcessImpl::browser_policy_connector() {
650 DCHECK(CalledOnValidThread()); 651 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
651 if (!created_browser_policy_connector_) { 652 if (!created_browser_policy_connector_) {
652 DCHECK(!browser_policy_connector_); 653 DCHECK(!browser_policy_connector_);
653 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector(); 654 browser_policy_connector_ = platform_part_->CreateBrowserPolicyConnector();
654 created_browser_policy_connector_ = true; 655 created_browser_policy_connector_ = true;
655 } 656 }
656 return browser_policy_connector_.get(); 657 return browser_policy_connector_.get();
657 } 658 }
658 659
659 policy::PolicyService* BrowserProcessImpl::policy_service() { 660 policy::PolicyService* BrowserProcessImpl::policy_service() {
660 return browser_policy_connector()->GetPolicyService(); 661 return browser_policy_connector()->GetPolicyService();
661 } 662 }
662 663
663 IconManager* BrowserProcessImpl::icon_manager() { 664 IconManager* BrowserProcessImpl::icon_manager() {
664 DCHECK(CalledOnValidThread()); 665 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
665 if (!created_icon_manager_) 666 if (!created_icon_manager_)
666 CreateIconManager(); 667 CreateIconManager();
667 return icon_manager_.get(); 668 return icon_manager_.get();
668 } 669 }
669 670
670 GpuProfileCache* BrowserProcessImpl::gpu_profile_cache() { 671 GpuProfileCache* BrowserProcessImpl::gpu_profile_cache() {
671 DCHECK(CalledOnValidThread()); 672 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
672 if (!gpu_profile_cache_.get()) 673 if (!gpu_profile_cache_.get())
673 gpu_profile_cache_.reset(GpuProfileCache::Create()); 674 gpu_profile_cache_.reset(GpuProfileCache::Create());
674 return gpu_profile_cache_.get(); 675 return gpu_profile_cache_.get();
675 } 676 }
676 677
677 GpuModeManager* BrowserProcessImpl::gpu_mode_manager() { 678 GpuModeManager* BrowserProcessImpl::gpu_mode_manager() {
678 DCHECK(CalledOnValidThread()); 679 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
679 if (!gpu_mode_manager_.get()) 680 if (!gpu_mode_manager_.get())
680 gpu_mode_manager_.reset(new GpuModeManager()); 681 gpu_mode_manager_.reset(new GpuModeManager());
681 return gpu_mode_manager_.get(); 682 return gpu_mode_manager_.get();
682 } 683 }
683 684
684 void BrowserProcessImpl::CreateDevToolsHttpProtocolHandler( 685 void BrowserProcessImpl::CreateDevToolsHttpProtocolHandler(
685 const std::string& ip, 686 const std::string& ip,
686 uint16_t port) { 687 uint16_t port) {
687 DCHECK(CalledOnValidThread()); 688 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
688 #if !defined(OS_ANDROID) 689 #if !defined(OS_ANDROID)
689 // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser 690 // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser
690 // is started with several profiles or existing browser process is reused. 691 // is started with several profiles or existing browser process is reused.
691 if (!remote_debugging_server_.get()) { 692 if (!remote_debugging_server_.get()) {
692 remote_debugging_server_.reset(new RemoteDebuggingServer(ip, port)); 693 remote_debugging_server_.reset(new RemoteDebuggingServer(ip, port));
693 } 694 }
694 #endif 695 #endif
695 } 696 }
696 697
697 void BrowserProcessImpl::CreateDevToolsAutoOpener() { 698 void BrowserProcessImpl::CreateDevToolsAutoOpener() {
698 DCHECK(CalledOnValidThread()); 699 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
699 #if !defined(OS_ANDROID) 700 #if !defined(OS_ANDROID)
700 // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser 701 // StartupBrowserCreator::LaunchBrowser can be run multiple times when browser
701 // is started with several profiles or existing browser process is reused. 702 // is started with several profiles or existing browser process is reused.
702 if (!devtools_auto_opener_.get()) 703 if (!devtools_auto_opener_.get())
703 devtools_auto_opener_.reset(new DevToolsAutoOpener()); 704 devtools_auto_opener_.reset(new DevToolsAutoOpener());
704 #endif 705 #endif
705 } 706 }
706 707
707 bool BrowserProcessImpl::IsShuttingDown() { 708 bool BrowserProcessImpl::IsShuttingDown() {
708 DCHECK(CalledOnValidThread()); 709 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
709 // TODO(crbug.com/560486): Fix the tests that make the check of 710 // TODO(crbug.com/560486): Fix the tests that make the check of
710 // |tearing_down_| necessary here. 711 // |tearing_down_| necessary here.
711 return shutting_down_ || tearing_down_; 712 return shutting_down_ || tearing_down_;
712 } 713 }
713 714
714 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { 715 printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
715 DCHECK(CalledOnValidThread()); 716 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
716 return print_job_manager_.get(); 717 return print_job_manager_.get();
717 } 718 }
718 719
719 printing::PrintPreviewDialogController* 720 printing::PrintPreviewDialogController*
720 BrowserProcessImpl::print_preview_dialog_controller() { 721 BrowserProcessImpl::print_preview_dialog_controller() {
721 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) 722 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
722 DCHECK(CalledOnValidThread()); 723 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
723 if (!print_preview_dialog_controller_.get()) 724 if (!print_preview_dialog_controller_.get())
724 CreatePrintPreviewDialogController(); 725 CreatePrintPreviewDialogController();
725 return print_preview_dialog_controller_.get(); 726 return print_preview_dialog_controller_.get();
726 #else 727 #else
727 NOTIMPLEMENTED(); 728 NOTIMPLEMENTED();
728 return NULL; 729 return NULL;
729 #endif 730 #endif
730 } 731 }
731 732
732 printing::BackgroundPrintingManager* 733 printing::BackgroundPrintingManager*
733 BrowserProcessImpl::background_printing_manager() { 734 BrowserProcessImpl::background_printing_manager() {
734 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) 735 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
735 DCHECK(CalledOnValidThread()); 736 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
736 if (!background_printing_manager_.get()) 737 if (!background_printing_manager_.get())
737 CreateBackgroundPrintingManager(); 738 CreateBackgroundPrintingManager();
738 return background_printing_manager_.get(); 739 return background_printing_manager_.get();
739 #else 740 #else
740 NOTIMPLEMENTED(); 741 NOTIMPLEMENTED();
741 return NULL; 742 return NULL;
742 #endif 743 #endif
743 } 744 }
744 745
745 IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() { 746 IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() {
746 DCHECK(CalledOnValidThread()); 747 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
747 if (!intranet_redirect_detector_.get()) 748 if (!intranet_redirect_detector_.get())
748 CreateIntranetRedirectDetector(); 749 CreateIntranetRedirectDetector();
749 return intranet_redirect_detector_.get(); 750 return intranet_redirect_detector_.get();
750 } 751 }
751 752
752 const std::string& BrowserProcessImpl::GetApplicationLocale() { 753 const std::string& BrowserProcessImpl::GetApplicationLocale() {
753 DCHECK(!locale_.empty()); 754 DCHECK(!locale_.empty());
754 return locale_; 755 return locale_;
755 } 756 }
756 757
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (!network_time_tracker_) { 795 if (!network_time_tracker_) {
795 network_time_tracker_.reset(new network_time::NetworkTimeTracker( 796 network_time_tracker_.reset(new network_time::NetworkTimeTracker(
796 base::WrapUnique(new base::DefaultClock()), 797 base::WrapUnique(new base::DefaultClock()),
797 base::WrapUnique(new base::DefaultTickClock()), local_state(), 798 base::WrapUnique(new base::DefaultTickClock()), local_state(),
798 system_request_context())); 799 system_request_context()));
799 } 800 }
800 return network_time_tracker_.get(); 801 return network_time_tracker_.get();
801 } 802 }
802 803
803 gcm::GCMDriver* BrowserProcessImpl::gcm_driver() { 804 gcm::GCMDriver* BrowserProcessImpl::gcm_driver() {
804 DCHECK(CalledOnValidThread()); 805 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
805 if (!gcm_driver_) 806 if (!gcm_driver_)
806 CreateGCMDriver(); 807 CreateGCMDriver();
807 return gcm_driver_.get(); 808 return gcm_driver_.get();
808 } 809 }
809 810
810 memory::TabManager* BrowserProcessImpl::GetTabManager() { 811 memory::TabManager* BrowserProcessImpl::GetTabManager() {
811 DCHECK(CalledOnValidThread()); 812 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
812 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) 813 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
813 if (!tab_manager_.get()) 814 if (!tab_manager_.get())
814 tab_manager_.reset(new memory::TabManager()); 815 tab_manager_.reset(new memory::TabManager());
815 return tab_manager_.get(); 816 return tab_manager_.get();
816 #else 817 #else
817 return nullptr; 818 return nullptr;
818 #endif 819 #endif
819 } 820 }
820 821
821 shell_integration::DefaultWebClientState 822 shell_integration::DefaultWebClientState
822 BrowserProcessImpl::CachedDefaultWebClientState() { 823 BrowserProcessImpl::CachedDefaultWebClientState() {
823 return cached_default_web_client_state_; 824 return cached_default_web_client_state_;
824 } 825 }
825 826
826 physical_web::PhysicalWebDataSource* 827 physical_web::PhysicalWebDataSource*
827 BrowserProcessImpl::GetPhysicalWebDataSource() { 828 BrowserProcessImpl::GetPhysicalWebDataSource() {
828 DCHECK(CalledOnValidThread()); 829 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
829 #if defined(OS_ANDROID) 830 #if defined(OS_ANDROID)
830 if (!physical_web_data_source_) { 831 if (!physical_web_data_source_) {
831 CreatePhysicalWebDataSource(); 832 CreatePhysicalWebDataSource();
832 DCHECK(physical_web_data_source_); 833 DCHECK(physical_web_data_source_);
833 } 834 }
834 return physical_web_data_source_.get(); 835 return physical_web_data_source_.get();
835 #else 836 #else
836 return nullptr; 837 return nullptr;
837 #endif 838 #endif
838 } 839 }
(...skipping 29 matching lines...) Expand all
868 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled, 869 registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled,
869 GoogleUpdateSettings::GetCollectStatsConsent()); 870 GoogleUpdateSettings::GetCollectStatsConsent());
870 871
871 #if defined(OS_ANDROID) 872 #if defined(OS_ANDROID)
872 registry->RegisterBooleanPref( 873 registry->RegisterBooleanPref(
873 prefs::kCrashReportingEnabled, false); 874 prefs::kCrashReportingEnabled, false);
874 #endif // defined(OS_ANDROID) 875 #endif // defined(OS_ANDROID)
875 } 876 }
876 877
877 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() { 878 DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
878 DCHECK(CalledOnValidThread()); 879 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
879 if (!download_request_limiter_.get()) 880 if (!download_request_limiter_.get())
880 download_request_limiter_ = new DownloadRequestLimiter(); 881 download_request_limiter_ = new DownloadRequestLimiter();
881 return download_request_limiter_.get(); 882 return download_request_limiter_.get();
882 } 883 }
883 884
884 BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { 885 BackgroundModeManager* BrowserProcessImpl::background_mode_manager() {
885 DCHECK(CalledOnValidThread()); 886 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
886 #if BUILDFLAG(ENABLE_BACKGROUND) 887 #if BUILDFLAG(ENABLE_BACKGROUND)
887 if (!background_mode_manager_.get()) 888 if (!background_mode_manager_.get())
888 CreateBackgroundModeManager(); 889 CreateBackgroundModeManager();
889 return background_mode_manager_.get(); 890 return background_mode_manager_.get();
890 #else 891 #else
891 NOTIMPLEMENTED(); 892 NOTIMPLEMENTED();
892 return NULL; 893 return NULL;
893 #endif 894 #endif
894 } 895 }
895 896
896 void BrowserProcessImpl::set_background_mode_manager_for_test( 897 void BrowserProcessImpl::set_background_mode_manager_for_test(
897 std::unique_ptr<BackgroundModeManager> manager) { 898 std::unique_ptr<BackgroundModeManager> manager) {
898 #if BUILDFLAG(ENABLE_BACKGROUND) 899 #if BUILDFLAG(ENABLE_BACKGROUND)
899 background_mode_manager_ = std::move(manager); 900 background_mode_manager_ = std::move(manager);
900 #endif 901 #endif
901 } 902 }
902 903
903 StatusTray* BrowserProcessImpl::status_tray() { 904 StatusTray* BrowserProcessImpl::status_tray() {
904 DCHECK(CalledOnValidThread()); 905 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
905 if (!status_tray_.get()) 906 if (!status_tray_.get())
906 CreateStatusTray(); 907 CreateStatusTray();
907 return status_tray_.get(); 908 return status_tray_.get();
908 } 909 }
909 910
910 safe_browsing::SafeBrowsingService* 911 safe_browsing::SafeBrowsingService*
911 BrowserProcessImpl::safe_browsing_service() { 912 BrowserProcessImpl::safe_browsing_service() {
912 DCHECK(CalledOnValidThread()); 913 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
913 if (!created_safe_browsing_service_) 914 if (!created_safe_browsing_service_)
914 CreateSafeBrowsingService(); 915 CreateSafeBrowsingService();
915 return safe_browsing_service_.get(); 916 return safe_browsing_service_.get();
916 } 917 }
917 918
918 safe_browsing::ClientSideDetectionService* 919 safe_browsing::ClientSideDetectionService*
919 BrowserProcessImpl::safe_browsing_detection_service() { 920 BrowserProcessImpl::safe_browsing_detection_service() {
920 DCHECK(CalledOnValidThread()); 921 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
921 if (safe_browsing_service()) 922 if (safe_browsing_service())
922 return safe_browsing_service()->safe_browsing_detection_service(); 923 return safe_browsing_service()->safe_browsing_detection_service();
923 return NULL; 924 return NULL;
924 } 925 }
925 926
926 subresource_filter::ContentRulesetService* 927 subresource_filter::ContentRulesetService*
927 BrowserProcessImpl::subresource_filter_ruleset_service() { 928 BrowserProcessImpl::subresource_filter_ruleset_service() {
928 DCHECK(CalledOnValidThread()); 929 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
929 if (!created_subresource_filter_ruleset_service_) 930 if (!created_subresource_filter_ruleset_service_)
930 CreateSubresourceFilterRulesetService(); 931 CreateSubresourceFilterRulesetService();
931 return subresource_filter_ruleset_service_.get(); 932 return subresource_filter_ruleset_service_.get();
932 } 933 }
933 934
934 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 935 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
935 void BrowserProcessImpl::StartAutoupdateTimer() { 936 void BrowserProcessImpl::StartAutoupdateTimer() {
936 autoupdate_timer_.Start(FROM_HERE, 937 autoupdate_timer_.Start(FROM_HERE,
937 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), 938 base::TimeDelta::FromHours(kUpdateCheckIntervalHours),
938 this, 939 this,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1315
1315 void BrowserProcessImpl::CacheDefaultWebClientState() { 1316 void BrowserProcessImpl::CacheDefaultWebClientState() {
1316 #if defined(OS_CHROMEOS) 1317 #if defined(OS_CHROMEOS)
1317 cached_default_web_client_state_ = shell_integration::IS_DEFAULT; 1318 cached_default_web_client_state_ = shell_integration::IS_DEFAULT;
1318 #elif !defined(OS_ANDROID) 1319 #elif !defined(OS_ANDROID)
1319 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); 1320 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser();
1320 #endif 1321 #endif
1321 } 1322 }
1322 1323
1323 void BrowserProcessImpl::Pin() { 1324 void BrowserProcessImpl::Pin() {
1324 DCHECK(CalledOnValidThread()); 1325 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
1325 1326
1326 // CHECK(!IsShuttingDown()); 1327 // CHECK(!IsShuttingDown());
1327 if (IsShuttingDown()) { 1328 if (IsShuttingDown()) {
1328 // TODO(crbug.com/113031, crbug.com/625646): Temporary instrumentation. 1329 // TODO(crbug.com/113031, crbug.com/625646): Temporary instrumentation.
1329 base::debug::SetCrashKeyToStackTrace(crash_keys::kBrowserUnpinTrace, 1330 base::debug::SetCrashKeyToStackTrace(crash_keys::kBrowserUnpinTrace,
1330 release_last_reference_callstack_); 1331 release_last_reference_callstack_);
1331 CHECK(false); 1332 CHECK(false);
1332 } 1333 }
1333 } 1334 }
1334 1335
1335 void BrowserProcessImpl::Unpin() { 1336 void BrowserProcessImpl::Unpin() {
1336 DCHECK(CalledOnValidThread()); 1337 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
1337 release_last_reference_callstack_ = base::debug::StackTrace(); 1338 release_last_reference_callstack_ = base::debug::StackTrace();
1338 1339
1339 shutting_down_ = true; 1340 shutting_down_ = true;
1340 #if BUILDFLAG(ENABLE_PRINTING) 1341 #if BUILDFLAG(ENABLE_PRINTING)
1341 // Wait for the pending print jobs to finish. Don't do this later, since 1342 // Wait for the pending print jobs to finish. Don't do this later, since
1342 // this might cause a nested run loop to run, and we don't want pending 1343 // this might cause a nested run loop to run, and we don't want pending
1343 // tasks to run once teardown has started. 1344 // tasks to run once teardown has started.
1344 print_job_manager_->Shutdown(); 1345 print_job_manager_->Shutdown();
1345 #endif 1346 #endif
1346 1347
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 } 1423 }
1423 1424
1424 void BrowserProcessImpl::OnAutoupdateTimer() { 1425 void BrowserProcessImpl::OnAutoupdateTimer() {
1425 if (CanAutorestartForUpdate()) { 1426 if (CanAutorestartForUpdate()) {
1426 DLOG(WARNING) << "Detected update. Restarting browser."; 1427 DLOG(WARNING) << "Detected update. Restarting browser.";
1427 RestartBackgroundInstance(); 1428 RestartBackgroundInstance();
1428 } 1429 }
1429 } 1430 }
1430 1431
1431 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1432 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/browser_process_platform_part_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698