1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 03:47:34 +00:00

LibWeb: Use JS::HeapFunction for callbacks in SharedImageRequest

If a function that captures a GC-allocated object is owned by another
GC-allocated object, it is more preferable to use JS::HeapFunction.
This is because JS::HeapFunction is visited, unlike introducing a new
heap root as JS::SafeFunction does.
This commit is contained in:
Aliaksandr Kalenik 2023-09-25 14:27:11 +02:00 committed by Andreas Kling
parent 4f488f7e07
commit df86e52d75
4 changed files with 21 additions and 10 deletions

View file

@ -125,7 +125,7 @@ void ImageRequest::fetch_image(JS::Realm& realm, JS::NonnullGCPtr<Fetch::Infrast
m_shared_image_request->fetch_image(realm, request);
}
void ImageRequest::add_callbacks(JS::SafeFunction<void()> on_finish, JS::SafeFunction<void()> on_fail)
void ImageRequest::add_callbacks(Function<void()> on_finish, Function<void()> on_fail)
{
VERIFY(m_shared_image_request);
m_shared_image_request->add_callbacks(move(on_finish), move(on_fail));