mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Track resources as they fall out of cache
This commit is contained in:
parent
07f734f4dd
commit
e20acb1d42
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) {
|
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) {
|
if (resource->getBytes() == 0 || resource->getBytes() > _unusedResourcesMaxSize) {
|
||||||
resource->setCache(nullptr);
|
resource->setCache(nullptr);
|
||||||
|
|
||||||
|
_totalResourcesSize -= resource->getBytes();
|
||||||
|
_resources.remove(resource->getURL());
|
||||||
|
resetResourceCounters();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reserveUnusedResource(resource->getBytes());
|
reserveUnusedResource(resource->getBytes());
|
||||||
|
|
Loading…
Reference in a new issue