mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 11:37:35 +00:00
LibWeb: Make HTML::DecodedImageData to be GC-allocated
This change fixes GC-leak caused by following mutual dependency: - SVGDecodedImageData owns JS::Handle for Page. - SVGDecodedImageData is owned by visited objects. by making everything inherited from HTML::DecodedImageData and ListOfAvailableImages to be GC-allocated. Generally, if visited object has a handle, very likely we leak everything visited from object in a handle.
This commit is contained in:
parent
57a04c536c
commit
41a3c19cfe
18 changed files with 100 additions and 54 deletions
|
@ -41,6 +41,7 @@ void ImageRequest::visit_edges(JS::Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_shared_image_request);
|
||||
visitor.visit(m_page);
|
||||
visitor.visit(m_image_data);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#img-available
|
||||
|
@ -92,14 +93,14 @@ void abort_the_image_request(JS::Realm&, ImageRequest* image_request)
|
|||
// AD-HOC: We simply don't do this, since our SharedImageRequest may be used by someone else.
|
||||
}
|
||||
|
||||
RefPtr<DecodedImageData const> ImageRequest::image_data() const
|
||||
JS::GCPtr<DecodedImageData> ImageRequest::image_data() const
|
||||
{
|
||||
return m_image_data;
|
||||
}
|
||||
|
||||
void ImageRequest::set_image_data(RefPtr<DecodedImageData const> data)
|
||||
void ImageRequest::set_image_data(JS::GCPtr<DecodedImageData> data)
|
||||
{
|
||||
m_image_data = move(data);
|
||||
m_image_data = data;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#prepare-an-image-for-presentation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue