cef/patch/patches/prefs_tab_helper_1680.patch

49 lines
1.4 KiB
Diff

diff --git prefs_tab_helper.cc prefs_tab_helper.cc
index e20d4e5c..d350a14 100644
--- prefs_tab_helper.cc
+++ prefs_tab_helper.cc
@@ -11,8 +11,8 @@
#include <string>
#include "base/command_line.h"
+#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/memory/singleton.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -429,12 +429,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory {
GetInstance()->GetServiceForBrowserContext(profile, true));
}
- static PrefWatcherFactory* GetInstance() {
- return base::Singleton<PrefWatcherFactory>::get();
- }
+ static PrefWatcherFactory* GetInstance();
private:
- friend struct base::DefaultSingletonTraits<PrefWatcherFactory>;
+ friend struct base::DefaultLazyInstanceTraits<PrefWatcherFactory>;
PrefWatcherFactory() : BrowserContextKeyedServiceFactory(
"PrefWatcher",
@@ -455,6 +453,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory {
}
};
+namespace {
+
+base::LazyInstance<PrefWatcherFactory>::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);