Skip to content
Permalink
Browse files
Can't load a very large image as an image document
https://bugs.webkit.org/show_bug.cgi?id=241110
<rdar://94126683>

Reviewed by Jer Noble.

Stop flattening the SharedBuffer whenever we received a new segment.
The core logic change to support this was done in https://bugs.webkit.org/show_bug.cgi?id=236695
but the CachedImage wasn't modified at the time (it should have been).

We have to use const_cast for now to minimize the change size, proper solution will be done in
https://bugs.webkit.org/show_bug.cgi?id=241251

* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::updateBufferInternal):
(WebCore::CachedImage::updateBuffer):
* Source/WebCore/loader/cache/CachedImage.h:

Canonical link: https://commits.webkit.org/251253@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295169 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jyavenard committed Jun 3, 2022
1 parent 309956d commit 001e6462c97c7a180ace2e2a424010e586051394
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -471,9 +471,9 @@ inline void CachedImage::clearImage()
m_updateImageDataCount = 0;
}

void CachedImage::updateBufferInternal(const SharedBuffer& data)
void CachedImage::updateBufferInternal(const FragmentedSharedBuffer& data)
{
m_data = data.makeContiguous();
m_data = const_cast<FragmentedSharedBuffer*>(&data);
setEncodedSize(m_data->size());
createImage();

@@ -553,7 +553,7 @@ EncodedDataStatus CachedImage::updateImageData(bool allDataReceived)
void CachedImage::updateBuffer(const FragmentedSharedBuffer& buffer)
{
ASSERT(dataBufferingPolicy() == DataBufferingPolicy::BufferData);
updateBufferInternal(buffer.makeContiguous());
updateBufferInternal(buffer);
}

void CachedImage::updateData(const SharedBuffer& data)
@@ -169,7 +169,7 @@ class CachedImage final : public CachedResource {
void changedInRect(const Image&, const IntRect*);
void scheduleRenderingUpdate(const Image&);

void updateBufferInternal(const SharedBuffer&);
void updateBufferInternal(const FragmentedSharedBuffer&);

void didReplaceSharedBufferContents() override;

0 comments on commit 001e646

Please sign in to comment.