haikuwebkit/LayoutTests/svg/as-image/svg-image-leak-cached-data-...

6 lines
399 B
Plaintext
Raw Permalink Normal View History

SVGImageCache leaks image data https://bugs.webkit.org/show_bug.cgi?id=87792 Source/WebCore: There are two functions to remove a client from a CachedImage: - CachedResource::removeClient() - CachedImage::removeClientForRenderer(). It's easy to make error to call the former which will leak the cached image buffers in SVGImageCache. This change combined the two by adding the virtual CachedResource::didRemoveClient(). CachedImage will do SVGImageCache cleanup in the function. Reviewed by Nikolas Zimmermann. Test: svg/as-image/svg-image-leak-cached-data.html * loader/cache/CachedFont.h: (WebCore::CachedFontClient::resourceClientType): Added 'const'. * loader/cache/CachedImage.cpp: (WebCore): (WebCore::CachedImage::didRemoveClient): Removes the client from SVGImageCache. (WebCore::CachedImage::lookupOrCreateImageForRenderer): * loader/cache/CachedImage.h: (CachedImage): (WebCore::CachedImageClient::resourceClientType): Added 'const'. * loader/cache/CachedRawResource.h: (WebCore::CachedRawResourceClient::resourceClientType): Added 'const'. * loader/cache/CachedResource.cpp: (WebCore::CachedResource::removeClient): Added invocation of didRemoveClient(). * loader/cache/CachedResource.h: (WebCore::CachedResource::didRemoveClient): Added for subclasses to do additional works. * loader/cache/CachedResourceClient.h: (WebCore::CachedResourceClient::resourceClientType): Added 'const'. * loader/cache/CachedSVGDocument.h: (WebCore::CachedSVGDocumentClient::resourceClientType): Added 'const'. * loader/cache/CachedStyleSheetClient.h: (WebCore::CachedStyleSheetClient::resourceClientType): Added 'const'. * rendering/style/StyleCachedImage.cpp: (WebCore::StyleCachedImage::removeClient): * rendering/style/StyleCachedImageSet.cpp: (WebCore::StyleCachedImageSet::removeClient): * svg/graphics/SVGImageCache.cpp: (WebCore::SVGImageCache::~SVGImageCache): Added checking for leaks. (WebCore::SVGImageCache::removeClientFromCache): (WebCore::SVGImageCache::setRequestedSizeAndScales): (WebCore::SVGImageCache::requestedSizeAndScales): (WebCore::SVGImageCache::lookupOrCreateBitmapImageForClient): * svg/graphics/SVGImageCache.h: (WebCore): (SVGImageCache): LayoutTests: Reviewed by Nikolas Zimmermann. New test case. * svg/as-image/svg-image-leak-cached-data-expected.txt: Added. * svg/as-image/svg-image-leak-cached-data.html: Added. Canonical link: https://commits.webkit.org/106634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120000 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-06-11 20:15:47 +00:00
This test checks if SVGImageCache leaks SVG image data as reported in https://bugs.webkit.org/show_bug.cgi?id=87792. Its layout has no particular meaning. The test will cause crash of debug version when leaks of SVG image data is detected.
Note: the code detects leaks of SVG image data on destruction of SVGImageCache, which doesn't work on platforms that DumpRenderTree leaks the cache itself.