Index: third_party/WebKit/Source/core/fetch/ImageResource.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
index c10b9a9682ccdc81789ec0b463f4832a8b7b1a9c..18de9a4285356fd2ddb05e57b41507077369464a 100644 |
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp |
@@ -115,6 +115,20 @@ void ImageResource::markClientsAndObserversFinished() |
Resource::markClientsAndObserversFinished(); |
} |
+void ImageResource::ensureImage() |
+{ |
+ if (m_data && !m_image && !errorOccurred()) { |
+ createImage(); |
+ m_image->setData(m_data, true); |
+ } |
+} |
+ |
+void ImageResource::didAddClient(ResourceClient* client) |
+{ |
+ ensureImage(); |
+ Resource::didAddClient(client); |
+} |
+ |
void ImageResource::addObserver(ImageResourceObserver* observer) |
{ |
willAddClientOrObserver(); |
@@ -124,10 +138,7 @@ void ImageResource::addObserver(ImageResourceObserver* observer) |
if (isCacheValidator()) |
return; |
- if (m_data && !m_image && !errorOccurred()) { |
- createImage(); |
- m_image->setData(m_data, true); |
- } |
+ ensureImage(); |
if (m_image && !m_image->isNull()) { |
observer->imageChanged(this); |