From 52e8b2a1a279e13a39a95b32a301780998b8d8c4 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 28 May 2013 18:25:12 -0600 Subject: for SH-4004: interesting: need debug option to clear viewer cache while still logged in --- indra/newview/lltexturecache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 305f6fca0f..f03cc22949 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -919,7 +919,7 @@ void LLTextureCache::setDirNames(ELLPath location) mFastCacheFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, fast_cache_filename); } -void LLTextureCache::purgeCache(ELLPath location) +void LLTextureCache::purgeCache(ELLPath location, bool remove_dir) { LLMutexLock lock(&mHeaderMutex); @@ -945,7 +945,7 @@ void LLTextureCache::purgeCache(ELLPath location) } //remove the current texture cache. - purgeAllTextures(true); + purgeAllTextures(remove_dir); } //is called in the main thread before initCache(...) is called. -- cgit v1.2.3 From e340009fc59d59e59b2e8d903a884acb76b178eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 17:11:19 -0700 Subject: second phase summer cleaning replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc. --- indra/newview/lltexturecache.cpp | 70 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index ee3b605cb0..79cc66fda5 100755 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -191,7 +191,7 @@ bool LLTextureCacheLocalFileWorker::doRead() if (mImageFormat == IMG_CODEC_INVALID) { -// llwarns << "Unrecognized file extension " << extension << " for local texture " << mFileName << llendl; +// LL_WARNS() << "Unrecognized file extension " << extension << " for local texture " << mFileName << LL_ENDL; mDataSize = 0; // no data return true; } @@ -232,9 +232,9 @@ bool LLTextureCacheLocalFileWorker::doRead() { if (mBytesRead != mBytesToRead) { -// llwarns << "Error reading file from local cache: " << local_filename +// LL_WARNS() << "Error reading file from local cache: " << local_filename // << " Bytes: " << mDataSize << " Offset: " << mOffset -// << " / " << mDataSize << llendl; +// << " / " << mDataSize << LL_ENDL; mDataSize = 0; // failed FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; @@ -257,9 +257,9 @@ bool LLTextureCacheLocalFileWorker::doRead() if (bytes_read != mDataSize) { -// llwarns << "Error reading file from local cache: " << mFileName +// LL_WARNS() << "Error reading file from local cache: " << mFileName // << " Bytes: " << mDataSize << " Offset: " << mOffset -// << " / " << mDataSize << llendl; +// << " / " << mDataSize << LL_ENDL; mDataSize = 0; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; @@ -390,16 +390,16 @@ bool LLTextureCacheRemoteWorker::doRead() mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool()); if (bytes_read != mDataSize) { - llwarns << "Error reading file from local cache: " << local_filename + LL_WARNS() << "Error reading file from local cache: " << local_filename << " Bytes: " << mDataSize << " Offset: " << mOffset - << " / " << mDataSize << llendl; + << " / " << mDataSize << LL_ENDL; mDataSize = 0; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } else { - //llinfos << "texture " << mID.asString() << " found in local_assets" << llendl; + //LL_INFOS() << "texture " << mID.asString() << " found in local_assets" << LL_ENDL; mImageSize = local_size; mImageLocal = TRUE; } @@ -442,9 +442,9 @@ bool LLTextureCacheRemoteWorker::doRead() mReadData, offset, size, mCache->getLocalAPRFilePool()); if (bytes_read != size) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from header: " << bytes_read - << " / " << size << llendl; + << " / " << size << LL_ENDL; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed @@ -511,9 +511,9 @@ bool LLTextureCacheRemoteWorker::doRead() mCache->getLocalAPRFilePool()); if (bytes_read != file_size) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from body: " << bytes_read - << " / " << file_size << llendl; + << " / " << file_size << LL_ENDL; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed @@ -524,7 +524,7 @@ bool LLTextureCacheRemoteWorker::doRead() { // No body, we're done. mDataSize = llmax(TEXTURE_CACHE_ENTRY_SIZE - mOffset, 0); - lldebugs << "No body file for: " << filename << llendl; + LL_DEBUGS() << "No body file for: " << filename << LL_ENDL; } // Nothing else to do at that point... done = true; @@ -582,8 +582,8 @@ bool LLTextureCacheRemoteWorker::doWrite() if (idx < 0) { - llwarns << "LLTextureCacheWorker: " << mID - << " Unable to create header entry for writing!" << llendl; + LL_WARNS() << "LLTextureCacheWorker: " << mID + << " Unable to create header entry for writing!" << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -628,8 +628,8 @@ bool LLTextureCacheRemoteWorker::doWrite() if (bytes_written <= 0) { - llwarns << "LLTextureCacheWorker: " << mID - << " Unable to write header entry!" << llendl; + LL_WARNS() << "LLTextureCacheWorker: " << mID + << " Unable to write header entry!" << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -655,16 +655,16 @@ bool LLTextureCacheRemoteWorker::doWrite() { // build the cache file name from the UUID std::string filename = mCache->getTextureFileName(mID); -// llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl; +// LL_INFOS() << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << LL_ENDL; S32 bytes_written = LLAPRFile::writeEx( filename, mWriteData + TEXTURE_CACHE_ENTRY_SIZE, 0, file_size, mCache->getLocalAPRFilePool()); if (bytes_written <= 0) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes written to body: " << bytes_written - << " / " << file_size << llendl; + << " / " << file_size << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -1135,7 +1135,7 @@ S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create } if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why { - llwarns << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << llendl ; + LL_WARNS() << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << LL_ENDL ; //erase this entry and the cached texture from the cache. std::string tex_filename = getTextureFileName(id); @@ -1303,13 +1303,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector& entries) S32 bytes_read = aprfile->read((void*)(&entry), (S32)sizeof(Entry)); if (bytes_read < sizeof(Entry)) { - llwarns << "Corrupted header entries, failed at " << idx << " / " << num_entries << llendl; + LL_WARNS() << "Corrupted header entries, failed at " << idx << " / " << num_entries << LL_ENDL; closeHeaderEntriesFile(); purgeAllTextures(false); return 0; } entries.push_back(entry); -// llinfos << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << llendl; +// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL; if(entry.mImageSize > entry.mBodySize) { mHeaderIDMap[entry.mID] = idx; @@ -1439,7 +1439,7 @@ void LLTextureCache::readHeaderCache() if (entry.mBodySize > entry.mImageSize) { // Shouldn't happen, failsafe only - llwarns << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << llendl; + LL_WARNS() << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << LL_ENDL; purge_list.insert(i); } } @@ -1450,7 +1450,7 @@ void LLTextureCache::readHeaderCache() // Special case: cache size was reduced, need to remove entries // Note: After we prune entries, we will call this again and create the LRU U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries; - llinfos << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << llendl; + LL_INFOS() << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << LL_ENDL; // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have: // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge // So, it's certain that iter will never reach lru.end() first. @@ -1467,7 +1467,7 @@ void LLTextureCache::readHeaderCache() for (std::set::iterator iter = lru.begin(); iter != lru.end(); ++iter) { mLRU.insert(entries[iter->second].mID); -// llinfos << "LRU: " << iter->first << " : " << iter->second << llendl; +// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL; if (--lru_entries <= 0) break; } @@ -1513,7 +1513,7 @@ void LLTextureCache::readHeaderCache() //the header mutex is locked before calling this. void LLTextureCache::clearCorruptedCache() { - llwarns << "the texture cache is corrupted, need to be cleared." << llendl ; + LL_WARNS() << "the texture cache is corrupted, need to be cleared." << LL_ENDL ; closeHeaderEntriesFile();//close possible file handler purgeAllTextures(false) ; //clear the cache. @@ -1543,7 +1543,7 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + delem + subdirs[i]; - llinfos << "Deleting files in directory: " << dirname << llendl; + LL_INFOS() << "Deleting files in directory: " << dirname << LL_ENDL; gDirUtilp->deleteFilesInDir(dirname, mask); if (purge_directories) { @@ -1568,7 +1568,7 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) mHeaderEntriesInfo.mEntries = 0; writeEntriesHeader(); - llinfos << "The entire texture cache is cleared." << llendl ; + LL_INFOS() << "The entire texture cache is cleared." << LL_ENDL ; } void LLTextureCache::purgeTextures(bool validate) @@ -1586,7 +1586,7 @@ void LLTextureCache::purgeTextures(bool validate) LLMutexLock lock(&mHeaderMutex); - llinfos << "TEXTURE CACHE: Purging." << llendl; + LL_INFOS() << "TEXTURE CACHE: Purging." << LL_ENDL; // Read the entries list std::vector entries; @@ -1609,11 +1609,11 @@ void LLTextureCache::purgeTextures(bool validate) { S32 idx = iter2->second; time_idx_set.insert(std::make_pair(entries[idx].mTime, idx)); -// llinfos << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << llendl; +// LL_INFOS() << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << LL_ENDL; } else { - llerrs << "mTexturesSizeMap / mHeaderIDMap corrupted." << llendl ; + LL_ERRS() << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL ; } } } @@ -1682,7 +1682,7 @@ void LLTextureCache::purgeTextures(bool validate) << " PURGED: " << purge_count << " ENTRIES: " << num_entries << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB" - << llendl; + << LL_ENDL; } ////////////////////////////////////////////////////////////////////////////// @@ -1900,7 +1900,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer raw, S32 dis //rescale image if needed if (raw.isNull() || !raw->getData()) { - llerrs << "Attempted to write NULL raw image to fastcache" << llendl; + LL_ERRS() << "Attempted to write NULL raw image to fastcache" << LL_ENDL; return false; } @@ -2091,7 +2091,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) bool LLTextureCache::removeFromCache(const LLUUID& id) { - //llwarns << "Removing texture from cache: " << id << llendl; + //LL_WARNS() << "Removing texture from cache: " << id << LL_ENDL; bool ret = false ; if (!mReadOnly) { -- cgit v1.2.3