LibWeb: Let queue_global_task() take a JS::HeapFunction

Changes the signature of queue_global_task() from AK:Function to
JS::HeapFunction to be more clear to the user of the function that this
is what it uses internally.
This commit is contained in:
Kenneth Myhra 2024-04-16 22:04:01 +02:00 committed by Andreas Kling
parent 9540af6489
commit a3661fd7f2
Notes: sideshowbarker 2024-07-17 03:05:16 +09:00
23 changed files with 104 additions and 103 deletions

View file

@ -396,9 +396,9 @@ i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler
// 11. Let completionStep be an algorithm step which queues a global task on the timer task source given global to run task.
Function<void()> completion_step = [this, task = move(task)]() mutable {
queue_global_task(Task::Source::TimerTask, this_impl(), [task] {
queue_global_task(Task::Source::TimerTask, this_impl(), JS::create_heap_function(this_impl().heap(), [task] {
task->function()();
});
}));
};
// 12. Run steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep, and id.
@ -565,7 +565,7 @@ void WindowOrWorkerGlobalScopeMixin::queue_the_performance_observer_task()
// 3. Queue a task that consists of running the following substeps. The task source for the queued task is the performance
// timeline task source.
queue_global_task(Task::Source::PerformanceTimeline, this_impl(), [this]() {
queue_global_task(Task::Source::PerformanceTimeline, this_impl(), JS::create_heap_function(this_impl().heap(), [this]() {
auto& realm = this_impl().realm();
// 1. Unset performance observer task queued flag of relevantGlobal.
@ -642,7 +642,7 @@ void WindowOrWorkerGlobalScopeMixin::queue_the_performance_observer_task()
if (completion.is_abrupt())
HTML::report_exception(completion, realm);
}
});
}));
}
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#run-steps-after-a-timeout