diff options
Diffstat (limited to 'indra/newview/llvocache.h')
-rw-r--r-- | indra/newview/llvocache.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index e103007979..14e3b4c793 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -95,13 +95,15 @@ private: { bool operator()(const HeaderEntryInfo* lhs, const HeaderEntryInfo* rhs) const { - if (lhs->mTime == rhs->mTime) + if(lhs->mTime == rhs->mTime) { - return lhs->mHandle < rhs->mHandle; + return lhs < rhs ; } - return lhs->mTime < rhs->mTime; // older entry in front + + return lhs->mTime < rhs->mTime ; // older entry in front of queue (set) } }; + typedef std::set<HeaderEntryInfo*, header_entry_less> header_entry_queue_t; typedef std::map<U64, HeaderEntryInfo*> handle_entry_map_t; private: LLVOCache() ; @@ -114,6 +116,7 @@ public: void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) ; + void removeEntry(U64 handle) ; void setReadOnly(BOOL read_only) {mReadOnly = read_only;} @@ -121,15 +124,14 @@ private: void setDirNames(ELLPath location); // determine the cache filename for the region from the region handle void getObjectCacheFilename(U64 handle, std::string& filename); - void removeFromCache(U64 handle); + void removeFromCache(HeaderEntryInfo* entry); void readCacheHeader(); void writeCacheHeader(); void clearCacheInMemory(); void removeCache() ; - void purgeEntries(); + void removeEntry(HeaderEntryInfo* entry) ; + void purgeEntries(U32 size); BOOL updateEntry(const HeaderEntryInfo* entry); - BOOL checkRead(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error = true) ; - BOOL checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error = true) ; private: BOOL mEnabled; @@ -137,9 +139,11 @@ private: BOOL mReadOnly ; HeaderMetaInfo mMetaInfo; U32 mCacheSize; + U32 mNumEntries; std::string mHeaderFileName ; std::string mObjectCacheDirName; LLVolatileAPRPool* mLocalAPRFilePoolp ; + header_entry_queue_t mHeaderEntryQueue; handle_entry_map_t mHandleEntryMap; static LLVOCache* sInstance ; |