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

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

Issue 2487763003: [ImageLoader 2d] Set DecodeError by calling ResourceLoader::cancel()
Patch Set: Rebase Created 4 years, 1 month 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 a1899b76c58a16ade0f7b558d53ad33f19046303..9eab17e59e5a0b32d2b8faa49bcffc0a13df4fc9 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -422,21 +422,25 @@ void ImageResource::updateImage(bool allDataReceived) {
}
}
- if (!m_image || m_image->isNull()) {
- size_t size = encodedSize();
- clear();
- if (!errorOccurred())
- setStatus(DecodeError);
- if (!allDataReceived && loader())
- loader()->didFinishLoading(nullptr, monotonicallyIncreasingTime(), size);
- memoryCache()->remove(this);
- }
+ if (!m_image || m_image->isNull())
+ decodeError();
// 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);
}
+void ImageResource::decodeError() {
+ if (isLoading() && loader()) {
+ loader()->cancel(DecodeError);
+ } else if (!errorOccurred()) {
+ setStatus(DecodeError);
+ clear();
+ setEncodedSize(0);
+ memoryCache()->remove(this);
+ }
+}
+
void ImageResource::updateImageAndClearBuffer() {
clearImage();
updateImage(true);
@@ -461,11 +465,11 @@ void ImageResource::finish(double loadFinishTime) {
Resource::finish(loadFinishTime);
}
-void ImageResource::error(const ResourceError& error) {
+void ImageResource::error(const ResourceError& error, Status errorStatus) {
if (m_multipartParser)
m_multipartParser->cancel();
clear();
- Resource::error(error);
+ Resource::error(error, errorStatus);
notifyObservers(true);
}
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698