mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
LibWeb: Assign a unique ID to each HTML task
And return that ID when queueing an element task. This is required for some task tracking - specifically, the HTML ToggleTaskTracker struct.
This commit is contained in:
parent
5ae9b2fdaf
commit
f598a357ad
4 changed files with 15 additions and 4 deletions
|
@ -11,15 +11,20 @@
|
|||
namespace Web::HTML {
|
||||
|
||||
static IDAllocator s_unique_task_source_allocator { static_cast<int>(Task::Source::UniqueTaskSourceStart) };
|
||||
static IDAllocator s_task_id_allocator;
|
||||
|
||||
Task::Task(Source source, DOM::Document const* document, JS::SafeFunction<void()> steps)
|
||||
: m_source(source)
|
||||
: m_id(s_task_id_allocator.allocate())
|
||||
, m_source(source)
|
||||
, m_steps(move(steps))
|
||||
, m_document(JS::make_handle(document))
|
||||
{
|
||||
}
|
||||
|
||||
Task::~Task() = default;
|
||||
Task::~Task()
|
||||
{
|
||||
s_unique_task_source_allocator.deallocate(m_id);
|
||||
}
|
||||
|
||||
void Task::execute()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue