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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 14200028: Make CrosSettings and DeviceSettingsService non Lazy instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // detector starts to monitor changes from the update engine. 319 // detector starts to monitor changes from the update engine.
320 UpgradeDetectorChromeos::GetInstance()->Init(); 320 UpgradeDetectorChromeos::GetInstance()->Init();
321 321
322 if (base::chromeos::IsRunningOnChromeOS()) { 322 if (base::chromeos::IsRunningOnChromeOS()) {
323 // Disable Num Lock on X start up for http://crosbug.com/29169. 323 // Disable Num Lock on X start up for http://crosbug.com/29169.
324 input_method::GetInputMethodManager()->GetXKeyboard()-> 324 input_method::GetInputMethodManager()->GetXKeyboard()->
325 SetNumLockEnabled(false); 325 SetNumLockEnabled(false);
326 } 326 }
327 327
328 // Initialize the device settings service so that we'll take actions per 328 // Initialize the device settings service so that we'll take actions per
329 // signals sent from the session manager. 329 // signals sent from the session manager. This needs to happen before
330 DeviceSettingsService::Get()->Initialize( 330 // g_browser_process initializes BrowserPolicyConnector.
331 DeviceSettingsService::Initialize();
332 DeviceSettingsService::Get()->SetSessionManager(
331 DBusThreadManager::Get()->GetSessionManagerClient(), 333 DBusThreadManager::Get()->GetSessionManagerClient(),
332 OwnerKeyUtil::Create()); 334 OwnerKeyUtil::Create());
333 chromeos::ConnectivityStateHelper::Initialize(); 335 chromeos::ConnectivityStateHelper::Initialize();
334 } 336 }
335 337
336 ~DBusServices() { 338 ~DBusServices() {
337 chromeos::ConnectivityStateHelper::Shutdown(); 339 chromeos::ConnectivityStateHelper::Shutdown();
338 // CrosLibrary is shut down before DBusThreadManager even though it 340 // CrosLibrary is shut down before DBusThreadManager even though it
339 // is initialized first becuase some of its libraries depend on DBus 341 // is initialized first becuase some of its libraries depend on DBus
340 // clients. 342 // clients.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // the network manager. 733 // the network manager.
732 if (CrosNetworkChangeNotifierFactory::GetInstance()) 734 if (CrosNetworkChangeNotifierFactory::GetInstance())
733 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); 735 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
734 if (NetworkChangeNotifierFactoryChromeos::GetInstance()) 736 if (NetworkChangeNotifierFactoryChromeos::GetInstance())
735 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown(); 737 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown();
736 738
737 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); 739 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance();
738 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) 740 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector)
739 detector->Shutdown(); 741 detector->Shutdown();
740 742
741 // Tell DeviceSettingsService to stop talking to session_manager. 743 // Tell DeviceSettingsService to stop talking to session_manager. Do not
742 DeviceSettingsService::Get()->Shutdown(); 744 // shutdown DeviceSettingsService yet, it might still be accessed by
745 // BrowserPolicyConnector (owned by g_browser_process).
746 DeviceSettingsService::Get()->UnsetSessionManager();
743 747
744 // We should remove observers attached to D-Bus clients before 748 // We should remove observers attached to D-Bus clients before
745 // DBusThreadManager is shut down. 749 // DBusThreadManager is shut down.
746 screen_lock_observer_.reset(); 750 screen_lock_observer_.reset();
747 suspend_observer_.reset(); 751 suspend_observer_.reset();
748 resume_observer_.reset(); 752 resume_observer_.reset();
749 brightness_observer_.reset(); 753 brightness_observer_.reset();
750 retail_mode_power_save_blocker_.reset(); 754 retail_mode_power_save_blocker_.reset();
751 peripheral_battery_observer_.reset(); 755 peripheral_battery_observer_.reset();
752 756
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 // Let the AutomaticRebootManager unregister itself as an observer of several 790 // Let the AutomaticRebootManager unregister itself as an observer of several
787 // subsystems. 791 // subsystems.
788 automatic_reboot_manager_.reset(); 792 automatic_reboot_manager_.reset();
789 793
790 // Clean up dependency on CrosSettings and stop pending data fetches. 794 // Clean up dependency on CrosSettings and stop pending data fetches.
791 KioskAppManager::Shutdown(); 795 KioskAppManager::Shutdown();
792 796
793 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); 797 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun();
794 } 798 }
795 799
800 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() {
801 ChromeBrowserMainPartsLinux::PostDestroyThreads();
802 // Destroy DeviceSettingsService after g_browser_process.
803 DeviceSettingsService::Shutdown();
804 }
805
796 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 806 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
797 SetupZramFieldTrial(); 807 SetupZramFieldTrial();
798 } 808 }
799 809
800 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { 810 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() {
801 // The dice for this experiment have been thrown at boot. The selected group 811 // The dice for this experiment have been thrown at boot. The selected group
802 // number is stored in a file. 812 // number is stored in a file.
803 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); 813 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled");
804 std::string zram_file_content; 814 std::string zram_file_content;
805 // If the file does not exist, the experiment has not started. 815 // If the file does not exist, the experiment has not started.
(...skipping 29 matching lines...) Expand all
835 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); 845 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0);
836 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); 846 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0);
837 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); 847 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0);
838 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); 848 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0);
839 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); 849 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0);
840 // This is necessary to start the experiment as a side effect. 850 // This is necessary to start the experiment as a side effect.
841 trial->group(); 851 trial->group();
842 } 852 }
843 853
844 } // namespace chromeos 854 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.h ('k') | chrome/browser/chromeos/drive/drive_system_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698