LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr

The FIXMEs must flow!
This commit is contained in:
Sam Atkins 2023-01-11 16:20:17 +00:00 committed by Andreas Kling
commit a15d44f019
Notes: sideshowbarker 2024-07-18 03:23:00 +09:00
12 changed files with 19 additions and 17 deletions

View file

@ -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;
}