aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexturecache.h
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-09-03 14:39:47 -0700
committerMcCabe Maxsted2010-09-03 14:39:47 -0700
commitb88d3f2a93f4cb479fc139844fe8ef3e8524277a (patch)
treebbb628c000ad0522e6b12c4315989b687497c77d /linden/indra/newview/lltexturecache.h
parentAdded some subgroups to the SL dic (these commits should really be squashed o... (diff)
downloadmeta-impy-b88d3f2a93f4cb479fc139844fe8ef3e8524277a.zip
meta-impy-b88d3f2a93f4cb479fc139844fe8ef3e8524277a.tar.gz
meta-impy-b88d3f2a93f4cb479fc139844fe8ef3e8524277a.tar.bz2
meta-impy-b88d3f2a93f4cb479fc139844fe8ef3e8524277a.tar.xz
Revert "Updated lltexturecache to the latest in viewer-development (see #425)" since it was causing issues with local assets and object backup
This reverts commit 4ca4594ec264f390be981568ef5ff3ff0f2f77e6.
Diffstat (limited to 'linden/indra/newview/lltexturecache.h')
-rw-r--r--linden/indra/newview/lltexturecache.h37
1 files changed, 8 insertions, 29 deletions
diff --git a/linden/indra/newview/lltexturecache.h b/linden/indra/newview/lltexturecache.h
index f80be00..45804c2 100644
--- a/linden/indra/newview/lltexturecache.h
+++ b/linden/indra/newview/lltexturecache.h
@@ -40,7 +40,6 @@
40 40
41#include "llworkerthread.h" 41#include "llworkerthread.h"
42 42
43class LLImageFormatted;
44class LLTextureCacheWorker; 43class LLTextureCacheWorker;
45 44
46class LLTextureCache : public LLWorkerThread 45class LLTextureCache : public LLWorkerThread
@@ -59,16 +58,10 @@ private:
59 }; 58 };
60 struct Entry 59 struct Entry
61 { 60 {
62 Entry() : 61 Entry() {}
63 mBodySize(0),
64 mImageSize(0),
65 mTime(0)
66 {
67 }
68 Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) : 62 Entry(const LLUUID& id, S32 imagesize, S32 bodysize, U32 time) :
69 mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {} 63 mID(id), mImageSize(imagesize), mBodySize(bodysize), mTime(time) {}
70 void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; } 64 void init(const LLUUID& id, U32 time) { mID = id, mImageSize = 0; mBodySize = 0; mTime = time; }
71 Entry& operator=(const Entry& entry) {mID = entry.mID, mImageSize = entry.mImageSize; mBodySize = entry.mBodySize; mTime = entry.mTime; return *this;}
72 LLUUID mID; // 16 bytes 65 LLUUID mID; // 16 bytes
73 S32 mImageSize; // total size of image if known 66 S32 mImageSize; // total size of image if known
74 S32 mBodySize; // size of body file in body cache 67 S32 mBodySize; // size of body file in body cache
@@ -110,8 +103,7 @@ public:
110 /*virtual*/ S32 update(U32 max_time_ms); 103 /*virtual*/ S32 update(U32 max_time_ms);
111 104
112 void purgeCache(ELLPath location); 105 void purgeCache(ELLPath location);
113 void setReadOnly(BOOL read_only) ; 106 S64 initCache(ELLPath location, S64 maxsize, BOOL read_only);
114 S64 initCache(ELLPath location, S64 maxsize, BOOL disable_texture_cache);
115 107
116 handle_t readFromCache(const std::string& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size, 108 handle_t readFromCache(const std::string& local_filename, const LLUUID& id, U32 priority, S32 offset, S32 size,
117 ReadResponder* responder); 109 ReadResponder* responder);
@@ -124,7 +116,7 @@ public:
124 bool writeComplete(handle_t handle, bool abort = false); 116 bool writeComplete(handle_t handle, bool abort = false);
125 void prioritizeWrite(handle_t handle); 117 void prioritizeWrite(handle_t handle);
126 118
127 bool removeFromCache(const LLUUID& id); 119 void removeFromCache(const LLUUID& id);
128 120
129 // For LLTextureCacheWorker::Responder 121 // For LLTextureCacheWorker::Responder
130 LLTextureCacheWorker* getReader(handle_t handle); 122 LLTextureCacheWorker* getReader(handle_t handle);
@@ -139,11 +131,10 @@ public:
139 S64 getMaxUsage() { return sCacheMaxTexturesSize; } 131 S64 getMaxUsage() { return sCacheMaxTexturesSize; }
140 U32 getEntries() { return mHeaderEntriesInfo.mEntries; } 132 U32 getEntries() { return mHeaderEntriesInfo.mEntries; }
141 U32 getMaxEntries() { return sCacheMaxEntries; }; 133 U32 getMaxEntries() { return sCacheMaxEntries; };
142 BOOL isInCache(const LLUUID& id) ;
143 BOOL isInLocal(const LLUUID& id) ;
144 134
145protected: 135protected:
146 // Accessed by LLTextureCacheWorker 136 // Accessed by LLTextureCacheWorker
137 bool updateTextureEntryList(const LLUUID& id, S32 size);
147 std::string getLocalFileName(const LLUUID& id); 138 std::string getLocalFileName(const LLUUID& id);
148 std::string getTextureFileName(const LLUUID& id); 139 std::string getTextureFileName(const LLUUID& id);
149 void addCompleted(Responder* responder, bool success); 140 void addCompleted(Responder* responder, bool success);
@@ -154,7 +145,6 @@ protected:
154private: 145private:
155 void setDirNames(ELLPath location); 146 void setDirNames(ELLPath location);
156 void readHeaderCache(); 147 void readHeaderCache();
157 void clearCorruptedCache();
158 void purgeAllTextures(bool purge_directories); 148 void purgeAllTextures(bool purge_directories);
159 void purgeTextures(bool validate); 149 void purgeTextures(bool validate);
160 LLAPRFile* openHeaderEntriesFile(bool readonly, S32 offset); 150 LLAPRFile* openHeaderEntriesFile(bool readonly, S32 offset);
@@ -162,20 +152,12 @@ private:
162 void readEntriesHeader(); 152 void readEntriesHeader();
163 void writeEntriesHeader(); 153 void writeEntriesHeader();
164 S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create); 154 S32 openAndReadEntry(const LLUUID& id, Entry& entry, bool create);
165 bool updateEntry(S32& idx, Entry& entry, S32 new_image_size, S32 new_body_size); 155 void writeEntryAndClose(S32 idx, Entry& entry);
166 void updateEntryTimeStamp(S32 idx, Entry& entry) ;
167 U32 openAndReadEntries(std::vector<Entry>& entries); 156 U32 openAndReadEntries(std::vector<Entry>& entries);
168 void writeEntriesAndClose(const std::vector<Entry>& entries); 157 void writeEntriesAndClose(const std::vector<Entry>& entries);
169 void readEntryFromHeaderImmediately(S32& idx, Entry& entry) ; 158 S32 getHeaderCacheEntry(const LLUUID& id, S32& imagesize);
170 void writeEntryToHeaderImmediately(S32& idx, Entry& entry, bool write_header = false) ; 159 S32 setHeaderCacheEntry(const LLUUID& id, S32 imagesize);
171 void removeEntry(S32 idx, Entry& entry, std::string& filename); 160 bool removeHeaderCacheEntry(const LLUUID& id);
172 void removeCachedTexture(const LLUUID& id) ;
173 S32 getHeaderCacheEntry(const LLUUID& id, Entry& entry);
174 S32 setHeaderCacheEntry(const LLUUID& id, Entry& entry, S32 imagesize, S32 datasize);
175 void writeUpdatedEntries() ;
176 void updatedHeaderEntriesFile() ;
177 void lockHeaders() { mHeaderMutex.lock(); }
178 void unlockHeaders() { mHeaderMutex.unlock(); }
179 161
180private: 162private:
181 // Internal 163 // Internal
@@ -212,9 +194,6 @@ private:
212 S64 mTexturesSizeTotal; 194 S64 mTexturesSizeTotal;
213 LLAtomic32<BOOL> mDoPurge; 195 LLAtomic32<BOOL> mDoPurge;
214 196
215 typedef std::map<S32, Entry> idx_entry_map_t;
216 idx_entry_map_t mUpdatedEntryMap;
217
218 // Statics 197 // Statics
219 static F32 sHeaderCacheVersion; 198 static F32 sHeaderCacheVersion;
220 static U32 sCacheMaxEntries; 199 static U32 sCacheMaxEntries;