LibCore: Remove unused ChildEvent

This commit is contained in:
Andreas Kling 2025-08-11 11:42:28 +02:00 committed by Andreas Kling
commit 0037df88d5
Notes: github-actions[bot] 2025-08-11 14:57:09 +00:00
6 changed files with 0 additions and 79 deletions

View file

@ -42,7 +42,6 @@ set(SOURCES
ConfigFile.cpp
DateTime.cpp
ElapsedTimer.cpp
Event.cpp
EventLoop.cpp
EventLoopImplementation.cpp
EventReceiver.cpp

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/WeakPtr.h>
#include <LibCore/Event.h>
#include <LibCore/EventReceiver.h>
namespace Core {
ChildEvent::ChildEvent(Type type, EventReceiver& child, EventReceiver* insertion_before_child)
: Core::Event(type)
, m_child(child.make_weak_ptr())
, m_insertion_before_child(AK::make_weak_ptr_if_nonnull(insertion_before_child))
{
}
EventReceiver* ChildEvent::child()
{
if (auto ref = m_child.strong_ref())
return ref.ptr();
return nullptr;
}
EventReceiver const* ChildEvent::child() const
{
if (auto ref = m_child.strong_ref())
return ref.ptr();
return nullptr;
}
EventReceiver* ChildEvent::insertion_before_child()
{
if (auto ref = m_insertion_before_child.strong_ref())
return ref.ptr();
return nullptr;
}
EventReceiver const* ChildEvent::insertion_before_child() const
{
if (auto ref = m_insertion_before_child.strong_ref())
return ref.ptr();
return nullptr;
}
}

View file

@ -24,8 +24,6 @@ public:
Timer,
NotifierActivation,
DeferredInvoke,
ChildAdded,
ChildRemoved,
Custom,
};
@ -102,22 +100,6 @@ private:
NotificationType m_type;
};
class ChildEvent final : public Event {
public:
ChildEvent(Type, EventReceiver& child, EventReceiver* insertion_before_child = nullptr);
~ChildEvent() = default;
EventReceiver* child();
EventReceiver const* child() const;
EventReceiver* insertion_before_child();
EventReceiver const* insertion_before_child() const;
private:
WeakPtr<EventReceiver> m_child;
WeakPtr<EventReceiver> m_insertion_before_child;
};
class CustomEvent : public Event {
public:
CustomEvent(int custom_type)

View file

@ -28,9 +28,6 @@ void EventReceiver::event(Core::Event& event)
if (!m_timer_id)
break; // Too late, the timer was already stopped.
return timer_event(static_cast<TimerEvent&>(event));
case Core::Event::ChildAdded:
case Core::Event::ChildRemoved:
return child_event(static_cast<ChildEvent&>(event));
case Core::Event::Invalid:
VERIFY_NOT_REACHED();
break;
@ -45,10 +42,6 @@ void EventReceiver::timer_event(Core::TimerEvent&)
{
}
void EventReceiver::child_event(Core::ChildEvent&)
{
}
void EventReceiver::custom_event(CustomEvent&)
{
}

View file

@ -82,9 +82,6 @@ protected:
virtual void timer_event(TimerEvent&);
virtual void custom_event(CustomEvent&);
// NOTE: You may get child events for children that are not yet fully constructed!
virtual void child_event(ChildEvent&);
private:
intptr_t m_timer_id { 0 };
};

View file

@ -13,7 +13,6 @@ namespace Core {
class AnonymousBuffer;
class ArgsParser;
class BufferedSocketBase;
class ChildEvent;
class ConfigFile;
class CustomEvent;
class DateTime;