Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2141843003: Ensure |m_image| is (re-)created in ImageResource::didAddClient() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce ensureImage() Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698