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

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

Issue 2510883003: Loading: remove dependencies from ResourceFetcher to ImageResource (Closed)
Patch Set: rebase ResourceFetcher.cpp 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
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 bb2150f15d5a6351813a98c8ed35855f63e819ae..7c09e138ebd5b153a77c400d264775c5d0a7d68c 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -173,8 +173,8 @@ ImageResource* ImageResource::fetch(FetchRequest& request,
// If the image is a placeholder, but this fetch doesn't allow a
// placeholder, then load the original image. Note that the cache is not
// bypassed here - it should be fine to use a cached copy if possible.
- resource->reloadIfLoFiOrPlaceholder(fetcher,
- ReloadCachePolicy::UseExistingPolicy);
+ resource->reloadIfLoFiOrPlaceholderImage(
+ fetcher, kReloadAlwaysWithExistingCachePolicy);
}
return resource;
}
@@ -404,9 +404,12 @@ static bool isLoFiImage(const ImageResource& resource) {
.contains("empty-image");
}
-void ImageResource::reloadIfLoFiOrPlaceholder(
+void ImageResource::reloadIfLoFiOrPlaceholderImage(
ResourceFetcher* fetcher,
- ReloadCachePolicy reloadCachePolicy) {
+ ReloadLoFiOrPlaceholderPolicy policy) {
+ if (policy == kReloadIfNeeded && !shouldReloadBrokenPlaceholder())
+ return;
+
if (!m_isPlaceholder && !isLoFiImage(*this))
return;
@@ -417,7 +420,7 @@ void ImageResource::reloadIfLoFiOrPlaceholder(
DCHECK(!m_isSchedulingReload);
m_isSchedulingReload = true;
- if (reloadCachePolicy == ReloadCachePolicy::BypassCache)
+ if (policy != kReloadAlwaysWithExistingCachePolicy)
setCachePolicyBypassingCache();
setLoFiStateOff();
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698