#include <lltexturecache.h>
Definition at line 44 of file lltexturecache.h.
typedef std::map<handle_t, LLTextureCacheWorker*> LLTextureCache::handle_map_t [private] |
Definition at line 134 of file lltexturecache.h.
typedef std::vector<handle_t> LLTextureCache::handle_list_t [private] |
Definition at line 138 of file lltexturecache.h.
typedef std::vector<std::pair<LLPointer<Responder>, bool> > LLTextureCache::responder_list_t [private] |
Definition at line 141 of file lltexturecache.h.
typedef std::map<S32,LLUUID> LLTextureCache::index_map_t [private] |
Definition at line 165 of file lltexturecache.h.
typedef std::map<LLUUID,S32> LLTextureCache::id_map_t [private] |
Definition at line 167 of file lltexturecache.h.
typedef std::map<LLUUID,S32> LLTextureCache::size_map_t [private] |
Definition at line 173 of file lltexturecache.h.
LLTextureCache::LLTextureCache | ( | bool | threaded | ) |
LLTextureCache::~LLTextureCache | ( | ) |
Reimplemented from LLWorkerThread.
Definition at line 887 of file lltexturecache.cpp.
References LLResponder::completed(), indra::ipc::xml_rpc::handle(), LLMutex::lock(), lockWorkers(), mCompletedList, mListMutex, mPrioritizeWriteList, LLTextureCacheWorker::mPriority, mWriters, LLQueuedThread::PRIORITY_HIGH, S32, LLWorkerClass::setPriority(), LLMutex::unlock(), unlockWorkers(), and LLWorkerThread::update().
Referenced by LLAppViewer::cleanup(), LLViewerImageList::decodeAllImages(), LLAppViewer::mainLoop(), and update_texture_fetch().
void LLTextureCache::purgeCache | ( | ELLPath | location | ) |
Definition at line 999 of file lltexturecache.cpp.
References ll_apr_file_remove(), mHeaderDataFileName, mHeaderEntriesFileName, mReadOnly, NULL, purgeAllTextures(), and setDirNames().
Referenced by LLAppViewer::purgeCache().
Definition at line 1011 of file lltexturecache.cpp.
References gDirUtilp, LLDir::getDirDelimiter(), i, LL_ENDL, LL_INFOS, llmin(), LLFile::mkdir(), mReadOnly, mTexturesDirName, purgeTextures(), readHeaderCache(), S32, sCacheMaxEntries, sCacheMaxTexturesSize, setDirNames(), and TEXTURE_CACHE_ENTRY_SIZE.
Referenced by LLAppViewer::initCache().
LLTextureCache::handle_t LLTextureCache::readFromCache | ( | const LLString & | local_filename, | |
const LLUUID & | id, | |||
U32 | priority, | |||
S32 | offset, | |||
S32 | size, | |||
ReadResponder * | responder | |||
) |
Definition at line 1388 of file lltexturecache.cpp.
References indra::ipc::xml_rpc::handle(), LLTextureCacheLocalFileWorker, mReaders, mWorkersMutex, NULL, and LLTextureCacheWorker::read().
Referenced by LLTextureFetchWorker::doWork().
LLTextureCache::handle_t LLTextureCache::readFromCache | ( | const LLUUID & | id, | |
U32 | priority, | |||
S32 | offset, | |||
S32 | size, | |||
ReadResponder * | responder | |||
) |
Definition at line 1402 of file lltexturecache.cpp.
References indra::ipc::xml_rpc::handle(), LLTextureCacheRemoteWorker, mReaders, mWorkersMutex, NULL, and LLTextureCacheWorker::read().
bool LLTextureCache::readComplete | ( | handle_t | handle, | |
bool | abort | |||
) |
Definition at line 1417 of file lltexturecache.cpp.
References llassert_always, lockWorkers(), mReaders, and unlockWorkers().
Referenced by LLTextureFetchWorker::deleteOK(), LLTextureFetchWorker::doWork(), LLTextureFetchWorker::finishWork(), and LLTextureFetchWorker::~LLTextureFetchWorker().
LLTextureCache::handle_t LLTextureCache::writeToCache | ( | const LLUUID & | id, | |
U32 | priority, | |||
U8 * | data, | |||
S32 | datasize, | |||
S32 | imagesize, | |||
WriteResponder * | responder | |||
) |
Definition at line 1438 of file lltexturecache.cpp.
References FALSE, indra::ipc::xml_rpc::handle(), llassert_always, LLTextureCacheRemoteWorker, mDoPurge, mReadOnly, mWorkersMutex, mWriters, LLQueuedThread::nullHandle(), purgeTextures(), TEXTURE_CACHE_ENTRY_SIZE, and LLTextureCacheWorker::write().
Referenced by LLTextureFetchWorker::doWork().
bool LLTextureCache::writeComplete | ( | handle_t | handle, | |
bool | abort = false | |||
) |
Definition at line 1470 of file lltexturecache.cpp.
References llassert_always, lockWorkers(), mWriters, and unlockWorkers().
Referenced by LLTextureFetchWorker::deleteOK(), LLTextureFetchWorker::finishWork(), LLTextureFetchWorker::writeToCacheComplete(), and LLTextureFetchWorker::~LLTextureFetchWorker().
void LLTextureCache::prioritizeWrite | ( | handle_t | handle | ) |
Definition at line 1490 of file lltexturecache.cpp.
References mListMutex, and mPrioritizeWriteList.
Referenced by LLTextureFetchWorker::doWork().
void LLTextureCache::removeFromCache | ( | const LLUUID & | id | ) |
Definition at line 1535 of file lltexturecache.cpp.
References getTextureFileName(), ll_apr_file_remove(), llendl, llwarns, mReadOnly, NULL, and removeHeaderCacheEntry().
Referenced by LLTextureCacheWorker::endWork(), and LLTextureFetchWorker::removeFromCache().
LLTextureCacheWorker * LLTextureCache::getReader | ( | handle_t | handle | ) |
Definition at line 1289 of file lltexturecache.cpp.
References mReaders, and NULL.
Referenced by LLTextureCacheWorker::ReadResponder::completed().
LLTextureCacheWorker * LLTextureCache::getWriter | ( | handle_t | handle | ) |
Definition at line 1300 of file lltexturecache.cpp.
References mWriters, and NULL.
Referenced by LLTextureCacheWorker::WriteResponder::completed().
void LLTextureCache::lockWorkers | ( | ) | [inline] |
Definition at line 102 of file lltexturecache.h.
References LLMutex::lock(), and mWorkersMutex.
Referenced by LLTextureCacheWorker::WriteResponder::completed(), LLTextureCacheWorker::ReadResponder::completed(), readComplete(), update(), and writeComplete().
void LLTextureCache::unlockWorkers | ( | ) | [inline] |
Definition at line 103 of file lltexturecache.h.
References mWorkersMutex, and LLMutex::unlock().
Referenced by LLTextureCacheWorker::WriteResponder::completed(), LLTextureCacheWorker::ReadResponder::completed(), readComplete(), update(), and writeComplete().
S32 LLTextureCache::getNumReads | ( | ) | [inline] |
Definition at line 106 of file lltexturecache.h.
References mReaders.
Referenced by LLGLTexMemBar::draw().
S32 LLTextureCache::getNumWrites | ( | ) | [inline] |
Definition at line 107 of file lltexturecache.h.
References mWriters.
Referenced by LLGLTexMemBar::draw().
apr_pool_t* LLTextureCache::getFileAPRPool | ( | ) | [inline, protected] |
Definition at line 111 of file lltexturecache.h.
References mFileAPRPool.
Referenced by appendToTextureEntryList(), LLTextureCacheRemoteWorker::doRead(), LLTextureCacheLocalFileWorker::doRead(), LLTextureCacheRemoteWorker::doWrite(), and getHeaderCacheEntry().
Definition at line 944 of file lltexturecache.cpp.
References getFileAPRPool(), ll_apr_file_write_ex(), llassert_always, mDoPurge, mHeaderMutex, mTexturesDirEntriesFileName, mTexturesSizeMap, mTexturesSizeTotal, NULL, sCacheMaxTexturesSize, and TRUE.
Referenced by LLTextureCacheRemoteWorker::doWrite().
std::string LLTextureCache::getLocalFileName | ( | const LLUUID & | id | ) | [protected] |
Definition at line 928 of file lltexturecache.cpp.
References gDirUtilp, LLDir::getExpandedFilename(), and LL_PATH_SKINS.
Referenced by LLTextureCacheRemoteWorker::doRead().
std::string LLTextureCache::getTextureFileName | ( | const LLUUID & | id | ) | [protected] |
Definition at line 936 of file lltexturecache.cpp.
References gDirUtilp, LLDir::getDirDelimiter(), and mTexturesDirName.
Referenced by LLTextureCacheRemoteWorker::doRead(), LLTextureCacheRemoteWorker::doWrite(), purgeTextures(), and removeFromCache().
void LLTextureCache::addCompleted | ( | Responder * | responder, | |
bool | success | |||
) | [protected] |
Definition at line 1498 of file lltexturecache.cpp.
References mCompletedList, and mListMutex.
Referenced by LLTextureCacheWorker::finishWork().
void LLTextureCache::setDirNames | ( | ELLPath | location | ) | [private] |
Definition at line 990 of file lltexturecache.cpp.
References cache_filename, entries_filename, gDirUtilp, LLDir::getDirDelimiter(), LLDir::getExpandedFilename(), mHeaderDataFileName, mHeaderEntriesFileName, mTexturesDirEntriesFileName, mTexturesDirName, and textures_dirname.
Referenced by initCache(), and purgeCache().
void LLTextureCache::readHeaderCache | ( | apr_pool_t * | poolp = NULL |
) | [private] |
Definition at line 1070 of file lltexturecache.cpp.
References i, lru_data::index, ll_apr_file_exists(), ll_apr_file_read_ex(), ll_apr_file_write_ex(), LLTextureCache::EntriesInfo::mEntries, mHeaderEntriesFileName, mHeaderEntriesInfo, mHeaderIDMap, mHeaderMutex, mLRU, mReadOnly, mSize, LLTextureCache::EntriesInfo::mVersion, S32, sCacheMaxEntries, sHeaderCacheVersion, and lru_data::uuid.
Referenced by getHeaderCacheEntry(), and initCache().
void LLTextureCache::purgeAllTextures | ( | bool | purge_directories | ) | [private] |
Definition at line 1126 of file lltexturecache.cpp.
References LLDir::deleteFilesInDir(), gDirUtilp, LLDir::getDirDelimiter(), i, ll_apr_file_remove(), mReadOnly, mTexturesDirEntriesFileName, mTexturesDirName, mTexturesSizeMap, NULL, LLFile::rmdir(), and S32.
Referenced by purgeCache(), and purgeTextures().
void LLTextureCache::purgeTextures | ( | bool | validate | ) | [private] |
Definition at line 1151 of file lltexturecache.cpp.
References getTextureFileName(), LLControlGroup::getU32(), gSavedSettings, ll_apr_file_read_ex(), ll_apr_file_remove(), ll_apr_file_size(), ll_apr_file_write_ex(), LL_DEBUGS, LL_ENDL, LL_INFOS, LL_WARNS, llassert, llendl, mHeaderMutex, mReadOnly, mSize, mTexturesDirEntriesFileName, mTexturesSizeMap, mTexturesSizeTotal, NULL, purgeAllTextures(), S32, sCacheMaxTexturesSize, and LLControlGroup::setU32().
Referenced by initCache(), and writeToCache().
S32 LLTextureCache::getHeaderCacheEntry | ( | const LLUUID & | id, | |
bool | touch, | |||
S32 * | imagesize = NULL | |||
) | [private] |
Definition at line 1314 of file lltexturecache.cpp.
References getFileAPRPool(), ll_apr_file_read_ex(), ll_apr_file_write_ex(), llassert_always, LLTextureCache::EntriesInfo::mEntries, mHeaderEntriesFileName, mHeaderEntriesInfo, mHeaderIDMap, mHeaderMutex, mLRU, mReadOnly, mTexturesSizeMap, NULL, readHeaderCache(), S32, and sCacheMaxEntries.
Referenced by LLTextureCacheRemoteWorker::doRead(), and LLTextureCacheRemoteWorker::doWrite().
bool LLTextureCache::removeHeaderCacheEntry | ( | const LLUUID & | id | ) | [private] |
Definition at line 1508 of file lltexturecache.cpp.
References ll_apr_file_write_ex(), mHeaderEntriesFileName, mHeaderIDMap, mHeaderMutex, mLRU, mReadOnly, mTexturesSizeMap, NULL, and S32.
Referenced by removeFromCache().
void LLTextureCache::lockHeaders | ( | ) | [inline, private] |
Definition at line 124 of file lltexturecache.h.
References LLMutex::lock(), and mHeaderMutex.
void LLTextureCache::unlockHeaders | ( | ) | [inline, private] |
Definition at line 125 of file lltexturecache.h.
References mHeaderMutex, and LLMutex::unlock().
friend class LLTextureCacheWorker [friend] |
Definition at line 46 of file lltexturecache.h.
friend class LLTextureCacheRemoteWorker [friend] |
friend class LLTextureCacheLocalFileWorker [friend] |
LLMutex LLTextureCache::mWorkersMutex [private] |
Definition at line 129 of file lltexturecache.h.
Referenced by lockWorkers(), readFromCache(), unlockWorkers(), and writeToCache().
LLMutex LLTextureCache::mHeaderMutex [private] |
Definition at line 130 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), getHeaderCacheEntry(), lockHeaders(), purgeTextures(), readHeaderCache(), removeHeaderCacheEntry(), and unlockHeaders().
LLMutex LLTextureCache::mListMutex [private] |
Definition at line 131 of file lltexturecache.h.
Referenced by addCompleted(), prioritizeWrite(), and update().
apr_pool_t* LLTextureCache::mFileAPRPool [private] |
Definition at line 132 of file lltexturecache.h.
Referenced by getFileAPRPool(), LLTextureCache(), and ~LLTextureCache().
handle_map_t LLTextureCache::mReaders [private] |
Definition at line 135 of file lltexturecache.h.
Referenced by getNumReads(), getReader(), readComplete(), and readFromCache().
handle_map_t LLTextureCache::mWriters [private] |
Definition at line 136 of file lltexturecache.h.
Referenced by getNumWrites(), getWriter(), update(), writeComplete(), and writeToCache().
BOOL LLTextureCache::mReadOnly [private] |
Definition at line 144 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), initCache(), purgeAllTextures(), purgeCache(), purgeTextures(), readHeaderCache(), removeFromCache(), removeHeaderCacheEntry(), and writeToCache().
std::string LLTextureCache::mHeaderEntriesFileName [private] |
Definition at line 162 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), purgeCache(), readHeaderCache(), removeHeaderCacheEntry(), and setDirNames().
std::string LLTextureCache::mHeaderDataFileName [private] |
Definition at line 163 of file lltexturecache.h.
Referenced by LLTextureCacheRemoteWorker::doRead(), LLTextureCacheRemoteWorker::doWrite(), purgeCache(), and setDirNames().
Definition at line 164 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), and readHeaderCache().
index_map_t LLTextureCache::mLRU [private] |
Definition at line 166 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), readHeaderCache(), and removeHeaderCacheEntry().
id_map_t LLTextureCache::mHeaderIDMap [private] |
Definition at line 168 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), readHeaderCache(), and removeHeaderCacheEntry().
std::string LLTextureCache::mTexturesDirName [private] |
Definition at line 171 of file lltexturecache.h.
Referenced by getTextureFileName(), initCache(), purgeAllTextures(), and setDirNames().
std::string LLTextureCache::mTexturesDirEntriesFileName [private] |
Definition at line 172 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), purgeAllTextures(), purgeTextures(), and setDirNames().
size_map_t LLTextureCache::mTexturesSizeMap [private] |
Definition at line 174 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), getHeaderCacheEntry(), purgeAllTextures(), purgeTextures(), and removeHeaderCacheEntry().
S64 LLTextureCache::mTexturesSizeTotal [private] |
Definition at line 175 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), and purgeTextures().
LLAtomic32<BOOL> LLTextureCache::mDoPurge [private] |
Definition at line 176 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), and writeToCache().
F32 LLTextureCache::sHeaderCacheVersion = 1.0f [static, private] |
U32 LLTextureCache::sCacheMaxEntries = MAX_REASONABLE_FILE_SIZE / TEXTURE_CACHE_ENTRY_SIZE [static, private] |
Definition at line 180 of file lltexturecache.h.
Referenced by getHeaderCacheEntry(), initCache(), and readHeaderCache().
S64 LLTextureCache::sCacheMaxTexturesSize = 0 [static, private] |
Definition at line 181 of file lltexturecache.h.
Referenced by appendToTextureEntryList(), initCache(), and purgeTextures().