From fee46a89f493080db0838e2314b4400faeec94f3 Mon Sep 17 00:00:00 2001 From: "satish@chromium.org" Date: Thu, 9 Dec 2010 16:42:15 +0000 Subject: 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. 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 --- .../browser/policy/configuration_policy_pref_store.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'chrome/browser/policy') 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 + 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::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::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::get(); - return new ConfigurationPolicyPrefStore(keeper->recommended_provider()); + return new ConfigurationPolicyPrefStore( + g_configuration_policy_provider_keeper.Get().recommended_provider()); } // static -- cgit v1.1