mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 00:26:10 +03:00
Do not spit out warns on invalid tile unload (preemtive working cache deletion), do not ignore working cache even if __restore=true.
This commit is contained in:
parent
b3cdeabf02
commit
68f0ed8901
@ -539,7 +539,7 @@ $.Tile.prototype = {
|
||||
*/
|
||||
setData: function(value, type) {
|
||||
if (!this.tiledImage) {
|
||||
return null; //async context can access the tile outside its lifetime
|
||||
return Promise.resolve(); //async context can access the tile outside its lifetime
|
||||
}
|
||||
|
||||
let cache = this.getCache(this._wcKey);
|
||||
@ -594,7 +594,8 @@ $.Tile.prototype = {
|
||||
//TODO IMPLEMENT LOCKING AND IGNORE PIPELINE OUT OF THESE CALLS
|
||||
|
||||
// Now, if working cache exists, we set main cache to the working cache, since it has been updated
|
||||
const cache = !requestedRestore && this.getCache(this._wcKey);
|
||||
// if restore() was called last, then working cache was deleted (does not exist)
|
||||
const cache = this.getCache(this._wcKey);
|
||||
if (cache) {
|
||||
let newCacheKey = this.cacheKey === this.originalCacheKey ? "mod://" + this.originalCacheKey : this.cacheKey;
|
||||
this.tiledImage._tileCache.consumeCache({
|
||||
@ -745,7 +746,7 @@ $.Tile.prototype = {
|
||||
removeCache: function(key, freeIfUnused = true) {
|
||||
if (!this._caches[key]) {
|
||||
// try to erase anyway in case the cache got stuck in memory
|
||||
this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused);
|
||||
this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -771,7 +772,7 @@ $.Tile.prototype = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused)) {
|
||||
if (this.tiledImage._tileCache.unloadCacheForTile(this, key, freeIfUnused, false)) {
|
||||
//if we managed to free tile from record, we are sure we decreased cache count
|
||||
delete this._caches[key];
|
||||
}
|
||||
|
@ -186,8 +186,8 @@
|
||||
let internalCache = this[DRAWER_INTERNAL_CACHE];
|
||||
internalCache = internalCache && internalCache[drawer.getId()];
|
||||
if (keepInternalCopy && !internalCache) {
|
||||
$.console.warn("Attempt to render tile that is not prepared with drawer requesting " +
|
||||
"internal cache! This might introduce artifacts.");
|
||||
$.console.warn("Attempt to render tile cache %s that is not prepared with drawer requesting " +
|
||||
"internal cache! This might introduce artifacts.", this);
|
||||
|
||||
this.prepareForRendering(drawer.getId(), supportedTypes, keepInternalCopy)
|
||||
.then(() => this._triggerNeedsDraw());
|
||||
@ -207,8 +207,8 @@
|
||||
}
|
||||
|
||||
if (!supportedTypes.includes(internalCache.type)) {
|
||||
$.console.warn("Attempt to render tile that is not prepared for current drawer supported format: " +
|
||||
"the preparation should've happened after tile processing has finished.");
|
||||
$.console.warn("Attempt to render tile cache %s that is not prepared for current drawer " +
|
||||
"supported format: the preparation should've happened after tile processing has finished.", this);
|
||||
|
||||
internalCache.transformTo(supportedTypes.length > 1 ? supportedTypes : supportedTypes[0])
|
||||
.then(() => this._triggerNeedsDraw());
|
||||
@ -1096,9 +1096,10 @@
|
||||
* @param {OpenSeadragon.Tile} tile
|
||||
* @param {string} key cache key
|
||||
* @param {boolean} destroy if true, empty cache is destroyed, else left as a zombie
|
||||
* @param {boolean} okIfNotExists sometimes we call destruction just to make sure, if true do not report as error
|
||||
* @private
|
||||
*/
|
||||
unloadCacheForTile(tile, key, destroy) {
|
||||
unloadCacheForTile(tile, key, destroy, okIfNotExists) {
|
||||
const cacheRecord = this._cachesLoaded[key];
|
||||
//unload record only if relevant - the tile exists in the record
|
||||
if (cacheRecord) {
|
||||
@ -1122,7 +1123,9 @@
|
||||
"does not belong to! This could mean a bug in the cache system.");
|
||||
return false;
|
||||
}
|
||||
$.console.warn("[TileCache.unloadCacheForTile] Attempting to delete missing cache!");
|
||||
if (!okIfNotExists) {
|
||||
$.console.warn("[TileCache.unloadCacheForTile] Attempting to delete missing cache!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -79,10 +79,5 @@
|
||||
</section>
|
||||
|
||||
<script src="demo.js"></script>
|
||||
|
||||
<!-- Google analytics -->
|
||||
<script async type="text/javascript" id="_fed_an_ua_tag" src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=NIST&subagency=github&pua=UA-66610693-1&yt=true&exts=ppsx,pps,f90,sch,rtf,wrl,txz,m1v,xlsm,msi,xsd,f,tif,eps,mpg,xml,pl,xlt,c">
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user