diff --git prefs_tab_helper.cc prefs_tab_helper.cc index 1eb1268..aa4b840 100644 --- prefs_tab_helper.cc +++ prefs_tab_helper.cc @@ -7,7 +7,7 @@ #include #include -#include "base/memory/singleton.h" +#include "base/lazy_instance.h" #include "base/prefs/overlay_user_pref_store.h" #include "base/prefs/pref_change_registrar.h" #include "base/prefs/pref_service.h" @@ -415,12 +415,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { GetInstance()->GetServiceForBrowserContext(profile, true)); } - static PrefWatcherFactory* GetInstance() { - return base::Singleton::get(); - } + static PrefWatcherFactory* GetInstance(); private: - friend struct base::DefaultSingletonTraits; + friend struct base::DefaultLazyInstanceTraits; PrefWatcherFactory() : BrowserContextKeyedServiceFactory( "PrefWatcher", @@ -441,6 +439,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { } }; +namespace { + +base::LazyInstance::Leaky g_pref_watcher_factory = + LAZY_INSTANCE_INITIALIZER; + +} // namespace + +// static +PrefWatcherFactory* PrefWatcherFactory::GetInstance() { + return g_pref_watcher_factory.Pointer(); +} + // static PrefWatcher* PrefWatcher::Get(Profile* profile) { return PrefWatcherFactory::GetForProfile(profile);