mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:16:51 +02:00
Add sanity check to ResourceCache::updateTotalSize
This commit is contained in:
parent
cba5bff89e
commit
2fd88d9fe1
2 changed files with 6 additions and 1 deletions
|
@ -424,6 +424,11 @@ void ResourceCache::removeResource(const QUrl& url, qint64 size) {
|
||||||
|
|
||||||
void ResourceCache::updateTotalSize(const qint64& deltaSize) {
|
void ResourceCache::updateTotalSize(const qint64& deltaSize) {
|
||||||
_totalResourcesSize += deltaSize;
|
_totalResourcesSize += deltaSize;
|
||||||
|
|
||||||
|
// Sanity checks
|
||||||
|
assert(_totalResourcesSize >= 0);
|
||||||
|
assert(_totalResourcesSize < (1024 * BYTES_PER_GIGABYTES));
|
||||||
|
|
||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ static const qint64 DEFAULT_UNUSED_MAX_SIZE = 100 * BYTES_PER_MEGABYTES;
|
||||||
static const qint64 DEFAULT_UNUSED_MAX_SIZE = 1024 * BYTES_PER_MEGABYTES;
|
static const qint64 DEFAULT_UNUSED_MAX_SIZE = 1024 * BYTES_PER_MEGABYTES;
|
||||||
#endif
|
#endif
|
||||||
static const qint64 MIN_UNUSED_MAX_SIZE = 0;
|
static const qint64 MIN_UNUSED_MAX_SIZE = 0;
|
||||||
static const qint64 MAX_UNUSED_MAX_SIZE = 10 * BYTES_PER_GIGABYTES;
|
static const qint64 MAX_UNUSED_MAX_SIZE = MAXIMUM_CACHE_SIZE;
|
||||||
|
|
||||||
// We need to make sure that these items are available for all instances of
|
// We need to make sure that these items are available for all instances of
|
||||||
// ResourceCache derived classes. Since we can't count on the ordering of
|
// ResourceCache derived classes. Since we can't count on the ordering of
|
||||||
|
|
Loading…
Reference in a new issue