Chromium Code Reviews| 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..32310323f9165092587b1c42ea7e7eed352ec373 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) { |
|
yhirano
2017/05/09 08:33:57
This is same as L477-L479. Why do we have the same
hiroshige
2017/05/10 22:45:49
Done, unified the style.
|
| + DCHECK_NE(size_available_, |
| + Image::kSizeAvailableAndLoadingAsynchronously); |
| + } |
| } |
| // Go ahead and tell our observers to try to draw if we have either |
| @@ -461,11 +474,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 { |