diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-04-09 01:29:44 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-04-09 01:29:44 +0100 |
commit | f363a8898ded0896cf6dde81081cff046c7fa3a8 (patch) | |
tree | a44452f7467e9c2060e3b165283cb1c2cf1f6723 /indra/newview/llappviewer.cpp | |
parent | 5a8770c9e37ae3ebe6fca7f8a631be4179763aed (diff) | |
parent | 4ed913c3760308ea67db8beb9e6330933104a8ab (diff) |
merge
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 43c8c679c6..8e959993fe 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3016,41 +3016,59 @@ void LLAppViewer::migrateCacheDirectory() #endif // LL_WINDOWS || LL_DARWIN } +//static +S32 LLAppViewer::getCacheVersion() +{ + static const S32 cache_version = 7; + + return cache_version ; +} + bool LLAppViewer::initCache() { mPurgeCache = false; - // Purge cache if user requested it - if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || - gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) + BOOL disable_texture_cache = FALSE ; + BOOL read_only = mSecondInstance ? TRUE : FALSE; + LLAppViewer::getTextureCache()->setReadOnly(read_only) ; + + if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getCacheVersion()) { - gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); - mPurgeCache = true; + if(read_only) + { + disable_texture_cache = TRUE ; //if the cache version of this viewer is different from the running one, this viewer can not use the texture cache. + } + else + { + mPurgeCache = true; // Purge cache if the version number is different. + gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getCacheVersion()); + } } - // Purge cache if it belongs to an old version - else + + if(!read_only) { - static const S32 cache_version = 6; - if (gSavedSettings.getS32("LocalCacheVersion") != cache_version) + // Purge cache if user requested it + if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || + gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) { + gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); mPurgeCache = true; - gSavedSettings.setS32("LocalCacheVersion", cache_version); } - } - // We have moved the location of the cache directory over time. - migrateCacheDirectory(); - - // Setup and verify the cache location - std::string cache_location = gSavedSettings.getString("CacheLocation"); - std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); - if (new_cache_location != cache_location) - { - gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); - purgeCache(); // purge old cache - gSavedSettings.setString("CacheLocation", new_cache_location); - gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location)); - } + // We have moved the location of the cache directory over time. + migrateCacheDirectory(); + // Setup and verify the cache location + std::string cache_location = gSavedSettings.getString("CacheLocation"); + std::string new_cache_location = gSavedSettings.getString("NewCacheLocation"); + if (new_cache_location != cache_location) + { + gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation")); + purgeCache(); // purge old cache + gSavedSettings.setString("CacheLocation", new_cache_location); + gSavedSettings.setString("CacheLocationTopFolder", gDirUtilp->getBaseFileName(new_cache_location)); + } + } + if (!gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"))) { LL_WARNS("AppCache") << "Unable to set cache location" << LL_ENDL; @@ -3058,7 +3076,7 @@ bool LLAppViewer::initCache() gSavedSettings.setString("CacheLocationTopFolder", ""); } - if (mPurgeCache) + if (mPurgeCache && !read_only) { LLSplashScreen::update(LLTrans::getString("StartupClearingCache")); purgeCache(); @@ -3067,14 +3085,13 @@ bool LLAppViewer::initCache() LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache")); // Init the texture cache - // Allocate 80% of the cache size for textures - BOOL read_only = mSecondInstance ? TRUE : FALSE; + // Allocate 80% of the cache size for textures const S32 MB = 1024*1024; S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB; const S64 MAX_CACHE_SIZE = 1024*MB; cache_size = llmin(cache_size, MAX_CACHE_SIZE); S64 texture_cache_size = ((cache_size * 8)/10); - S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, read_only); + S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, disable_texture_cache); texture_cache_size -= extra; LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); |