mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 17:37:33 +02:00
LibWeb: Account text and image storage as external memory
Report DOM character data, decoded image frames, ImageBitmap pixel buffers, and 2D canvas surfaces through the GC external memory hook. This lets image and text-heavy pages participate in GC threshold calculations through their retained backing storage.
This commit is contained in:
committed by
Andreas Kling
parent
68fa684f76
commit
a414136d7c
Notes:
github-actions[bot]
2026-05-07 08:04:42 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/a414136d7ce Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9286
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibJS/Runtime/ExternalMemory.h>
|
||||
#include <LibWeb/Bindings/ImageBitmap.h>
|
||||
#include <LibWeb/HTML/ImageBitmap.h>
|
||||
#include <LibWeb/HTML/StructuredSerialize.h>
|
||||
@@ -72,6 +73,14 @@ void ImageBitmap::visit_edges(Cell::Visitor& visitor)
|
||||
Base::visit_edges(visitor);
|
||||
}
|
||||
|
||||
size_t ImageBitmap::external_memory_size() const
|
||||
{
|
||||
auto size = Base::external_memory_size();
|
||||
if (m_bitmap)
|
||||
size = JS::saturating_add_external_memory_size(size, m_bitmap->data_size());
|
||||
return size;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#the-imagebitmap-interface:serialization-steps
|
||||
WebIDL::ExceptionOr<void> ImageBitmap::serialization_steps(HTML::TransferDataEncoder& serialized, bool, HTML::SerializationMemory&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user