lltexturecache tinkering.
This commit is contained in:
@@ -748,14 +748,13 @@ LLTextureCache::LLTextureCache(bool threaded)
|
|||||||
mTexturesSizeTotal(0),
|
mTexturesSizeTotal(0),
|
||||||
mDoPurge(FALSE)
|
mDoPurge(FALSE)
|
||||||
{
|
{
|
||||||
purgeTextureFilesTimeSliced(true);
|
|
||||||
clearDeleteList();
|
|
||||||
writeUpdatedEntries();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTextureCache::~LLTextureCache()
|
LLTextureCache::~LLTextureCache()
|
||||||
{
|
{
|
||||||
purgeTextureFilesTimeSliced(TRUE); // VWR-3878 - NB - force-flush all pending file deletes
|
clearDeleteList();
|
||||||
|
writeUpdatedEntries();
|
||||||
|
purgeTextureFilesTimeSliced(true); // VWR-3878 - NB - force-flush all pending file deletes
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1556,7 +1555,7 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validate && mTexturesSizeTotal < sCacheMaxTexturesSize)
|
if (!validate && mTexturesSizeTotal <= sCacheMaxTexturesSize)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1569,6 +1568,8 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||||||
|
|
||||||
LLMutexLock lock(&mHeaderMutex);
|
LLMutexLock lock(&mHeaderMutex);
|
||||||
|
|
||||||
|
llinfos << "TEXTURE CACHE: Purging." << llendl;
|
||||||
|
|
||||||
// Read the entries list
|
// Read the entries list
|
||||||
std::vector<Entry> entries;
|
std::vector<Entry> entries;
|
||||||
U32 num_entries = openAndReadEntries(entries);
|
U32 num_entries = openAndReadEntries(entries);
|
||||||
@@ -1597,10 +1598,10 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LL_WARNS("TextureCache") << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL;
|
llerrs << "mTexturesSizeMap / mHeaderIDMap corrupted." << llendl ;
|
||||||
clearCorruptedCache();
|
//clearCorruptedCache();
|
||||||
LLAppViewer::instance()->resumeMainloopTimeout();
|
//LLAppViewer::instance()->resumeMainloopTimeout();
|
||||||
return;
|
//return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1652,9 +1653,10 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||||||
if (purge_entry)
|
if (purge_entry)
|
||||||
{
|
{
|
||||||
purge_count++;
|
purge_count++;
|
||||||
|
LL_DEBUGS("TextureCache") << "PURGING: " << filename << LL_ENDL;
|
||||||
mFilesToDelete.insert(std::make_pair(entries[idx].mID, filename));
|
mFilesToDelete.insert(std::make_pair(entries[idx].mID, filename));
|
||||||
cache_size -= entries[idx].mBodySize;
|
|
||||||
removeEntry(idx, entries[idx], filename, false); // remove the entry but not the file
|
removeEntry(idx, entries[idx], filename, false); // remove the entry but not the file
|
||||||
|
cache_size -= entries[idx].mBodySize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1662,26 +1664,17 @@ void LLTextureCache::purgeTextures(bool validate)
|
|||||||
|
|
||||||
writeEntriesAndClose(entries);
|
writeEntriesAndClose(entries);
|
||||||
|
|
||||||
if (purge_count > 0)
|
// *FIX:Mani - watchdog back on.
|
||||||
{
|
LLAppViewer::instance()->resumeMainloopTimeout();
|
||||||
writeEntriesAndClose(entries);
|
|
||||||
|
|
||||||
LL_INFOS("TextureCache") << "TEXTURE CACHE:"
|
|
||||||
<< " Purged: " << purge_count
|
|
||||||
<< " - Entries: " << num_entries
|
|
||||||
<< " - Cache size: " << mTexturesSizeTotal / (1024 * 1024) << " MB"
|
|
||||||
<< " - Files scheduled for deletion: " << mFilesToDelete.size()
|
|
||||||
<< LL_ENDL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LL_INFOS("TextureCache") << "TEXTURE CACHE: nothing to purge." << LL_ENDL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *FIX:Mani - watchdog back on.
|
|
||||||
LLAppViewer::instance()->resumeMainloopTimeout();
|
|
||||||
|
|
||||||
mSlicedPurgeTimer.reset();
|
mSlicedPurgeTimer.reset();
|
||||||
|
|
||||||
|
LL_INFOS("TextureCache") << "TEXTURE CACHE:"
|
||||||
|
<< " PURGED: " << purge_count
|
||||||
|
<< " ENTRIES: " << num_entries
|
||||||
|
<< " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB"
|
||||||
|
<< llendl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLTextureCache::purgeTextureFilesTimeSliced(bool force)
|
void LLTextureCache::purgeTextureFilesTimeSliced(bool force)
|
||||||
@@ -1947,8 +1940,7 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id)
|
|||||||
mTexturesSizeMap.erase(id);
|
mTexturesSizeMap.erase(id);
|
||||||
}
|
}
|
||||||
mHeaderIDMap.erase(id);
|
mHeaderIDMap.erase(id);
|
||||||
std::string filename = getTextureFileName(id);
|
LLAPRFile::remove(getTextureFileName(id));
|
||||||
LLAPRFile::remove(filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//called after mHeaderMutex is locked.
|
//called after mHeaderMutex is locked.
|
||||||
|
|||||||
Reference in New Issue
Block a user