/src/serenity/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2021-2022, Andreas Kling <kling@serenityos.org> |
3 | | * Copyright (c) 2022, the SerenityOS developers. |
4 | | * |
5 | | * SPDX-License-Identifier: BSD-2-Clause |
6 | | */ |
7 | | |
8 | | #pragma once |
9 | | |
10 | | #include <LibWeb/Bindings/PlatformObject.h> |
11 | | |
12 | | namespace Web::RequestIdleCallback { |
13 | | |
14 | | class IdleDeadline final : public Bindings::PlatformObject { |
15 | | WEB_PLATFORM_OBJECT(IdleDeadline, Bindings::PlatformObject); |
16 | | JS_DECLARE_ALLOCATOR(IdleDeadline); |
17 | | |
18 | | public: |
19 | | [[nodiscard]] static JS::NonnullGCPtr<IdleDeadline> create(JS::Realm&, bool did_timeout = false); |
20 | | virtual ~IdleDeadline() override; |
21 | | |
22 | | double time_remaining() const; |
23 | 0 | bool did_timeout() const { return m_did_timeout; } |
24 | | |
25 | | private: |
26 | | IdleDeadline(JS::Realm&, bool did_timeout); |
27 | | |
28 | | virtual void initialize(JS::Realm&) override; |
29 | | |
30 | | bool m_did_timeout { false }; |
31 | | }; |
32 | | |
33 | | } |