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

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index 67abfc4a4ef71e2e5d06b0d7d1415ca037439650..a29be2ffa4ab1b027af47789b9ba102424349b11 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -367,7 +367,9 @@ void ImageResource::updateImage(bool allDataReceived)
// to decode.
if (sizeAvailable || allDataReceived) {
if (!m_image || m_image->isNull()) {
- error(errorOccurred() ? getStatus() : DecodeError);
+ if (!errorOccurred())
+ setStatus(DecodeError);
+ clear();
hiroshige 2016/05/02 07:31:23 checkNotify() and markClientsAndObserversFinished(
Nate Chapin 2016/05/02 19:32:24 I think this just means that ResourceLoader will k
yhirano 2016/05/06 10:06:03 Is it desirable to cancel loading in such a case?
if (memoryCache()->contains(this))
memoryCache()->remove(this);
return;
@@ -379,7 +381,7 @@ void ImageResource::updateImage(bool allDataReceived)
}
}
-void ImageResource::finish()
+void ImageResource::finish(double loadFinishTime)
{
if (m_multipartParser) {
m_multipartParser->finish();
@@ -391,15 +393,15 @@ void ImageResource::finish()
} else {
updateImage(true);
}
- Resource::finish();
+ Resource::finish(loadFinishTime);
}
-void ImageResource::error(Resource::Status status)
+void ImageResource::error(const ResourceError& error)
{
if (m_multipartParser)
m_multipartParser->cancel();
clear();
- Resource::error(status);
+ Resource::error(error);
notifyObservers();
}
@@ -498,7 +500,13 @@ void ImageResource::reloadIfLoFi(ResourceFetcher* fetcher)
return;
m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache);
m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff);
- error(Resource::LoadError);
+ if (isLoading()) {
Nate Chapin 2016/04/28 18:10:27 I'm not sure if this more complicated if/else bloc
hiroshige 2016/05/02 07:31:23 In this case, Resource::error() is called via Reso
Nate Chapin 2016/05/02 19:32:24 Correct.
+ m_loader->cancel();
+ } else {
+ clear();
+ m_data.clear();
+ notifyObservers();
Nate Chapin 2016/04/28 18:10:27 I'm not 100% all of these are necessary, but it em
hiroshige 2016/05/02 07:31:23 This CL seems to split "something" from error(), a
Nate Chapin 2016/05/02 19:32:24 Ok, I modified this block slightly and pulled it o
+ }
setStatus(NotStarted);
load(fetcher);
}

Powered by Google App Engine
This is Rietveld 408576698