mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-12 10:40:39 +09:00
Kernel: Move Singleton class to AK
This commit is contained in:
parent
0e69ebbce4
commit
f0906250a1
Notes:
sideshowbarker
2024-07-19 03:19:57 +09:00
Author: https://github.com/tomuta
Commit: f0906250a1
Pull-request: https://github.com/SerenityOS/serenity/pull/3248
31 changed files with 87 additions and 71 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/Time.h>
|
||||
#include <Kernel/Devices/RandomDevice.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
|
@ -33,7 +34,6 @@
|
|||
#include <Kernel/Net/TCPSocket.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/Singleton.h>
|
||||
|
||||
//#define TCP_SOCKET_DEBUG
|
||||
|
||||
|
@ -63,19 +63,18 @@ void TCPSocket::set_state(State new_state)
|
|||
}
|
||||
}
|
||||
|
||||
static auto s_socket_closing = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>>();
|
||||
|
||||
Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>& TCPSocket::closing_sockets()
|
||||
{
|
||||
static Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>* s_map;
|
||||
if (!s_map)
|
||||
s_map = new Lockable<HashMap<IPv4SocketTuple, RefPtr<TCPSocket>>>;
|
||||
return *s_map;
|
||||
return *s_socket_closing;
|
||||
}
|
||||
|
||||
static auto s_map = make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
|
||||
static auto s_socket_tuples = AK::make_singleton<Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>>();
|
||||
|
||||
Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
|
||||
{
|
||||
return *s_map;
|
||||
return *s_socket_tuples;
|
||||
}
|
||||
|
||||
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue