DecomposedGlyphs should notify observers in destructor
https://bugs.webkit.org/show_bug.cgi?id=241752

Reviewed by Simon Fraser.

Currently old DecomposedGlyphs objects will hang around in the GPU process until
the document goes away, instead of (as is intended) when the display list they
are in is removed from the GlyphDisplayListCache.

* Source/WebCore/platform/graphics/DecomposedGlyphs.cpp:
(WebCore::DecomposedGlyphs::~DecomposedGlyphs):

Canonical link: https://commits.webkit.org/251711@main


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@295706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/graphics/DecomposedGlyphs.cpp b/Source/WebCore/platform/graphics/DecomposedGlyphs.cpp
index 9d57e43..7f627e9 100644
--- a/Source/WebCore/platform/graphics/DecomposedGlyphs.cpp
+++ b/Source/WebCore/platform/graphics/DecomposedGlyphs.cpp
@@ -28,8 +28,6 @@
 
 namespace WebCore {
 
-DecomposedGlyphs::~DecomposedGlyphs() = default;
-
 Ref<DecomposedGlyphs> DecomposedGlyphs::create(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode mode, RenderingResourceIdentifier renderingResourceIdentifier)
 {
     return adoptRef(*new DecomposedGlyphs(font, glyphs, advances, count, localAnchor, mode, renderingResourceIdentifier));
@@ -55,4 +53,10 @@
     ASSERT(m_positionedGlyphs.glyphs.size() == m_positionedGlyphs.advances.size());
 }
 
+DecomposedGlyphs::~DecomposedGlyphs()
+{
+    for (auto observer : m_observers)
+        observer->releaseDecomposedGlyphs(m_renderingResourceIdentifier);
+}
+
 } // namespace WebCore