mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-22 10:57:18 +00: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:
committed by
Andreas Kling
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
@@ -17,7 +17,7 @@ class Function final : public Cell {
|
||||
GC_CELL(Function, Cell);
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
};
|
||||
|
||||
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) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user