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

Unified Diff: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp

Issue 2613853002: Phase III Step 2: Call imageNotifyFinished() and image load event after SVG loading completes (Closed)
Patch Set: Rebase Created 3 years, 9 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/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;

Powered by Google App Engine
This is Rietveld 408576698