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

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, 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 a4764783512a1b4ae7ef8c0c1a07366a06bb4bdd..d4f25b595a2087f97f2e0247a94283e2d2539743 100644
--- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.cpp
@@ -406,6 +406,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,
@@ -446,6 +455,9 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage(
image_ = CreateImage();
DCHECK(image_);
size_available_ = image_->SetData(std::move(data), all_data_received);
+ DCHECK(all_data_received ||
+ size_available_ !=
+ Image::kSizeAvailableAndLoadingAsynchronously);
}
// Go ahead and tell our observers to try to draw if we have either
@@ -469,11 +481,18 @@ ImageResourceContent::UpdateImageResult ImageResourceContent::UpdateImage(
break;
}
+ DCHECK(all_data_received ||
+ size_available_ != Image::kSizeAvailableAndLoadingAsynchronously);
+
// 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) {
UpdateToLoadedContentStatus(status);
NotifyObservers(kShouldNotifyFinish);
} else {

Powered by Google App Engine
This is Rietveld 408576698