1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 12:55:07 +00:00

Everywhere: Replace AK::Singleton => Singleton

This commit is contained in:
Andreas Kling 2021-08-07 21:34:11 +02:00
parent eb60cb156d
commit c94c15d45c
35 changed files with 40 additions and 40 deletions

View file

@ -24,7 +24,7 @@ struct FlyStringImplTraits : public Traits<StringImpl*> {
} }
}; };
static AK::Singleton<HashTable<StringImpl*, FlyStringImplTraits>> s_table; static Singleton<HashTable<StringImpl*, FlyStringImplTraits>> s_table;
static HashTable<StringImpl*, FlyStringImplTraits>& fly_impls() static HashTable<StringImpl*, FlyStringImplTraits>& fly_impls()
{ {

View file

@ -14,7 +14,7 @@
// Output bytes to kernel debug port 0xE9 (Bochs console). It's very handy. // Output bytes to kernel debug port 0xE9 (Bochs console). It's very handy.
#define CONSOLE_OUT_TO_BOCHS_DEBUG_PORT #define CONSOLE_OUT_TO_BOCHS_DEBUG_PORT
static AK::Singleton<ConsoleDevice> s_the; static Singleton<ConsoleDevice> s_the;
static Kernel::SpinLock g_console_lock; static Kernel::SpinLock g_console_lock;
UNMAP_AFTER_INIT void ConsoleDevice::initialize() UNMAP_AFTER_INIT void ConsoleDevice::initialize()

View file

@ -10,7 +10,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<HashMap<u32, Device*>> s_all_devices; static Singleton<HashMap<u32, Device*>> s_all_devices;
HashMap<u32, Device*>& Device::all_devices() HashMap<u32, Device*>& Device::all_devices()
{ {

View file

@ -14,7 +14,7 @@
namespace Kernel { namespace Kernel {
Atomic<bool> g_caps_lock_remapped_to_ctrl; Atomic<bool> g_caps_lock_remapped_to_ctrl;
static AK::Singleton<HIDManagement> s_the; static Singleton<HIDManagement> s_the;
// clang-format off // clang-format off
static constexpr Keyboard::CharacterMapData DEFAULT_CHARACTER_MAP = static constexpr Keyboard::CharacterMapData DEFAULT_CHARACTER_MAP =

View file

@ -10,7 +10,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<NullDevice> s_the; static Singleton<NullDevice> s_the;
UNMAP_AFTER_INIT void NullDevice::initialize() UNMAP_AFTER_INIT void NullDevice::initialize()
{ {

View file

@ -58,7 +58,7 @@ void SB16::set_sample_rate(uint16_t hz)
dsp_write((u8)hz); dsp_write((u8)hz);
} }
static AK::Singleton<SB16> s_the; static Singleton<SB16> s_the;
UNMAP_AFTER_INIT SB16::SB16() UNMAP_AFTER_INIT SB16::SB16()
: IRQHandler(SB16_DEFAULT_IRQ) : IRQHandler(SB16_DEFAULT_IRQ)

View file

@ -86,7 +86,7 @@ private:
OwnPtr<VMWareBackdoor> m_backdoor; OwnPtr<VMWareBackdoor> m_backdoor;
}; };
static AK::Singleton<VMWareBackdoorDetector> s_vmware_backdoor; static Singleton<VMWareBackdoorDetector> s_vmware_backdoor;
VMWareBackdoor* VMWareBackdoor::the() VMWareBackdoor* VMWareBackdoor::the()
{ {

View file

@ -25,7 +25,7 @@ DevPtsFS::~DevPtsFS()
{ {
} }
static AK::Singleton<HashTable<unsigned>> s_ptys; static Singleton<HashTable<unsigned>> s_ptys;
bool DevPtsFS::initialize() bool DevPtsFS::initialize()
{ {

View file

@ -17,7 +17,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ProtectedValue<HashTable<FIFO*>>> s_table; static Singleton<ProtectedValue<HashTable<FIFO*>>> s_table;
static ProtectedValue<HashTable<FIFO*>>& all_fifos() static ProtectedValue<HashTable<FIFO*>>& all_fifos()
{ {

View file

@ -16,7 +16,7 @@
namespace Kernel { namespace Kernel {
static u32 s_lastFileSystemID; static u32 s_lastFileSystemID;
static AK::Singleton<HashMap<u32, FileSystem*>> s_file_system_map; static Singleton<HashMap<u32, FileSystem*>> s_file_system_map;
static HashMap<u32, FileSystem*>& all_file_systems() static HashMap<u32, FileSystem*>& all_file_systems()
{ {

View file

@ -23,7 +23,7 @@
namespace Kernel { namespace Kernel {
static SpinLock s_all_inodes_lock; static SpinLock s_all_inodes_lock;
static AK::Singleton<Inode::List> s_list; static Singleton<Inode::List> s_list;
static Inode::List& all_with_lock() static Inode::List& all_with_lock()
{ {

View file

@ -18,7 +18,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ProcFSComponentRegistry> s_the; static Singleton<ProcFSComponentRegistry> s_the;
ProcFSComponentRegistry& ProcFSComponentRegistry::the() ProcFSComponentRegistry& ProcFSComponentRegistry::the()
{ {

View file

@ -11,7 +11,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<SysFSComponentRegistry> s_the; static Singleton<SysFSComponentRegistry> s_the;
SysFSComponentRegistry& SysFSComponentRegistry::the() SysFSComponentRegistry& SysFSComponentRegistry::the()
{ {

View file

@ -21,7 +21,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<VirtualFileSystem> s_the; static Singleton<VirtualFileSystem> s_the;
static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase? static constexpr int symlink_recursion_limit { 5 }; // FIXME: increase?
static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY; static constexpr int root_mount_flags = MS_NODEV | MS_NOSUID | MS_RDONLY;

View file

@ -19,7 +19,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<GraphicsManagement> s_the; static Singleton<GraphicsManagement> s_the;
GraphicsManagement& GraphicsManagement::the() GraphicsManagement& GraphicsManagement::the()
{ {

View file

@ -54,7 +54,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<APIC> s_apic; static Singleton<APIC> s_apic;
class APICIPIInterruptHandler final : public GenericInterruptHandler { class APICIPIInterruptHandler final : public GenericInterruptHandler {
public: public:

View file

@ -42,9 +42,9 @@ __attribute__((section(".super_pages"))) static u8 super_pages[1 * MiB];
namespace Kernel::Memory { namespace Kernel::Memory {
// NOTE: We can NOT use AK::Singleton for this class, because // NOTE: We can NOT use Singleton for this class, because
// MemoryManager::initialize is called *before* global constructors are // MemoryManager::initialize is called *before* global constructors are
// run. If we do, then AK::Singleton would get re-initialized, causing // run. If we do, then Singleton would get re-initialized, causing
// the memory manager to be initialized twice! // the memory manager to be initialized twice!
static MemoryManager* s_the; static MemoryManager* s_the;
RecursiveSpinLock s_mm_lock; RecursiveSpinLock s_mm_lock;

View file

@ -17,7 +17,7 @@ extern u8 end_of_kernel_image[];
namespace Kernel::Memory { namespace Kernel::Memory {
static AK::Singleton<HashMap<FlatPtr, PageDirectory*>> s_cr3_map; static Singleton<HashMap<FlatPtr, PageDirectory*>> s_cr3_map;
static HashMap<FlatPtr, PageDirectory*>& cr3_map() static HashMap<FlatPtr, PageDirectory*>& cr3_map()
{ {

View file

@ -26,7 +26,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ProtectedValue<HashTable<IPv4Socket*>>> s_table; static Singleton<ProtectedValue<HashTable<IPv4Socket*>>> s_table;
using BlockFlags = Thread::FileDescriptionBlocker::BlockFlags; using BlockFlags = Thread::FileDescriptionBlocker::BlockFlags;

View file

@ -19,7 +19,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ProtectedValue<LocalSocket::List>> s_list; static Singleton<ProtectedValue<LocalSocket::List>> s_list;
static ProtectedValue<LocalSocket::List>& all_sockets() static ProtectedValue<LocalSocket::List>& all_sockets()
{ {

View file

@ -20,7 +20,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<NetworkingManagement> s_the; static Singleton<NetworkingManagement> s_the;
NetworkingManagement& NetworkingManagement::the() NetworkingManagement& NetworkingManagement::the()
{ {

View file

@ -16,7 +16,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ProtectedValue<HashMap<IPv4Address, MACAddress>>> s_arp_table; static Singleton<ProtectedValue<HashMap<IPv4Address, MACAddress>>> s_arp_table;
class ARPTableBlocker : public Thread::Blocker { class ARPTableBlocker : public Thread::Blocker {
public: public:
@ -80,7 +80,7 @@ protected:
} }
}; };
static AK::Singleton<ARPTableBlockCondition> s_arp_table_block_condition; static Singleton<ARPTableBlockCondition> s_arp_table_block_condition;
ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional<MACAddress>& addr) ARPTableBlocker::ARPTableBlocker(IPv4Address ip_addr, Optional<MACAddress>& addr)
: m_ip_addr(ip_addr) : m_ip_addr(ip_addr)

View file

@ -54,14 +54,14 @@ void TCPSocket::set_state(State new_state)
evaluate_block_conditions(); evaluate_block_conditions();
} }
static AK::Singleton<ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>> s_socket_closing; static Singleton<ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>> s_socket_closing;
ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets() ProtectedValue<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
{ {
return *s_socket_closing; return *s_socket_closing;
} }
static AK::Singleton<ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>> s_socket_tuples; static Singleton<ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>> s_socket_tuples;
ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple() ProtectedValue<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
{ {
@ -512,7 +512,7 @@ KResult TCPSocket::close()
return result; return result;
} }
static AK::Singleton<ProtectedValue<HashTable<TCPSocket*>>> s_sockets_for_retransmit; static Singleton<ProtectedValue<HashTable<TCPSocket*>>> s_sockets_for_retransmit;
ProtectedValue<HashTable<TCPSocket*>>& TCPSocket::sockets_for_retransmit() ProtectedValue<HashTable<TCPSocket*>>& TCPSocket::sockets_for_retransmit()
{ {

View file

@ -22,7 +22,7 @@ void UDPSocket::for_each(Function<void(const UDPSocket&)> callback)
}); });
} }
static AK::Singleton<ProtectedValue<HashMap<u16, UDPSocket*>>> s_map; static Singleton<ProtectedValue<HashMap<u16, UDPSocket*>>> s_map;
ProtectedValue<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port() ProtectedValue<HashMap<u16, UDPSocket*>>& UDPSocket::sockets_by_port()
{ {

View file

@ -45,11 +45,11 @@ static void create_signal_trampoline();
RecursiveSpinLock g_profiling_lock; RecursiveSpinLock g_profiling_lock;
static Atomic<pid_t> next_pid; static Atomic<pid_t> next_pid;
static AK::Singleton<ProtectedValue<Process::List>> s_processes; static Singleton<ProtectedValue<Process::List>> s_processes;
READONLY_AFTER_INIT HashMap<String, OwnPtr<Module>>* g_modules; READONLY_AFTER_INIT HashMap<String, OwnPtr<Module>>* g_modules;
READONLY_AFTER_INIT Memory::Region* g_signal_trampoline_region; READONLY_AFTER_INIT Memory::Region* g_signal_trampoline_region;
static AK::Singleton<ProtectedValue<String>> s_hostname; static Singleton<ProtectedValue<String>> s_hostname;
ProtectedValue<String>& hostname() ProtectedValue<String>& hostname()
{ {

View file

@ -10,7 +10,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<SpinLockProtectedValue<ProcessGroup::List>> s_process_groups; static Singleton<SpinLockProtectedValue<ProcessGroup::List>> s_process_groups;
SpinLockProtectedValue<ProcessGroup::List>& process_groups() SpinLockProtectedValue<ProcessGroup::List>& process_groups()
{ {

View file

@ -16,7 +16,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<KernelRng> s_the; static Singleton<KernelRng> s_the;
static Atomic<u32, AK::MemoryOrder::memory_order_relaxed> s_next_random_value = 1; static Atomic<u32, AK::MemoryOrder::memory_order_relaxed> s_next_random_value = 1;
KernelRng& KernelRng::the() KernelRng& KernelRng::the()

View file

@ -12,7 +12,7 @@
namespace Kernel { namespace Kernel {
static SpinLock<u8> g_global_futex_lock; static SpinLock<u8> g_global_futex_lock;
static AK::Singleton<HashMap<Memory::VMObject*, FutexQueues>> g_global_futex_queues; static Singleton<HashMap<Memory::VMObject*, FutexQueues>> g_global_futex_queues;
FutexQueue::FutexQueue(FlatPtr user_address_or_offset, Memory::VMObject* vmobject) FutexQueue::FutexQueue(FlatPtr user_address_or_offset, Memory::VMObject* vmobject)
: m_user_address_or_offset(user_address_or_offset) : m_user_address_or_offset(user_address_or_offset)

View file

@ -14,7 +14,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<ConsoleManagement> s_the; static Singleton<ConsoleManagement> s_the;
void ConsoleManagement::resolution_was_changed() void ConsoleManagement::resolution_was_changed()
{ {

View file

@ -14,7 +14,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<PTYMultiplexer> s_the; static Singleton<PTYMultiplexer> s_the;
PTYMultiplexer& PTYMultiplexer::the() PTYMultiplexer& PTYMultiplexer::the()
{ {

View file

@ -25,7 +25,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<TimeManagement> s_the; static Singleton<TimeManagement> s_the;
TimeManagement& TimeManagement::the() TimeManagement& TimeManagement::the()
{ {

View file

@ -13,7 +13,7 @@
namespace Kernel { namespace Kernel {
static AK::Singleton<TimerQueue> s_the; static Singleton<TimerQueue> s_the;
static SpinLock<u8> g_timerqueue_lock; static SpinLock<u8> g_timerqueue_lock;
Time Timer::remaining() const Time Timer::remaining() const

View file

@ -109,7 +109,7 @@ struct SignalHandlersInfo {
int next_signal_id { 0 }; int next_signal_id { 0 };
}; };
static AK::Singleton<SignalHandlersInfo> s_signals; static Singleton<SignalHandlersInfo> s_signals;
template<bool create_if_null = true> template<bool create_if_null = true>
inline SignalHandlersInfo* signals_info() inline SignalHandlersInfo* signals_info()
{ {

View file

@ -67,7 +67,7 @@ public:
static DefaultRootCACertificates& the() { return s_the; } static DefaultRootCACertificates& the() { return s_the; }
private: private:
static AK::Singleton<DefaultRootCACertificates> s_the; static Singleton<DefaultRootCACertificates> s_the;
Vector<Certificate> m_ca_certificates; Vector<Certificate> m_ca_certificates;
}; };

View file

@ -344,7 +344,7 @@ bool TLSv12::add_client_key(ReadonlyBytes certificate_pem_buffer, ReadonlyBytes
return add_client_key(certificate); return add_client_key(certificate);
} }
AK::Singleton<DefaultRootCACertificates> DefaultRootCACertificates::s_the; Singleton<DefaultRootCACertificates> DefaultRootCACertificates::s_the;
DefaultRootCACertificates::DefaultRootCACertificates() DefaultRootCACertificates::DefaultRootCACertificates()
{ {
// FIXME: This might not be the best format, find a better way to represent CA certificates. // FIXME: This might not be the best format, find a better way to represent CA certificates.