Set an explicit resource cache limit on Skia GPU contexts and ask
Skia to perform deferred cleanup from the compositor at a throttled
cadence. When resource usage crosses high watermarks, request more
aggressive cleanup and purge scratch resources only as a last step.
Also cap the decoded frame Skia image cache by approximate bitmap
bytes and entry count so route changes and pointer-driven repaint
churn cannot keep an unbounded number of uploaded image textures
alive.
Move the cache's Skia-dependent members (sk_sp<SkImage>, the
DecodedImageFrame-keyed HashMap, and the SkColorSpace-based key traits)
into a private Impl struct defined in the .cpp file. The header now only
needs forward declarations for SkImage and sk_sp, so including the cache
no longer drags in Skia headers into translation units that just want to
hold a pointer to the cache.
DecodedImageFrame only wraps a ref-counted Bitmap and color-space
metadata. The frame object itself does not provide shared mutable
state or lifetime ownership beyond those members, so ref-counting it
adds an unnecessary layer of indirection.
DecodedImageFrame now owns decoded bitmap pixels directly, so the
separate ImmutableBitmap wrapper no longer carries useful semantics.
Remove the class and pass decoded image frames or bitmaps at the
boundaries where pixels are actually required.
The Skia image cache now keys off DecodedImageFrame, matching the
display-list commands that paint decoded images. Video frames stay
owned by LibMedia, with the explicit YUV-to-bitmap conversion living
at HTMLVideoElement's decoded-frame entry point for canvas and WebGL
callers.
2026-05-05 14:39:17 -05:00
Renamed from Libraries/LibGfx/ImmutableBitmapSkiaImageCache.cpp (Browse further)