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

Unified Diff: third_party/WebKit/Source/core/loader/resource/ImageResource.cpp

Issue 2746343002: Phase III Step 1: Make ImageResourceContent manage its own ResourceStatus (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/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..0537ade286012b5626f6cd80dc25801b246ad731 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,11 @@ void ImageResource::UpdateImageAndClearBuffer() {
ClearData();
}
+void ImageResource::NotifyStartLoad() {
+ CHECK_EQ(GetStatus(), ResourceStatus::kPending);
+ GetContent()->NotifyStartLoad();
+}
+
void ImageResource::Finish(double load_finish_time) {
if (multipart_parser_) {
multipart_parser_->Finish();
@@ -579,8 +583,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:

Powered by Google App Engine
This is Rietveld 408576698