diff options
Diffstat (limited to 'indra/newview/lltexturecache.h')
-rw-r--r-- | indra/newview/lltexturecache.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 4203cbbc43..5dc06ff401 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -59,10 +59,16 @@ private: }; struct Entry { - Entry() {} + Entry() : + mBodySize(0), + mImageSize(0), + mTime(0) + { + } Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) : mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {} void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; } + Entry& operator=(const Entry& entry) {mID = entry.mID, mImageSize = entry.mImageSize; mBodySize = entry.mBodySize; mTime = entry.mTime; return *this;} LLUUID mID; // 16 bytes S32 mImageSize; // total size of image if known S32 mBodySize; // size of body file in body cache @@ -104,7 +110,8 @@ public: /*virtual*/ S32 update(U32 max_time_ms); void purgeCache(ELLPath location); - S64 initCache(ELLPath location, S64 maxsize, BOOL read_only); + void setReadOnly(BOOL read_only) ; + S64 initCache(ELLPath location, S64 maxsize, BOOL disable_texture_cache); handle_t readFromCache(const std::string& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, ReadResponder* responder); @@ -117,7 +124,7 @@ public: bool writeComplete(handle_t handle, bool abort = false); void prioritizeWrite(handle_t handle); - void removeFromCache(const LLUUID& id); + bool removeFromCache(const LLUUID& id); // For LLTextureCacheWorker::Responder LLTextureCacheWorker* getReader(handle_t handle); @@ -155,12 +162,18 @@ private: void readEntriesHeader(); void writeEntriesHeader(); S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create); - void writeEntryAndClose(S32 idx, Entry& entry); + void updateEntry(S32 idx, Entry& entry, S32 new_image_size, S32 new_body_size); + void updateEntryTimeStamp(S32 idx, Entry& entry) ; U32 openAndReadEntries(std::vector<Entry>& entries); void writeEntriesAndClose(const std::vector<Entry>& entries); + void readEntryFromHeaderImmediately(S32 idx, Entry& entry) ; + void writeEntryToHeaderImmediately(S32 idx, Entry& entry, bool write_header = false) ; + void removeEntry(S32 idx, Entry& entry, std::string& filename); + void removeCachedTexture(const LLUUID& id) ; S32 getHeaderCacheEntry(const LLUUID& id, S32& imagesize); S32 setHeaderCacheEntry(const LLUUID& id, S32 imagesize); - bool removeHeaderCacheEntry(const LLUUID& id); + void writeUpdatedEntries() ; + void updatedHeaderEntriesFile() ; void lockHeaders() { mHeaderMutex.lock(); } void unlockHeaders() { mHeaderMutex.unlock(); } @@ -199,6 +212,9 @@ private: S64 mTexturesSizeTotal; LLAtomic32<BOOL> mDoPurge; + typedef std::map<S32, Entry> idx_entry_map_t; + idx_entry_map_t mUpdatedEntryMap; + // Statics static F32 sHeaderCacheVersion; static U32 sCacheMaxEntries; |