Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9e8f5212b01ad782bb58df709760a521ca90662d
https://github.com/WebKit/WebKit/commit/9e8f5212b01ad782bb58df709760a521ca90662d
Author: Ben Nham <[email protected]>
Date: 2026-01-22 (Thu, 22 Jan 2026)
Changed paths:
M Source/WebCore/loader/cache/CachedImage.cpp
M Source/WebCore/platform/graphics/BitmapImage.cpp
M Source/WebCore/platform/graphics/BitmapImage.h
M Source/WebCore/platform/graphics/BitmapImageSource.cpp
M Source/WebCore/platform/graphics/BitmapImageSource.h
M Source/WebCore/platform/graphics/Image.cpp
M Source/WebCore/platform/graphics/Image.h
M Source/WebCore/platform/graphics/ImageSource.h
Log Message:
-----------
Dirty encoded image blobs are not replaced by clean encoded image blobs as
expected
https://bugs.webkit.org/show_bug.cgi?id=305589
rdar://168246161
Reviewed by Said Abou-Hallawa.
After caching a blob in the disk cache, we pass a handle to the clean mmap'd
blob back to WebProcess
via the `NetworkProcessConnection::DidCacheResource` message. As part of
handling this message we
try to replace the dirty encoded blob with the clean encoded blob (in
`CachedResource::tryReplaceEncodedData`). This all seems to work as expected.
However, for CachedImages, there is an Image object that hangs on to the dirty
encoded data
(`m_encodedImageData` member) which we never reset. The net effect of this is
that there's still one
reference to the dirty encoded data blob for CachedImages even after the dirty
=> clean buffer swap
occurs, so the dirty buffer never goes away.
Fix this by having CachedImage swap the dirty buffer for the clean buffer in
the Image object in
`didReplaceSharedBufferContents`.
* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::didReplaceSharedBufferContents):
* Source/WebCore/platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::dataReplaced):
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::destroyDecodedFrames):
(WebCore::BitmapImageSource::destroyDecodedData):
(WebCore::BitmapImageSource::dataReplaced):
* Source/WebCore/platform/graphics/BitmapImageSource.h:
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::tryReplaceData):
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::dataChanged):
(WebCore::Image::canReplaceData const):
(WebCore::Image::dataReplaced):
* Source/WebCore/platform/graphics/ImageSource.h:
(WebCore::ImageSource::canReplaceData const):
(WebCore::ImageSource::dataReplaced):
Canonical link: https://commits.webkit.org/306036@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications