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 b3f3a4f3f184e47f3be1b0653ba5d48861f8223a..29d2b3ff761f0b606f7f33f471e132b9f395652b 100644 |
--- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp |
@@ -398,6 +398,15 @@ void ImageResourceContent::NotifyStartLoad() { |
content_status_ = ResourceStatus::kPending; |
} |
+void ImageResourceContent::LoadCompleted(const blink::Image* image) { |
+ if (image_ != image) |
+ return; |
+ CHECK_EQ(size_available_, Image::kSizeAvailableAndLoadingAsynchronously); |
+ size_available_ = Image::kSizeAvailable; |
+ UpdateToLoadedContentStatus(ResourceStatus::kCached); |
+ NotifyObservers(kShouldNotifyFinish); |
+} |
+ |
ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage( |
PassRefPtr<SharedBuffer> data, |
ResourceStatus status, |
@@ -438,6 +447,10 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage( |
image_ = CreateImage(); |
DCHECK(image_); |
size_available_ = image_->SetData(std::move(data), all_data_received); |
+ if (!all_data_received) { |
+ DCHECK_NE(size_available_, |
+ Image::kSizeAvailableAndLoadingAsynchronously); |
+ } |
} |
// Go ahead and tell our observers to try to draw if we have either |
@@ -464,8 +477,8 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage( |
// Notifies the observers. |
// 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. |
- |
- if (all_data_received) { |
+ if (all_data_received && |
+ size_available_ != Image::kSizeAvailableAndLoadingAsynchronously) { |
fs
2017/05/05 10:52:42
Nit: Maybe add a short comment about this addition
hiroshige
2017/05/08 17:22:06
Done.
|
UpdateToLoadedContentStatus(status); |
NotifyObservers(kShouldNotifyFinish); |
} else { |