mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 13:46:31 +00:00
LibCore: Remove unused Timer APIs for constructing with a parent
This commit is contained in:
parent
4d285d6dce
commit
d13884e933
Notes:
github-actions[bot]
2025-08-11 14:58:08 +00:00
Author: https://github.com/awesomekling
Commit: d13884e933
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5817
Reviewed-by: https://github.com/gmta ✅
2 changed files with 13 additions and 17 deletions
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue