mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Merge pull request #7661 from zzmp/fix/track-resources
Track resources as they fall out of cache
This commit is contained in:
commit
dd4589269d
1 changed files with 6 additions and 1 deletions
|
@ -137,9 +137,14 @@ void ResourceCache::setUnusedResourceCacheSize(qint64 unusedResourcesMaxSize) {
|
|||
}
|
||||
|
||||
void ResourceCache::addUnusedResource(const QSharedPointer<Resource>& resource) {
|
||||
// If it doesn't fit or its size is unknown, leave the cache alone.
|
||||
// If it doesn't fit or its size is unknown, remove it from the cache.
|
||||
if (resource->getBytes() == 0 || resource->getBytes() > _unusedResourcesMaxSize) {
|
||||
resource->setCache(nullptr);
|
||||
|
||||
_totalResourcesSize -= resource->getBytes();
|
||||
_resources.remove(resource->getURL());
|
||||
resetResourceCounters();
|
||||
|
||||
return;
|
||||
}
|
||||
reserveUnusedResource(resource->getBytes());
|
||||
|
|
Loading…
Reference in a new issue