Index: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
index ea9e7c179a19eeb4a84b2c0cd0ad79c1dbc436ce..c729e84f6e0dd11cfca97c448d4ef4675dbbcf61 100644 |
--- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
@@ -54,7 +54,6 @@ class NullImageResourceInfo final |
bool hasCacheControlNoStoreHeader() const override { return false; } |
const ResourceError& resourceError() const override { return m_error; } |
- void decodeError(bool allDataReceived) override {} |
void setDecodedSize(size_t) override {} |
void setIsPlaceholder(bool) override {} |
void willAddClientOrObserver() override {} |
@@ -331,11 +330,17 @@ static bool shouldShowFullImageInsteadOfPlaceholder( |
return response.httpStatusCode() < 400 || response.httpStatusCode() >= 600; |
} |
-void ImageResourceContent::updateImage(PassRefPtr<SharedBuffer> data, |
- UpdateImageOption updateImageOption, |
- bool allDataReceived) { |
+ImageResourceContent::UpdateImageResult ImageResourceContent::updateImage( |
+ PassRefPtr<SharedBuffer> data, |
+ UpdateImageOption updateImageOption, |
+ bool allDataReceived) { |
TRACE_EVENT0("blink", "ImageResourceContent::updateImage"); |
+#if DCHECK_IS_ON() |
+ DCHECK(!m_isUpdateImageBeingCalled); |
+ AutoReset<bool> scope(&m_isUpdateImageBeingCalled, true); |
+#endif |
+ |
// Clears the existing image, if instructed by |updateImageOption|. |
switch (updateImageOption) { |
case ClearAndUpdateImage: |
@@ -368,7 +373,7 @@ void ImageResourceContent::updateImage(PassRefPtr<SharedBuffer> data, |
// received all the data or the size is known. Each chunk from the network |
// causes observers to repaint, which will force that chunk to decode. |
if (m_sizeAvailable == Image::SizeUnavailable && !allDataReceived) |
- return; |
+ return UpdateImageResult::NoDecodeError; |
if (m_info->isPlaceholder() && allDataReceived) { |
if (shouldShowFullImageInsteadOfPlaceholder(response(), |
@@ -387,7 +392,7 @@ void ImageResourceContent::updateImage(PassRefPtr<SharedBuffer> data, |
} |
if (!m_image || m_image->isNull()) { |
clearImage(); |
- m_info->decodeError(allDataReceived); |
+ return UpdateImageResult::ShouldDecodeError; |
} |
break; |
} |
@@ -396,6 +401,7 @@ void ImageResourceContent::updateImage(PassRefPtr<SharedBuffer> data, |
// It would be nice to only redraw the decoded band of the image, but with the |
// current design (decoding delayed until painting) that seems hard. |
notifyObservers(allDataReceived ? ShouldNotifyFinish : DoNotNotifyFinish); |
+ return UpdateImageResult::NoDecodeError; |
} |
void ImageResourceContent::decodedSizeChangedTo(const blink::Image* image, |