mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +00:00
LibCore: Stop obsessing about tiny OOMs in Core::Timer
Work towards #20405
This commit is contained in:
parent
bf1c82724f
commit
1cb5385a29
Notes:
sideshowbarker
2024-07-16 21:39:23 +09:00
Author: https://github.com/awesomekling
Commit: 1cb5385a29
Pull-request: https://github.com/SerenityOS/serenity/pull/23988
52 changed files with 111 additions and 113 deletions
|
@ -9,6 +9,25 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
NonnullRefPtr<Timer> Timer::create()
|
||||
{
|
||||
return adopt_ref(*new Timer);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Timer> Timer::create_repeating(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent)
|
||||
{
|
||||
return adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Timer> Timer::create_single_shot(int interval_ms, Function<void()>&& timeout_handler, EventReceiver* parent)
|
||||
{
|
||||
auto timer = adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
|
||||
timer->set_single_shot(true);
|
||||
return timer;
|
||||
}
|
||||
|
||||
Timer::~Timer() = default;
|
||||
|
||||
Timer::Timer(EventReceiver* parent)
|
||||
: EventReceiver(parent)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue