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

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 local_state() (which instantiates
Mattias Nissler (ping if slow) 2013/04/17 13:10:30 nit: g_browser_process also instantiates BrowserPo
stevenjb 2013/04/17 16:27:12 Done.
331 // BrowserPolicyConnector).
332 DeviceSettingsService::Initialize();
333 DeviceSettingsService::Get()->SetSessionManager(
331 DBusThreadManager::Get()->GetSessionManagerClient(), 334 DBusThreadManager::Get()->GetSessionManagerClient(),
332 OwnerKeyUtil::Create()); 335 OwnerKeyUtil::Create());
333 chromeos::ConnectivityStateHelper::Initialize(); 336 chromeos::ConnectivityStateHelper::Initialize();
334 } 337 }
335 338
336 ~DBusServices() { 339 ~DBusServices() {
337 chromeos::ConnectivityStateHelper::Shutdown(); 340 chromeos::ConnectivityStateHelper::Shutdown();
338 // CrosLibrary is shut down before DBusThreadManager even though it 341 // CrosLibrary is shut down before DBusThreadManager even though it
339 // is initialized first becuase some of its libraries depend on DBus 342 // is initialized first becuase some of its libraries depend on DBus
340 // clients. 343 // clients.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 // the network manager. 734 // the network manager.
732 if (CrosNetworkChangeNotifierFactory::GetInstance()) 735 if (CrosNetworkChangeNotifierFactory::GetInstance())
733 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); 736 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
734 if (NetworkChangeNotifierFactoryChromeos::GetInstance()) 737 if (NetworkChangeNotifierFactoryChromeos::GetInstance())
735 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown(); 738 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown();
736 739
737 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance(); 740 NetworkPortalDetector* detector = NetworkPortalDetector::GetInstance();
738 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector) 741 if (NetworkPortalDetector::IsEnabledInCommandLine() && detector)
739 detector->Shutdown(); 742 detector->Shutdown();
740 743
741 // Tell DeviceSettingsService to stop talking to session_manager. 744 // Tell DeviceSettingsService to stop talking to session_manager. Do not
742 DeviceSettingsService::Get()->Shutdown(); 745 // shutdown DeviceSettingsService yet, it might still be accessed by
746 // BrowserPolicyConnector (owned by g_browser_process).
747 DeviceSettingsService::Get()->UnsetSessionManager();
743 748
744 // We should remove observers attached to D-Bus clients before 749 // We should remove observers attached to D-Bus clients before
745 // DBusThreadManager is shut down. 750 // DBusThreadManager is shut down.
746 screen_lock_observer_.reset(); 751 screen_lock_observer_.reset();
747 suspend_observer_.reset(); 752 suspend_observer_.reset();
748 resume_observer_.reset(); 753 resume_observer_.reset();
749 brightness_observer_.reset(); 754 brightness_observer_.reset();
750 retail_mode_power_save_blocker_.reset(); 755 retail_mode_power_save_blocker_.reset();
751 peripheral_battery_observer_.reset(); 756 peripheral_battery_observer_.reset();
752 757
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 // Let the AutomaticRebootManager unregister itself as an observer of several 791 // Let the AutomaticRebootManager unregister itself as an observer of several
787 // subsystems. 792 // subsystems.
788 automatic_reboot_manager_.reset(); 793 automatic_reboot_manager_.reset();
789 794
790 // Clean up dependency on CrosSettings and stop pending data fetches. 795 // Clean up dependency on CrosSettings and stop pending data fetches.
791 KioskAppManager::Shutdown(); 796 KioskAppManager::Shutdown();
792 797
793 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); 798 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun();
794 } 799 }
795 800
801 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() {
802 ChromeBrowserMainPartsLinux::PostDestroyThreads();
803 // Destroy DeviceSettingsService after g_browser_process.
804 DeviceSettingsService::Shutdown();
805 }
806
796 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 807 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
797 SetupZramFieldTrial(); 808 SetupZramFieldTrial();
798 } 809 }
799 810
800 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() { 811 void ChromeBrowserMainPartsChromeos::SetupZramFieldTrial() {
801 // The dice for this experiment have been thrown at boot. The selected group 812 // The dice for this experiment have been thrown at boot. The selected group
802 // number is stored in a file. 813 // number is stored in a file.
803 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled"); 814 const base::FilePath kZramGroupPath("/home/chronos/.swap_exp_enrolled");
804 std::string zram_file_content; 815 std::string zram_file_content;
805 // If the file does not exist, the experiment has not started. 816 // 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); 846 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0);
836 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); 847 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0);
837 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); 848 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0);
838 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); 849 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0);
839 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); 850 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0);
840 // This is necessary to start the experiment as a side effect. 851 // This is necessary to start the experiment as a side effect.
841 trial->group(); 852 trial->group();
842 } 853 }
843 854
844 } // namespace chromeos 855 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698