mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Make EventLoop, TaskQueue, and Task GC-allocated
...and use HeapFunction instead of SafeFunction for task steps. Since there is only one EventLoop per process, it lives as a global handle in the VM custom data. This makes it much easier to reason about lifetimes of tasks, task steps, and random stuff captured by them.
This commit is contained in:
parent
5485e2a940
commit
2ef37c0b06
Notes:
sideshowbarker
2024-07-17 02:14:39 +09:00
Author: https://github.com/awesomekling
Commit: 2ef37c0b06
Pull-request: https://github.com/SerenityOS/serenity/pull/23839
Reviewed-by: https://github.com/AtkinsSJ ✅
20 changed files with 167 additions and 124 deletions
|
@ -785,9 +785,9 @@ void Element::make_html_uppercased_qualified_name()
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task
|
||||
int Element::queue_an_element_task(HTML::Task::Source source, JS::SafeFunction<void()> steps)
|
||||
int Element::queue_an_element_task(HTML::Task::Source source, Function<void()> steps)
|
||||
{
|
||||
auto task = HTML::Task::create(source, &document(), move(steps));
|
||||
auto task = HTML::Task::create(vm(), source, &document(), JS::create_heap_function(heap(), move(steps)));
|
||||
auto id = task->id();
|
||||
|
||||
HTML::main_thread_event_loop().task_queue().add(move(task));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue