mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +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:
committed by
Andreas Kling
parent
4f488f7e07
commit
df86e52d75
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user