summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2010-09-16 18:41:19 -0400
committerLoren Shih <seraph@lindenlab.com>2010-09-16 18:41:19 -0400
commitb5863a7723311ace7b288bc1eb6926b1221262ca (patch)
treed0b046426e90dbdf3edf27ee751536ef0b17c4e8 /indra/newview/llvocache.cpp
parent7ef0e0b92ff60f97f115df5779e574de2624159c (diff)
parentb5ea8b6046b2634cd0ef0ca2d7c3ac8079529e90 (diff)
Automated merge from viewer-development-shining
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rw-r--r--indra/newview/llvocache.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 0b903e62b1..442b3c3e33 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -28,6 +28,7 @@
#include "llvocache.h"
#include "llerror.h"
#include "llregionhandle.h"
+#include "llviewercontrol.h"
BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)
{
@@ -230,11 +231,11 @@ LLVOCache* LLVOCache::sInstance = NULL;
//static
LLVOCache* LLVOCache::getInstance()
-{
+{
if(!sInstance)
{
sInstance = new LLVOCache() ;
-}
+ }
return sInstance ;
}
@@ -259,13 +260,17 @@ LLVOCache::LLVOCache():
mReadOnly(TRUE),
mNumEntries(0)
{
+ mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
}
LLVOCache::~LLVOCache()
{
- writeCacheHeader();
- clearCacheInMemory();
+ if(mEnabled)
+ {
+ writeCacheHeader();
+ clearCacheInMemory();
+ }
delete mLocalAPRFilePoolp;
}
@@ -279,7 +284,7 @@ void LLVOCache::setDirNames(ELLPath location)
void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version)
{
- if(mInitialized)
+ if(mInitialized || !mEnabled)
{
return ;
}
@@ -406,6 +411,11 @@ BOOL LLVOCache::checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes)
void LLVOCache::readCacheHeader()
{
+ if(!mEnabled)
+ {
+ return ;
+ }
+
//clear stale info.
clearCacheInMemory();
@@ -450,7 +460,7 @@ void LLVOCache::readCacheHeader()
void LLVOCache::writeCacheHeader()
{
- if(mReadOnly)
+ if(mReadOnly || !mEnabled)
{
return ;
}
@@ -501,6 +511,10 @@ BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map)
{
+ if(!mEnabled)
+ {
+ return ;
+ }
llassert_always(mInitialized);
handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
@@ -570,6 +584,10 @@ void LLVOCache::purgeEntries()
void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache)
{
+ if(!mEnabled)
+ {
+ return ;
+ }
llassert_always(mInitialized);
if(mReadOnly)