summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-03-29 17:54:04 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-03-29 17:54:04 -0600
commit51e5997bd6f7f7d66a5843cf1d0b749b143460a8 (patch)
tree43bc38aafab4122b42e4d005043124fda32418f7
parent0ddeaa196731299e443d96e9f2797d8247c0de97 (diff)
delay removing invalid objects from cache in case region is logged out too soon.
-rw-r--r--indra/newview/llviewerregion.cpp9
-rw-r--r--indra/newview/llviewerregion.h1
-rw-r--r--indra/newview/llvocache.cpp4
-rw-r--r--indra/newview/llvocache.h2
4 files changed, 9 insertions, 7 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index d8f9ecf248..ed67d50dfd 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -460,11 +460,10 @@ void LLViewerRegion::saveObjectCache()
if(LLVOCache::hasInstance())
{
- //NOTE: !!!!!!!!!!
- //set this to be true when support full region cache probe!!!!
- BOOL full_region_cache_probe = FALSE;
+ const F32 start_time_threshold = 600.0f; //seconds
+ bool removal_enabled = mRegionTimer.getElapsedTimeF32() > start_time_threshold; //allow to remove invalid objects from object cache file.
- LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ;
+ LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ;
mCacheDirty = FALSE;
}
@@ -2176,6 +2175,8 @@ void LLViewerRegion::unpackRegionHandshake()
}
msg->addU32("Flags", flags );
msg->sendReliable(host);
+
+ mRegionTimer.reset(); //reset region timer.
}
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 22936fb103..2248cf5269 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -399,6 +399,7 @@ public:
static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not.
private:
LLViewerRegionImpl * mImpl;
+ LLFrameTimer mRegionTimer;
F32 mWidth; // Width of region on a side (meters)
U64 mHandle;
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index a08e01784c..caa87eb1eb 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -906,7 +906,7 @@ void LLVOCache::purgeEntries(U32 size)
mNumEntries = mHandleEntryMap.size() ;
}
-void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe)
+void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled)
{
if(!mEnabled)
{
@@ -979,7 +979,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter)
{
- if(!full_region_cache_probe || iter->second->isTouched())
+ if(!removal_enabled || iter->second->isTouched())
{
success = iter->second->writeToFile(&apr_file) ;
}
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index c26bebb451..5f2dd63051 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -202,7 +202,7 @@ public:
void removeCache(ELLPath location, bool started = false) ;
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, BOOL full_region_cache_probe);
+ void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled);
void removeEntry(U64 handle) ;
void setReadOnly(BOOL read_only) {mReadOnly = read_only;}