Bug 1254663 - Process too-small downloaded icons to avoid multiple downloads r?sebastian
MozReview-Commit-ID: A9L9R0NwV1o
--- a/mobile/android/base/java/org/mozilla/gecko/icons/IconTask.java
+++ b/mobile/android/base/java/org/mozilla/gecko/icons/IconTask.java
@@ -130,21 +130,26 @@ import java.util.concurrent.Callable;
logLoader(request, loader, response);
if (response != null) {
// Ignore icons that are less than 2/3 the requested size: we fallback
// to generated icons in this case. We want to do this here since the smaller
// icon may already be in memory, in which case we can skip directly to generated
// icons.
-
- // TODO: we should still store this smaller icon in memory / process it for those
- // requests where it is useful?
if (request.ignoreSmallIcons &&
response.getBitmap().getWidth() < 2 * request.targetSize / 3) {
+
+ // Process the loaded icon to ensure that the icon is cached: the first load
+ // will download the icon: if we don't store the icon on disk / in-memory,
+ // then we will end up downloading the same (too-small) icon every time
+ // an icon is requested, unless we put it in local storage first.
+ // Our response will be discarded (and the generated response returned instead),
+ // hence we don't need to care about any changes any of the processors might make.
+ processIcon(request, response);
break;
}
return response;
}
}
request.moveToNextIcon();