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 db851d2367c627f346455ca32ebf160a56daf3ad..b846b9895fc50544f71ae6fb31ad6eaa6a8d30c0 100644 |
--- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
@@ -317,6 +317,15 @@ void ImageResourceContent::updateStatus(ResourceStatus status, |
} |
} |
+void ImageResourceContent::loadCompleted(const blink::Image* image) { |
+ if (m_image != image) |
+ return; |
+ CHECK_EQ(m_sizeAvailable, Image::SizeAvailableAndLoadingAsynchronously); |
+ m_sizeAvailable = Image::SizeAvailable; |
+ updateStatus(ResourceStatus::Cached, ShouldNotifyFinish); |
+ notifyObservers(ShouldNotifyFinish); |
+} |
+ |
ImageResourceContent::UpdateImageResult ImageResourceContent::updateImage( |
PassRefPtr<SharedBuffer> data, |
ResourceStatus status, |
@@ -355,6 +364,10 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::updateImage( |
m_image = createImage(); |
DCHECK(m_image); |
m_sizeAvailable = m_image->setData(std::move(data), allDataReceived); |
+ if (!allDataReceived) { |
+ DCHECK_NE(m_sizeAvailable, |
+ Image::SizeAvailableAndLoadingAsynchronously); |
+ } |
} |
// Go ahead and tell our observers to try to draw if we have either |
@@ -386,7 +399,10 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::updateImage( |
// current design (decoding delayed until painting) that seems hard. |
NotifyFinishOption notifyFinishOption = |
- allDataReceived ? ShouldNotifyFinish : DoNotNotifyFinish; |
+ allDataReceived && |
+ m_sizeAvailable != Image::SizeAvailableAndLoadingAsynchronously |
+ ? ShouldNotifyFinish |
+ : DoNotNotifyFinish; |
updateStatus(status, notifyFinishOption); |
notifyObservers(notifyFinishOption); |
return UpdateImageResult::NoDecodeError; |