Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 2859383002: Add CHECK()s about ImageLoader::has_pending_load_event_ (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/ImageLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
index 02016f038650d43e7eb4cd34f707e60d8ae7af24..22c22f1e4d5d839117cec70754f7ea90423421fa 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -510,6 +510,12 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) {
DCHECK(failed_load_url_.IsEmpty());
DCHECK_EQ(resource, image_.Get());
+ // TODO(hiroshige): Turn the CHECK()s to DCHECK()s before going to beta.
+ if (loading_image_document_)
+ CHECK(image_complete_);
yhirano 2017/05/10 06:44:04 Just to confirm: This is based on the fact that Im
hiroshige 2017/05/10 17:05:44 Yes, and SetImage() sets image_ to non-null but im
+ else
+ CHECK(!image_complete_);
+
image_complete_ = true;
// Update ImageAnimationPolicy for image_.
@@ -522,8 +528,12 @@ void ImageLoader::ImageNotifyFinished(ImageResourceContent* resource) {
ToSVGImage(image_->GetImage())
->UpdateUseCounters(GetElement()->GetDocument());
- if (!has_pending_load_event_)
+ if (loading_image_document_) {
+ CHECK(!has_pending_load_event_);
return;
+ }
+
+ CHECK(has_pending_load_event_);
if (resource->ErrorOccurred()) {
LoadEventSender().CancelEvent(this);
@@ -623,10 +633,10 @@ void ImageLoader::DispatchPendingEvent(ImageEventSender* event_sender) {
}
void ImageLoader::DispatchPendingLoadEvent() {
- if (!has_pending_load_event_)
- return;
+ CHECK(has_pending_load_event_);
if (!image_)
return;
+ CHECK(image_complete_);
has_pending_load_event_ = false;
if (GetElement()->GetDocument().GetFrame())
DispatchLoadEvent();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine