LibCore: Stop parenting notifiers

There's no need to participate in the ancient EventReceiver parent/child
ownership scheme here. Notifiers are already owned by RefPtrs anyway.
This commit is contained in:
Andreas Kling 2025-08-10 16:00:40 +02:00 committed by Andreas Kling
parent 34709cc796
commit ecf0395c27
8 changed files with 9 additions and 10 deletions

View File

@ -45,7 +45,7 @@ ErrorOr<void> LocalServer::take_over_fd(int socket_fd)
void LocalServer::setup_notifier()
{
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_accept) {
auto maybe_client_socket = accept();

View File

@ -39,7 +39,7 @@ ErrorOr<void> LocalServer::take_over_fd(int socket_fd)
void LocalServer::setup_notifier()
{
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_accept) {
auto maybe_client_socket = accept();

View File

@ -10,9 +10,8 @@
namespace Core {
Notifier::Notifier(int fd, Type type, EventReceiver* parent)
: EventReceiver(parent)
, m_fd(fd)
Notifier::Notifier(int fd, Type type)
: m_fd(fd)
, m_type(type)
{
set_enabled(true);

View File

@ -37,7 +37,7 @@ public:
pthread_t owner_thread() const { return m_owner_thread; }
private:
Notifier(int fd, Type type, EventReceiver* parent = nullptr);
Notifier(int fd, Type type);
int m_fd { -1 };
bool m_is_enabled { false };

View File

@ -57,7 +57,7 @@ ErrorOr<void> TCPServer::listen(IPv4Address const& address, u16 port, AllowAddre
TRY(Core::System::listen(m_fd, 5));
m_listening = true;
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_ready_to_accept)
on_ready_to_accept();

View File

@ -60,7 +60,7 @@ ErrorOr<void> TCPServer::listen(IPv4Address const& address, u16 port, AllowAddre
TRY(Core::System::listen(m_fd, 5));
m_listening = true;
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_ready_to_accept)
on_ready_to_accept();

View File

@ -55,7 +55,7 @@ bool UDPServer::bind(IPv4Address const& address, u16 port)
m_bound = true;
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_ready_to_receive)
on_ready_to_receive();

View File

@ -45,7 +45,7 @@ bool UDPServer::bind(IPv4Address const& address, u16 port)
m_bound = true;
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read);
m_notifier->on_activation = [this] {
if (on_ready_to_receive)
on_ready_to_receive();