refactor: prefer using base::NoDestructor to base::{Singleton,LazyInstance} (#41400)

refactor: prefer using base::NoDestructor to base::{Singleton,LazyInstance}
This commit is contained in:
Shelley Vohr 2024-02-23 10:35:20 +01:00 committed by GitHub
parent 26131b23b8
commit e95673b052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 44 additions and 18 deletions

View file

@ -4,6 +4,7 @@
#include "shell/browser/extensions/electron_extension_system_factory.h"
#include "base/no_destructor.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_prefs_factory.h"
#include "extensions/browser/extension_registry_factory.h"
@ -21,7 +22,8 @@ ExtensionSystem* ElectronExtensionSystemFactory::GetForBrowserContext(
// static
ElectronExtensionSystemFactory* ElectronExtensionSystemFactory::GetInstance() {
return base::Singleton<ElectronExtensionSystemFactory>::get();
static base::NoDestructor<ElectronExtensionSystemFactory> instance;
return instance.get();
}
ElectronExtensionSystemFactory::ElectronExtensionSystemFactory()