INTEGRATION: CWS impress92 (1.5.140); FILE MERGED

2006/04/26 12:59:49 af 1.5.140.1: #i63668# Added InvalidateAllCaches() method. Added Deleter class and made the destructor private.
This commit is contained in:
Rüdiger Timm
2006-05-05 09:05:47 +00:00
parent 48d2442a78
commit f76aeca056

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: SlsPageCacheManager.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: rt $ $Date: 2005-11-11 10:48:27 $
* last change: $Author: rt $ $Date: 2006-05-05 10:05:47 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -167,6 +167,14 @@ public:
class PageCacheManager::Deleter
{
public:
void operator() (PageCacheManager* pObject) { delete pObject; }
};
//===== PageCacheManager ====================================================
::boost::weak_ptr<PageCacheManager> PageCacheManager::mpInstance;
@@ -180,7 +188,9 @@ public:
pInstance = mpInstance.lock();
if (pInstance.get() == NULL)
{
pInstance.reset(new PageCacheManager());
pInstance = ::boost::shared_ptr<PageCacheManager>(
new PageCacheManager(),
PageCacheManager::Deleter());
mpInstance = pInstance;
}
@@ -372,6 +382,22 @@ void PageCacheManager::InvalidatePreviewBitmap (
void PageCacheManager::InvalidateAllCaches (void)
{
// Iterate over all caches that are currently in use and invalidate
// them.
PageCacheContainer::iterator iCache;
for (iCache=mpPageCaches->begin(); iCache!=mpPageCaches->end(); ++iCache)
iCache->second->InvalidateCache();
// Remove all recently used caches, there is not much sense in storing
// invalidated and unused caches.
mpRecentlyUsedPageCaches->clear();
}
::boost::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache (
SdDrawDocument* pDocument,
const Size& rPreviewSize)