// Get data packer for this object, if we have cached data // AND the CRC matches. JC LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc) { llassert(mCacheLoaded); LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordHit(); return entry->getDP(crc); } else { // llinfos << "CRC miss for " << local_id << llendl; mCacheMissCRC.put(local_id); } } else { // llinfos << "Cache miss for " << local_id << llendl; mCacheMissFull.put(local_id); } return NULL; }
// Get data packer for this object, if we have cached data // AND the CRC matches. JC LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; return entry->getDP(crc); } else { // llinfos << "CRC miss for " << local_id << llendl; cache_miss_type = CACHE_MISS_TYPE_CRC; mCacheMissCRC.put(local_id); } } else { // llinfos << "Cache miss for " << local_id << llendl; cache_miss_type = CACHE_MISS_TYPE_FULL; mCacheMissFull.put(local_id); } return NULL; }
LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) { U32 local_id = objectp->getLocalID(); U32 crc = objectp->getCRC(); LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordDupe(); return CACHE_UPDATE_DUPE; } // Update the cache entry mImpl->mCacheMap.erase(local_id); delete entry; entry = new LLVOCacheEntry(local_id, crc, dp); mImpl->mCacheMap[local_id] = entry; return CACHE_UPDATE_CHANGED; } // we haven't seen this object before // Create new entry and add to map eCacheUpdateResult result = CACHE_UPDATE_ADDED; if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) { delete mImpl->mCacheMap.begin()->second ; mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); result = CACHE_UPDATE_REPLACED; } entry = new LLVOCacheEntry(local_id, crc, dp); mImpl->mCacheMap[local_id] = entry; return result; }
void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) { U32 local_id = objectp->getLocalID(); U32 crc = objectp->getCRC(); LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL); if (entry) { // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordDupe(); } else { // Update the cache entry mCacheMap.erase(local_id); delete entry; entry = new LLVOCacheEntry(local_id, crc, dp); mCacheMap[local_id] = entry; } } else { // we haven't seen this object before // Create new entry and add to map if (mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) { mCacheMap.erase(mCacheMap.begin()); } entry = new LLVOCacheEntry(local_id, crc, dp); mCacheMap[local_id] = entry; } return ; }