Remove an unnecessary RefSetCache.prototype.has() call from GlobalImageCache.getData

We can simply attempt to get the data *directly*, and instead check the result, rather than first checking if it exists.
This commit is contained in:
Jonas Jenwald 2020-06-07 11:56:04 +02:00
parent 039307f88c
commit aff0d56326

View File

@ -107,11 +107,10 @@ class GlobalImageCache {
} }
getData(ref, pageIndex) { getData(ref, pageIndex) {
if (!this._refCache.has(ref)) { const pageIndexSet = this._refCache.get(ref);
if (!pageIndexSet) {
return null; return null;
} }
const pageIndexSet = this._refCache.get(ref);
if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
return null; return null;
} }