mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +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
|
@ -11,7 +11,7 @@
|
|||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#queue-a-fetch-task
|
||||
int queue_fetch_task(JS::Object& task_destination, JS::SafeFunction<void()> algorithm)
|
||||
int queue_fetch_task(JS::Object& task_destination, Function<void()> algorithm)
|
||||
{
|
||||
// FIXME: 1. If taskDestination is a parallel queue, then enqueue algorithm to taskDestination.
|
||||
|
||||
|
@ -21,7 +21,7 @@ int queue_fetch_task(JS::Object& task_destination, JS::SafeFunction<void()> algo
|
|||
|
||||
// AD-HOC: This overload allows tracking the queued task within the fetch controller so that we may cancel queued tasks
|
||||
// when the spec indicates that we must stop an ongoing fetch.
|
||||
int queue_fetch_task(JS::NonnullGCPtr<FetchController> fetch_controller, JS::Object& task_destination, JS::SafeFunction<void()> algorithm)
|
||||
int queue_fetch_task(JS::NonnullGCPtr<FetchController> fetch_controller, JS::Object& task_destination, Function<void()> algorithm)
|
||||
{
|
||||
auto fetch_task_id = fetch_controller->next_fetch_task_id();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Web::Fetch::Infrastructure {
|
|||
// FIXME: 'or a parallel queue'
|
||||
using TaskDestination = Variant<Empty, JS::NonnullGCPtr<JS::Object>>;
|
||||
|
||||
int queue_fetch_task(JS::Object&, JS::SafeFunction<void()>);
|
||||
int queue_fetch_task(JS::NonnullGCPtr<FetchController>, JS::Object&, JS::SafeFunction<void()>);
|
||||
int queue_fetch_task(JS::Object&, Function<void()>);
|
||||
int queue_fetch_task(JS::NonnullGCPtr<FetchController>, JS::Object&, Function<void()>);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue