Coverage Report

Created: 2025-12-18 07:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/Platform/TimerSerenity.cpp
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include "TimerSerenity.h"
8
#include <AK/NonnullRefPtr.h>
9
#include <LibCore/Timer.h>
10
11
namespace Web::Platform {
12
13
NonnullRefPtr<TimerSerenity> TimerSerenity::create()
14
0
{
15
0
    return adopt_ref(*new TimerSerenity);
16
0
}
17
18
TimerSerenity::TimerSerenity()
19
0
    : m_timer(Core::Timer::try_create().release_value_but_fixme_should_propagate_errors())
20
0
{
21
0
    m_timer->on_timeout = [this] {
22
0
        if (on_timeout)
23
0
            on_timeout();
24
0
    };
25
0
}
26
27
0
TimerSerenity::~TimerSerenity() = default;
28
29
void TimerSerenity::start()
30
0
{
31
0
    m_timer->start();
32
0
}
33
34
void TimerSerenity::start(int interval_ms)
35
0
{
36
0
    m_timer->start(interval_ms);
37
0
}
38
39
void TimerSerenity::restart()
40
0
{
41
0
    m_timer->restart();
42
0
}
43
44
void TimerSerenity::restart(int interval_ms)
45
0
{
46
0
    m_timer->restart(interval_ms);
47
0
}
48
49
void TimerSerenity::stop()
50
0
{
51
0
    m_timer->stop();
52
0
}
53
54
void TimerSerenity::set_active(bool active)
55
0
{
56
0
    m_timer->set_active(active);
57
0
}
58
59
bool TimerSerenity::is_active() const
60
0
{
61
0
    return m_timer->is_active();
62
0
}
63
64
int TimerSerenity::interval() const
65
0
{
66
0
    return m_timer->interval();
67
0
}
68
69
void TimerSerenity::set_interval(int interval_ms)
70
0
{
71
0
    m_timer->set_interval(interval_ms);
72
0
}
73
74
bool TimerSerenity::is_single_shot() const
75
0
{
76
0
    return m_timer->is_single_shot();
77
0
}
78
79
void TimerSerenity::set_single_shot(bool single_shot)
80
0
{
81
0
    m_timer->set_single_shot(single_shot);
82
0
}
83
84
}