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

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: Fix LoginUtilsTest 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // detector starts to monitor changes from the update engine. 315 // detector starts to monitor changes from the update engine.
316 UpgradeDetectorChromeos::GetInstance()->Init(); 316 UpgradeDetectorChromeos::GetInstance()->Init();
317 317
318 if (base::chromeos::IsRunningOnChromeOS()) { 318 if (base::chromeos::IsRunningOnChromeOS()) {
319 // Disable Num Lock on X start up for http://crosbug.com/29169. 319 // Disable Num Lock on X start up for http://crosbug.com/29169.
320 input_method::GetInputMethodManager()->GetXKeyboard()-> 320 input_method::GetInputMethodManager()->GetXKeyboard()->
321 SetNumLockEnabled(false); 321 SetNumLockEnabled(false);
322 } 322 }
323 323
324 // Initialize the device settings service so that we'll take actions per 324 // Initialize the device settings service so that we'll take actions per
325 // signals sent from the session manager. 325 // signals sent from the session manager. This needs to happen before
326 DeviceSettingsService::Get()->Initialize( 326 // g_browser_process initializes local_state().
327 DeviceSettingsService::Initialize();
328 DeviceSettingsService::Get()->InitializeSessionManager(
327 DBusThreadManager::Get()->GetSessionManagerClient(), 329 DBusThreadManager::Get()->GetSessionManagerClient(),
328 OwnerKeyUtil::Create()); 330 OwnerKeyUtil::Create());
329 chromeos::ConnectivityStateHelper::Initialize(); 331 chromeos::ConnectivityStateHelper::Initialize();
330 } 332 }
331 333
332 ~DBusServices() { 334 ~DBusServices() {
333 chromeos::ConnectivityStateHelper::Shutdown(); 335 chromeos::ConnectivityStateHelper::Shutdown();
334 // CrosLibrary is shut down before DBusThreadManager even though it 336 // CrosLibrary is shut down before DBusThreadManager even though it
335 // is initialized first becuase some of its libraries depend on DBus 337 // is initialized first becuase some of its libraries depend on DBus
336 // clients. 338 // clients.
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 if (CrosNetworkChangeNotifierFactory::GetInstance()) 724 if (CrosNetworkChangeNotifierFactory::GetInstance())
723 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown(); 725 CrosNetworkChangeNotifierFactory::GetInstance()->Shutdown();
724 if (NetworkChangeNotifierFactoryChromeos::GetInstance()) 726 if (NetworkChangeNotifierFactoryChromeos::GetInstance())
725 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown(); 727 NetworkChangeNotifierFactoryChromeos::GetInstance()->Shutdown();
726 728
727 if (NetworkPortalDetector::IsEnabled() && 729 if (NetworkPortalDetector::IsEnabled() &&
728 NetworkPortalDetector::GetInstance()) { 730 NetworkPortalDetector::GetInstance()) {
729 NetworkPortalDetector::GetInstance()->Shutdown(); 731 NetworkPortalDetector::GetInstance()->Shutdown();
730 } 732 }
731 733
732 // Tell DeviceSettingsService to stop talking to session_manager. 734 // Tell DeviceSettingsService to stop talking to session_manager. Do not
733 DeviceSettingsService::Get()->Shutdown(); 735 // shutdown DeviceSettingsService yet, it is still accessed by
736 // g_browser_process.
Mattias Nissler (ping if slow) 2013/04/16 16:09:51 How would g_browser_process access DeviceSettingsS
stevenjb 2013/04/16 16:49:43 The relationship is through BrowserPolicyConnector
737 DeviceSettingsService::Get()->ShutdownSessionManager();
734 738
735 // We should remove observers attached to D-Bus clients before 739 // We should remove observers attached to D-Bus clients before
736 // DBusThreadManager is shut down. 740 // DBusThreadManager is shut down.
737 screen_lock_observer_.reset(); 741 screen_lock_observer_.reset();
738 suspend_observer_.reset(); 742 suspend_observer_.reset();
739 resume_observer_.reset(); 743 resume_observer_.reset();
740 brightness_observer_.reset(); 744 brightness_observer_.reset();
741 retail_mode_power_save_blocker_.reset(); 745 retail_mode_power_save_blocker_.reset();
742 746
743 // The XInput2 event listener needs to be shut down earlier than when 747 // The XInput2 event listener needs to be shut down earlier than when
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 // Let the AutomaticRebootManager unregister itself as an observer of several 780 // Let the AutomaticRebootManager unregister itself as an observer of several
777 // subsystems. 781 // subsystems.
778 automatic_reboot_manager_.reset(); 782 automatic_reboot_manager_.reset();
779 783
780 // Clean up dependency on CrosSettings and stop pending data fetches. 784 // Clean up dependency on CrosSettings and stop pending data fetches.
781 KioskAppManager::Shutdown(); 785 KioskAppManager::Shutdown();
782 786
783 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); 787 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun();
784 } 788 }
785 789
790 void ChromeBrowserMainPartsChromeos::PostDestroyThreads() {
791 ChromeBrowserMainPartsLinux::PostDestroyThreads();
792 // Destroy DeviceSettingsService after g_browser_process.
Mattias Nissler (ping if slow) 2013/04/16 16:09:51 Isn't the actual dependency CrosSettings here?
stevenjb 2013/04/16 16:49:43 Same as above, also modified comment.
793 DeviceSettingsService::Shutdown();
794 }
795
786 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() { 796 void ChromeBrowserMainPartsChromeos::SetupPlatformFieldTrials() {
787 SetupLowMemoryHeadroomFieldTrial(); 797 SetupLowMemoryHeadroomFieldTrial();
788 SetupZramFieldTrial(); 798 SetupZramFieldTrial();
789 } 799 }
790 800
791 void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() { 801 void ChromeBrowserMainPartsChromeos::SetupLowMemoryHeadroomFieldTrial() {
792 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 802 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
793 // Only enable this experiment on Canary and Dev, since it's possible 803 // Only enable this experiment on Canary and Dev, since it's possible
794 // that this will make the machine unstable. 804 // that this will make the machine unstable.
795 // Note that to have this code execute in a developer build, 805 // Note that to have this code execute in a developer build,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0); 883 trial->AppendGroup("4GB_RAM_4GB_swap", zram_group == '4' ? 1 : 0);
874 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0); 884 trial->AppendGroup("4GB_RAM_6GB_swap", zram_group == '5' ? 1 : 0);
875 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0); 885 trial->AppendGroup("snow_no_swap", zram_group == '6' ? 1 : 0);
876 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0); 886 trial->AppendGroup("snow_1GB_swap", zram_group == '7' ? 1 : 0);
877 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0); 887 trial->AppendGroup("snow_2GB_swap", zram_group == '8' ? 1 : 0);
878 // This is necessary to start the experiment as a side effect. 888 // This is necessary to start the experiment as a side effect.
879 trial->group(); 889 trial->group();
880 } 890 }
881 891
882 } // namespace chromeos 892 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698