LibCore: Remove unused Timer APIs for constructing with a parent

This commit is contained in:
Andreas Kling 2025-08-10 16:22:40 +02:00 committed by Andreas Kling
commit d13884e933
Notes: github-actions[bot] 2025-08-11 14:58:08 +00:00
2 changed files with 13 additions and 17 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2018-2025, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
@ -14,28 +14,24 @@ NonnullRefPtr<Timer> Timer::create()
return adopt_ref(*new Timer);
}
NonnullRefPtr<Timer> Timer::create_repeating(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent)
NonnullRefPtr<Timer> Timer::create_repeating(int interval_ms, Function<void()>&& timeout_handler)
{
return adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
return adopt_ref(*new Timer(interval_ms, move(timeout_handler)));
}
NonnullRefPtr<Timer> Timer::create_single_shot(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent)
NonnullRefPtr<Timer> Timer::create_single_shot(int interval_ms, Function<void()>&& timeout_handler)
{
auto timer = adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
auto timer = adopt_ref(*new Timer(interval_ms, move(timeout_handler)));
timer->set_single_shot(true);
return timer;
}
Timer::~Timer() = default;
Timer::Timer(EventReceiver* parent)
: EventReceiver(parent)
{
}
Timer::Timer() = default;
Timer::Timer(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent)
: EventReceiver(parent)
, on_timeout(move(timeout_handler))
Timer::Timer(int interval_ms, Function<void()>&& timeout_handler)
: on_timeout(move(timeout_handler))
, m_interval_ms(interval_ms)
{
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2018-2025, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
@ -17,8 +17,8 @@ class Timer final : public EventReceiver {
public:
static NonnullRefPtr<Timer> create();
static NonnullRefPtr<Timer> create_repeating(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent = nullptr);
static NonnullRefPtr<Timer> create_single_shot(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent = nullptr);
static NonnullRefPtr<Timer> create_repeating(int interval_ms, Function<void()>&& timeout_handler);
static NonnullRefPtr<Timer> create_single_shot(int interval_ms, Function<void()>&& timeout_handler);
virtual ~Timer() override;
@ -46,8 +46,8 @@ public:
Function<void()> on_timeout;
private:
explicit Timer(EventReceiver* parent = nullptr);
Timer(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent = nullptr);
Timer();
Timer(int interval_ms, Function<void()>&& timeout_handler);
virtual void timer_event(TimerEvent&) override;