Chromium Code Reviews| Index: third_party/WebKit/Source/core/loader/resource/ImageResource.cpp |
| diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp |
| index 26f23439aa598b1240b635549c1f8b808602c33e..cf06e6556dafd91e034ce3c3c00447690c2e3e97 100644 |
| --- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp |
| +++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp |
| @@ -81,7 +81,6 @@ class ImageResource::ImageResourceInfoImpl final |
| const ResourceResponse& GetResponse() const override { |
| return resource_->GetResponse(); |
| } |
| - ResourceStatus GetStatus() const override { return resource_->GetStatus(); } |
| bool ShouldShowPlaceholder() const override { |
| return resource_->ShouldShowPlaceholder(); |
| } |
| @@ -336,8 +335,8 @@ void ImageResource::DecodeError(bool all_data_received) { |
| Loader()->DidFinishLoading(MonotonicallyIncreasingTime(), size, size, size); |
| } else { |
| auto result = GetContent()->UpdateImage( |
| - nullptr, ImageResourceContent::kClearImageAndNotifyObservers, |
| - all_data_received); |
| + nullptr, GetStatus(), |
| + ImageResourceContent::kClearImageAndNotifyObservers, all_data_received); |
| DCHECK_EQ(result, ImageResourceContent::UpdateImageResult::kNoDecodeError); |
| } |
| @@ -349,6 +348,13 @@ void ImageResource::UpdateImageAndClearBuffer() { |
| ClearData(); |
| } |
| +void ImageResource::NotifyStartLoad() { |
| + if (!GetContent()) |
| + return; |
| + CHECK_EQ(GetStatus(), ResourceStatus::kPending); |
|
yhirano
2017/05/08 05:28:51
Is it better to have this CHECK at the beginning o
hiroshige
2017/05/08 17:08:14
Done. Actually the if statement is not needed here
|
| + GetContent()->NotifyStartLoad(); |
| +} |
| + |
| void ImageResource::Finish(double load_finish_time) { |
| if (multipart_parser_) { |
| multipart_parser_->Finish(); |
| @@ -579,8 +585,9 @@ void ImageResource::UpdateImage( |
| PassRefPtr<SharedBuffer> shared_buffer, |
| ImageResourceContent::UpdateImageOption update_image_option, |
| bool all_data_received) { |
| - auto result = GetContent()->UpdateImage( |
| - std::move(shared_buffer), update_image_option, all_data_received); |
| + auto result = |
| + GetContent()->UpdateImage(std::move(shared_buffer), GetStatus(), |
| + update_image_option, all_data_received); |
| if (result == ImageResourceContent::UpdateImageResult::kShouldDecodeError) { |
| // In case of decode error, we call imageNotifyFinished() iff we don't |
| // initiate reloading: |