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

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: reflect comments Created 3 years, 7 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 b3f3a4f3f184e47f3be1b0653ba5d48861f8223a..cd6f8ce194f58c0f73b9253205d1a22647cdf405 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::AsyncLoadCompleted(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,12 @@ 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) {
+ //
+ // In the case of kSizeAvailableAndLoadingAsynchronously, we are waiting for
+ // SVG image completion, and thus we notify observers of kDoNotNotifyFinish
+ // here, and will notify observers of finish later in AsyncLoadCompleted().
+ if (all_data_received &&
+ size_available_ != Image::kSizeAvailableAndLoadingAsynchronously) {
kouhei (in TOK) 2017/05/08 13:07:04 Can we add DCHECKs about the possible conditions h
hiroshige 2017/05/08 17:22:07 What kind of conditions? (Added one DCHECK in the
UpdateToLoadedContentStatus(status);
NotifyObservers(kShouldNotifyFinish);
} else {

Powered by Google App Engine
This is Rietveld 408576698