Show
Ignore:
Timestamp:
08/05/09 13:06:53 (4 years ago)
Author:
robert
Message:

Moved the updating and expiry of the Registry object cache from DatabasePager? into osgViewer::Viewer/CompositeViewer.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgDB/Registry.cpp

    r10356 r10520  
    186186        if (switchOff) _buildKdTreesHint = Options::DO_NOT_BUILD_KDTREES; 
    187187        else _buildKdTreesHint = Options::BUILD_KDTREES; 
     188    } 
     189 
     190    const char* ptr=0; 
     191 
     192    _expiryDelay = 10.0; 
     193    if( (ptr = getenv("OSG_EXPIRY_DELAY")) != 0) 
     194    { 
     195        _expiryDelay = osg::asciiToDouble(ptr); 
     196        osg::notify(osg::INFO)<<"Registry : Expiry delay = "<<_expiryDelay<<std::endl; 
    188197    } 
    189198 
     
    21052114} 
    21062115 
    2107 void Registry::updateTimeStampOfObjectsInCacheWithExternalReferences(double currentTime) 
     2116void Registry::updateTimeStampOfObjectsInCacheWithExternalReferences(const osg::FrameStamp& frameStamp) 
    21082117{ 
    21092118    OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex); 
     
    21182127        { 
    21192128            // so update it time stamp. 
    2120             itr->second.second = currentTime; 
    2121         } 
    2122     } 
    2123 } 
    2124  
    2125 void Registry::removeExpiredObjectsInCache(double expiryTime) 
    2126 { 
     2129            itr->second.second = frameStamp.getReferenceTime(); 
     2130        } 
     2131    } 
     2132} 
     2133 
     2134void Registry::removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp) 
     2135{ 
     2136    double expiryTime = frameStamp.getReferenceTime() - _expiryDelay; 
     2137 
    21272138    OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_objectCacheMutex); 
    21282139