mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibGC: Mark GC::Function and create_function as ESCAPING
Whenever we create a GC function, it should always be so that we can pass it to a platform event loop spin, HTML event loop spin, or some queued task on the HTML event loop. For every use case, any local variables will be out of scope by the time the function executes.
This commit is contained in:
parent
66519af43f
commit
2f38c83caf
Notes:
github-actions[bot]
2024-12-10 06:13:57 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/2f38c83caf3 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2860
1 changed files with 2 additions and 2 deletions
|
@ -17,7 +17,7 @@ class Function final : public Cell {
|
||||||
GC_CELL(Function, Cell);
|
GC_CELL(Function, Cell);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Ref<Function> create(Heap& heap, AK::Function<T> function)
|
static Ref<Function> create(Heap& heap, ESCAPING AK::Function<T> function)
|
||||||
{
|
{
|
||||||
return heap.allocate<Function>(move(function));
|
return heap.allocate<Function>(move(function));
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Callable, typename T = EquivalentFunctionType<Callable>>
|
template<typename Callable, typename T = EquivalentFunctionType<Callable>>
|
||||||
static Ref<Function<T>> create_function(Heap& heap, Callable&& function)
|
static Ref<Function<T>> create_function(Heap& heap, ESCAPING Callable&& function)
|
||||||
{
|
{
|
||||||
return Function<T>::create(heap, AK::Function<T> { forward<Callable>(function) });
|
return Function<T>::create(heap, AK::Function<T> { forward<Callable>(function) });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue