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

@ -370,7 +370,7 @@ void EventLoop::process()
}
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task
int queue_global_task(HTML::Task::Source source, JS::Object& global_object, Function<void()> steps)
int queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::NonnullGCPtr<JS::HeapFunction<void()>> steps)
{
// 1. Let event loop be global's relevant agent's event loop.
auto& global_custom_data = verify_cast<Bindings::WebEngineCustomData>(*global_object.vm().custom_data());
@ -385,7 +385,7 @@ int queue_global_task(HTML::Task::Source source, JS::Object& global_object, Func
// 3. Queue a task given source, event loop, document, and steps.
auto& vm = global_object.vm();
event_loop->task_queue().add(HTML::Task::create(vm, source, document, JS::create_heap_function(vm.heap(), move(steps))));
event_loop->task_queue().add(HTML::Task::create(vm, source, document, steps));
return event_loop->task_queue().last_added_task()->id();
}