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

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

Issue 2587503002: Merge clearImage() and clearImageAndNotifyObservers() into updateImage() (Closed)
Patch Set: comment Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 07888c2cbe7b940b9e39a7772c084c63f4d97b8b..2e353337e7b8dd350f281854b554a6bd7f7a7ed8 100644
--- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -237,7 +237,10 @@ void ImageResource::didAddClient(ResourceClient* client) {
}
void ImageResource::destroyDecodedDataForFailedRevalidation() {
- getContent()->clearImage();
+ // Clears the image, as we must create a new image for the failed
+ // revalidation response.
+ getContent()->updateImage(nullptr, ImageResourceContent::ClearAndUpdateImage,
+ false);
setDecodedSize(0);
}
@@ -282,8 +285,8 @@ void ImageResource::appendData(const char* data, size_t length) {
// Update the image immediately if needed.
if (getContent()->shouldUpdateImageImmediately()) {
- getContent()->updateImage(this->data(),
- ImageResourceContent::KeepExistingImage, false);
+ getContent()->updateImage(this->data(), ImageResourceContent::UpdateImage,
+ false);
return;
}
@@ -311,8 +314,8 @@ void ImageResource::flushImageIfNeeded(TimerBase*) {
// to call |updateImage()|.
if (isLoading()) {
m_lastFlushTime = WTF::monotonicallyIncreasingTime();
- getContent()->updateImage(this->data(),
- ImageResourceContent::KeepExistingImage, false);
+ getContent()->updateImage(this->data(), ImageResourceContent::UpdateImage,
+ false);
}
}
@@ -337,7 +340,7 @@ void ImageResource::decodeError(bool allDataReceived) {
}
void ImageResource::updateImageAndClearBuffer() {
- getContent()->updateImage(data(), ImageResourceContent::ClearExistingImage,
+ getContent()->updateImage(data(), ImageResourceContent::ClearAndUpdateImage,
true);
clearData();
}
@@ -348,8 +351,7 @@ void ImageResource::finish(double loadFinishTime) {
if (data())
updateImageAndClearBuffer();
} else {
- getContent()->updateImage(data(), ImageResourceContent::KeepExistingImage,
- true);
+ getContent()->updateImage(data(), ImageResourceContent::UpdateImage, true);
// As encoded image data can be created from m_image (see
// ImageResource::resourceBuffer(), we don't have to keep m_data. Let's
// clear this. As for the lifetimes of m_image and m_data, see this
@@ -367,8 +369,8 @@ void ImageResource::error(const ResourceError& error) {
// is really needed, or remove it otherwise.
setEncodedSize(0);
Resource::error(error);
- getContent()->clearImageAndNotifyObservers(
- ImageResourceContent::ShouldNotifyFinish);
+ getContent()->updateImage(
+ nullptr, ImageResourceContent::ClearImageAndNotifyObservers, true);
}
void ImageResource::responseReceived(
@@ -437,8 +439,8 @@ void ImageResource::reloadIfLoFiOrPlaceholderImage(
} else {
clearData();
setEncodedSize(0);
- getContent()->clearImageAndNotifyObservers(
- ImageResourceContent::DoNotNotifyFinish);
+ getContent()->updateImage(
+ nullptr, ImageResourceContent::ClearImageAndNotifyObservers, false);
}
setStatus(NotStarted);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698