diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 16:42:15 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-09 16:42:15 +0000 |
commit | fee46a89f493080db0838e2314b4400faeec94f3 (patch) | |
tree | 6e857fcf0b6b548b526c45d24879ad6422d50856 /chrome/browser/policy | |
parent | f2d1f61006eac0f8a051fa485b2cffb6b6fa74e0 (diff) | |
download | chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.zip chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.tar.gz chromium_src-fee46a89f493080db0838e2314b4400faeec94f3.tar.bz2 |
This is a continuation of http://codereview.chromium.org/5519016/, adds a new GetInstance() method for remaining files with singleton classes under chrome/browser.
For types declared and used within the same .cc file, I changed them over to LazyInstance<T>.
BUG=65298
TEST=all existing tests should continue to pass.
Review URL: http://codereview.chromium.org/5711001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy')
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 25df2d5..0259ed4 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -5,9 +5,9 @@ #include "chrome/browser/policy/configuration_policy_pref_store.h" #include "base/command_line.h" +#include "base/lazy_instance.h" #include "base/logging.h" #include "base/path_service.h" -#include "base/singleton.h" #include "base/string16.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -68,6 +68,9 @@ class ConfigurationPolicyProviderKeeper { DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderKeeper); }; +static base::LazyInstance<ConfigurationPolicyProviderKeeper> + g_configuration_policy_provider_keeper(base::LINKER_INITIALIZED); + ConfigurationPolicyProvider* ConfigurationPolicyProviderKeeper::CreateManagedPlatformProvider() { const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list = @@ -372,9 +375,8 @@ void ConfigurationPolicyPrefStore::Apply(ConfigurationPolicyType policy, // static ConfigurationPolicyPrefStore* ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore() { - ConfigurationPolicyProviderKeeper* keeper = - Singleton<ConfigurationPolicyProviderKeeper>::get(); - return new ConfigurationPolicyPrefStore(keeper->managed_platform_provider()); + return new ConfigurationPolicyPrefStore( + g_configuration_policy_provider_keeper.Get().managed_platform_provider()); } // static @@ -382,7 +384,7 @@ ConfigurationPolicyPrefStore* ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( Profile* profile) { ConfigurationPolicyProviderKeeper* keeper = - Singleton<ConfigurationPolicyProviderKeeper>::get(); + g_configuration_policy_provider_keeper.Pointer(); ConfigurationPolicyProvider* provider = NULL; if (profile) provider = profile->GetPolicyContext()->GetDeviceManagementPolicyProvider(); @@ -394,9 +396,8 @@ ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore( // static ConfigurationPolicyPrefStore* ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { - ConfigurationPolicyProviderKeeper* keeper = - Singleton<ConfigurationPolicyProviderKeeper>::get(); - return new ConfigurationPolicyPrefStore(keeper->recommended_provider()); + return new ConfigurationPolicyPrefStore( + g_configuration_policy_provider_keeper.Get().recommended_provider()); } // static |