1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 16:44:57 +00:00
serenity/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
Simon Wanner 836d2ff259 LibWeb: Implement the infrastructure necessary for requestIdleCallback
This includes a bug fix for the event loop processing steps which has
not been merged yet: https://github.com/whatwg/html/pull/7768
2022-04-02 23:52:25 +01:00

34 lines
768 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/StdLibExtras.h>
#include <LibWeb/Bindings/Wrappable.h>
namespace Web::RequestIdleCallback {
class IdleDeadline final
: public RefCounted<IdleDeadline>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::IdleDeadlineWrapper;
using AllowOwnPtr = TrueType;
static NonnullRefPtr<IdleDeadline> create(bool did_timeout = false);
virtual ~IdleDeadline() override;
double time_remaining() const;
bool did_timeout() const { return m_did_timeout; }
private:
IdleDeadline(bool did_timeout);
bool m_did_timeout { false };
};
}