Kaydet (Commit) 3f54055c authored tarafından Noel Grandin's avatar Noel Grandin

drop Cache typedef

Change-Id: Id1c568f7d089c345643227a6e9d0fee09aabfab8
Reviewed-on: https://gerrit.libreoffice.org/47345Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4c57847c
...@@ -61,11 +61,11 @@ class RecentlyUsedCacheDescriptor ...@@ -61,11 +61,11 @@ class RecentlyUsedCacheDescriptor
{ {
public: public:
Size maPreviewSize; Size maPreviewSize;
std::shared_ptr< ::sd::slidesorter::cache::PageCacheManager::Cache> mpCache; std::shared_ptr< ::sd::slidesorter::cache::BitmapCache> mpCache;
RecentlyUsedCacheDescriptor( RecentlyUsedCacheDescriptor(
const Size& rPreviewSize, const Size& rPreviewSize,
const std::shared_ptr< ::sd::slidesorter::cache::PageCacheManager::Cache>& rpCache) const std::shared_ptr< ::sd::slidesorter::cache::BitmapCache>& rpCache)
:maPreviewSize(rPreviewSize),mpCache(rpCache) :maPreviewSize(rPreviewSize),mpCache(rpCache)
{} {}
}; };
...@@ -110,7 +110,7 @@ namespace sd { namespace slidesorter { namespace cache { ...@@ -110,7 +110,7 @@ namespace sd { namespace slidesorter { namespace cache {
*/ */
class PageCacheManager::PageCacheContainer class PageCacheManager::PageCacheContainer
: public std::unordered_map<CacheDescriptor, : public std::unordered_map<CacheDescriptor,
std::shared_ptr<PageCacheManager::Cache>, std::shared_ptr<BitmapCache>,
CacheDescriptor::Hash, CacheDescriptor::Hash,
CacheDescriptor::Equal> CacheDescriptor::Equal>
{ {
...@@ -121,12 +121,12 @@ public: ...@@ -121,12 +121,12 @@ public:
address only. address only.
*/ */
class CompareWithCache { public: class CompareWithCache { public:
explicit CompareWithCache(const std::shared_ptr<PageCacheManager::Cache>& rpCache) explicit CompareWithCache(const std::shared_ptr<BitmapCache>& rpCache)
: mpCache(rpCache) {} : mpCache(rpCache) {}
bool operator () (const PageCacheContainer::value_type& rValue) const bool operator () (const PageCacheContainer::value_type& rValue) const
{ return rValue.second == mpCache; } { return rValue.second == mpCache; }
private: private:
std::shared_ptr<PageCacheManager::Cache> mpCache; std::shared_ptr<BitmapCache> mpCache;
}; };
}; };
...@@ -189,11 +189,11 @@ PageCacheManager::~PageCacheManager() ...@@ -189,11 +189,11 @@ PageCacheManager::~PageCacheManager()
{ {
} }
std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache ( std::shared_ptr<BitmapCache> PageCacheManager::GetCache (
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rPreviewSize) const Size& rPreviewSize)
{ {
std::shared_ptr<Cache> pResult; std::shared_ptr<BitmapCache> pResult;
// Look for the cache in the list of active caches. // Look for the cache in the list of active caches.
CacheDescriptor aKey (pDocument, rPreviewSize); CacheDescriptor aKey (pDocument, rPreviewSize);
...@@ -207,7 +207,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache ( ...@@ -207,7 +207,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache (
// Create the cache when no suitable one does exist. // Create the cache when no suitable one does exist.
if (pResult.get() == nullptr) if (pResult.get() == nullptr)
pResult.reset(new Cache()); pResult.reset(new BitmapCache());
// The cache may be newly created and thus empty or is old and may // The cache may be newly created and thus empty or is old and may
// contain previews that are not up-to-date. Recycle previews from // contain previews that are not up-to-date. Recycle previews from
...@@ -222,7 +222,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache ( ...@@ -222,7 +222,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetCache (
} }
void PageCacheManager::Recycle ( void PageCacheManager::Recycle (
const std::shared_ptr<Cache>& rpCache, const std::shared_ptr<BitmapCache>& rpCache,
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rPreviewSize) const Size& rPreviewSize)
{ {
...@@ -256,7 +256,7 @@ void PageCacheManager::Recycle ( ...@@ -256,7 +256,7 @@ void PageCacheManager::Recycle (
} }
} }
void PageCacheManager::ReleaseCache (const std::shared_ptr<Cache>& rpCache) void PageCacheManager::ReleaseCache (const std::shared_ptr<BitmapCache>& rpCache)
{ {
PageCacheContainer::iterator iCache (::std::find_if( PageCacheContainer::iterator iCache (::std::find_if(
mpPageCaches->begin(), mpPageCaches->begin(),
...@@ -273,12 +273,12 @@ void PageCacheManager::ReleaseCache (const std::shared_ptr<Cache>& rpCache) ...@@ -273,12 +273,12 @@ void PageCacheManager::ReleaseCache (const std::shared_ptr<Cache>& rpCache)
} }
} }
std::shared_ptr<PageCacheManager::Cache> PageCacheManager::ChangeSize ( std::shared_ptr<BitmapCache> PageCacheManager::ChangeSize (
const std::shared_ptr<Cache>& rpCache, const std::shared_ptr<BitmapCache>& rpCache,
const Size&, const Size&,
const Size& rNewPreviewSize) const Size& rNewPreviewSize)
{ {
std::shared_ptr<Cache> pResult; std::shared_ptr<BitmapCache> pResult;
if (rpCache.get() != nullptr) if (rpCache.get() != nullptr)
{ {
...@@ -384,11 +384,11 @@ void PageCacheManager::ReleasePreviewBitmap (const SdrPage* pPage) ...@@ -384,11 +384,11 @@ void PageCacheManager::ReleasePreviewBitmap (const SdrPage* pPage)
iCache->second->ReleaseBitmap(pPage); iCache->second->ReleaseBitmap(pPage);
} }
std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache ( std::shared_ptr<BitmapCache> PageCacheManager::GetRecentlyUsedCache (
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rPreviewSize) const Size& rPreviewSize)
{ {
std::shared_ptr<Cache> pCache; std::shared_ptr<BitmapCache> pCache;
// Look for the cache in the list of recently used caches. // Look for the cache in the list of recently used caches.
RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument)); RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
...@@ -410,7 +410,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache ...@@ -410,7 +410,7 @@ std::shared_ptr<PageCacheManager::Cache> PageCacheManager::GetRecentlyUsedCache
void PageCacheManager::PutRecentlyUsedCache( void PageCacheManager::PutRecentlyUsedCache(
DocumentKey const & pDocument, DocumentKey const & pDocument,
const Size& rPreviewSize, const Size& rPreviewSize,
const std::shared_ptr<Cache>& rpCache) const std::shared_ptr<BitmapCache>& rpCache)
{ {
// Look up the list of recently used caches for the given document. // Look up the list of recently used caches for the given document.
RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument)); RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument));
......
...@@ -40,7 +40,6 @@ class BitmapCache; ...@@ -40,7 +40,6 @@ class BitmapCache;
class PageCacheManager class PageCacheManager
{ {
public: public:
typedef BitmapCache Cache;
typedef std::vector< std::pair<Size, std::shared_ptr<BitmapCache> > > BestFittingPageCaches; typedef std::vector< std::pair<Size, std::shared_ptr<BitmapCache> > > BestFittingPageCaches;
typedef css::uno::Reference<css::uno::XInterface> DocumentKey; typedef css::uno::Reference<css::uno::XInterface> DocumentKey;
...@@ -57,7 +56,7 @@ public: ...@@ -57,7 +56,7 @@ public:
The returned cache lives as long as somebody keeps a shared The returned cache lives as long as somebody keeps a shared
pointer and the ReleaseCache() method has not been called. pointer and the ReleaseCache() method has not been called.
*/ */
std::shared_ptr<Cache> GetCache ( std::shared_ptr<BitmapCache> GetCache (
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rPreviewSize); const Size& rPreviewSize);
...@@ -65,14 +64,14 @@ public: ...@@ -65,14 +64,14 @@ public:
cache. After that the cache will live as long as the caller (and cache. After that the cache will live as long as the caller (and
maybe others) holds its reference. maybe others) holds its reference.
*/ */
void ReleaseCache (const std::shared_ptr<Cache>& rpCache); void ReleaseCache (const std::shared_ptr<BitmapCache>& rpCache);
/** This is an information to the cache manager that the size of preview /** This is an information to the cache manager that the size of preview
bitmaps in the specified cache has changed. bitmaps in the specified cache has changed.
*/ */
std::shared_ptr<Cache> ChangeSize ( std::shared_ptr<BitmapCache> ChangeSize (
const std::shared_ptr<Cache>& rpCache, const std::shared_ptr<BitmapCache>& rpCache,
const Size& rOldPreviewSize, const Size& rOldPreviewSize,
const Size& rNewPreviewSize); const Size& rNewPreviewSize);
...@@ -130,7 +129,7 @@ private: ...@@ -130,7 +129,7 @@ private:
class Deleter; class Deleter;
friend class Deleter; friend class Deleter;
std::shared_ptr<Cache> GetRecentlyUsedCache( std::shared_ptr<BitmapCache> GetRecentlyUsedCache(
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rSize); const Size& rSize);
...@@ -141,13 +140,13 @@ private: ...@@ -141,13 +140,13 @@ private:
void PutRecentlyUsedCache( void PutRecentlyUsedCache(
DocumentKey const & pDocument, DocumentKey const & pDocument,
const Size& rPreviewSize, const Size& rPreviewSize,
const std::shared_ptr<Cache>& rpCache); const std::shared_ptr<BitmapCache>& rpCache);
/** This method is used internally to initialize a newly created /** This method is used internally to initialize a newly created
BitmapCache with already exisiting previews. BitmapCache with already exisiting previews.
*/ */
void Recycle ( void Recycle (
const std::shared_ptr<Cache>& rpCache, const std::shared_ptr<BitmapCache>& rpCache,
const DocumentKey& pDocument, const DocumentKey& pDocument,
const Size& rPreviewSize); const Size& rPreviewSize);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment