mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 00:56:39 +00:00
LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr
The FIXMEs must flow!
This commit is contained in:
parent
1d4f287582
commit
a15d44f019
Notes:
sideshowbarker
2024-07-18 03:23:00 +09:00
Author: https://github.com/AtkinsSJ
Commit: a15d44f019
Pull-request: https://github.com/SerenityOS/serenity/pull/16960
Reviewed-by: https://github.com/alimpfard
12 changed files with 19 additions and 17 deletions
|
@ -16,9 +16,9 @@ class Timer final : public Object {
|
|||
C_OBJECT(Timer);
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<Timer> create_repeating(int interval_ms, Function<void()>&& timeout_handler, Object* parent = nullptr)
|
||||
static ErrorOr<NonnullRefPtr<Timer>> create_repeating(int interval_ms, Function<void()>&& timeout_handler, Object* parent = nullptr)
|
||||
{
|
||||
auto timer = adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
|
||||
auto timer = TRY(adopt_nonnull_ref_or_enomem(new Timer(interval_ms, move(timeout_handler), parent)));
|
||||
timer->stop();
|
||||
return timer;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue