LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority, U8* data, S32 datasize, S32 imagesize, WriteResponder* responder) { if (mReadOnly) { delete responder; return LLWorkerThread::nullHandle(); } if (mDoPurge) { // NOTE: This may cause an occasional hiccup, // but it really needs to be done on the control thread // (i.e. here) purgeTextures(false); mDoPurge = FALSE; } purgeTextureFilesTimeSliced(); // purge textures from cache in a non-hiccup-way if (datasize >= TEXTURE_CACHE_ENTRY_SIZE) { LLMutexLock lock(&mWorkersMutex); llassert_always(imagesize > 0); LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, priority, id, data, datasize, 0, imagesize, responder); handle_t handle = worker->write(); mWriters[handle] = worker; return handle; } delete responder; return LLWorkerThread::nullHandle(); }
LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority, U8* data, S32 datasize, S32 imagesize, WriteResponder* responder) { if (mReadOnly) { delete responder; return LLWorkerThread::nullHandle(); } if (mDoPurge) { // NOTE: This may cause an occasional hiccup, // but it really needs to be done on the control thread // (i.e. here) purgeTextures(false); mDoPurge = FALSE; } LLMutexLock lock(&mWorkersMutex); LLTextureCacheWorker* worker = new LLTextureCacheRemoteWorker(this, priority, id, data, datasize, 0, imagesize, responder); handle_t handle = worker->write(); mWriters[handle] = worker; return handle; }