From 3f54055c18c953a8398bf29e27dcc8fae2592c94 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 3 Jan 2018 15:07:58 +0200 Subject: drop Cache typedef Change-Id: Id1c568f7d089c345643227a6e9d0fee09aabfab8 Reviewed-on: https://gerrit.libreoffice.org/47345 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../ui/slidesorter/cache/SlsPageCacheManager.cxx | 32 +++++++++++----------- .../slidesorter/inc/cache/SlsPageCacheManager.hxx | 15 +++++----- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx index 14a810712dfe..bffd9fd346d2 100644 --- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx +++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx @@ -61,11 +61,11 @@ class RecentlyUsedCacheDescriptor { public: Size maPreviewSize; - std::shared_ptr< ::sd::slidesorter::cache::PageCacheManager::Cache> mpCache; + std::shared_ptr< ::sd::slidesorter::cache::BitmapCache> mpCache; RecentlyUsedCacheDescriptor( 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) {} }; @@ -110,7 +110,7 @@ namespace sd { namespace slidesorter { namespace cache { */ class PageCacheManager::PageCacheContainer : public std::unordered_map, + std::shared_ptr, CacheDescriptor::Hash, CacheDescriptor::Equal> { @@ -121,12 +121,12 @@ public: address only. */ class CompareWithCache { public: - explicit CompareWithCache(const std::shared_ptr& rpCache) + explicit CompareWithCache(const std::shared_ptr& rpCache) : mpCache(rpCache) {} bool operator () (const PageCacheContainer::value_type& rValue) const { return rValue.second == mpCache; } private: - std::shared_ptr mpCache; + std::shared_ptr mpCache; }; }; @@ -189,11 +189,11 @@ PageCacheManager::~PageCacheManager() { } -std::shared_ptr PageCacheManager::GetCache ( +std::shared_ptr PageCacheManager::GetCache ( const DocumentKey& pDocument, const Size& rPreviewSize) { - std::shared_ptr pResult; + std::shared_ptr pResult; // Look for the cache in the list of active caches. CacheDescriptor aKey (pDocument, rPreviewSize); @@ -207,7 +207,7 @@ std::shared_ptr PageCacheManager::GetCache ( // Create the cache when no suitable one does exist. 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 // contain previews that are not up-to-date. Recycle previews from @@ -222,7 +222,7 @@ std::shared_ptr PageCacheManager::GetCache ( } void PageCacheManager::Recycle ( - const std::shared_ptr& rpCache, + const std::shared_ptr& rpCache, const DocumentKey& pDocument, const Size& rPreviewSize) { @@ -256,7 +256,7 @@ void PageCacheManager::Recycle ( } } -void PageCacheManager::ReleaseCache (const std::shared_ptr& rpCache) +void PageCacheManager::ReleaseCache (const std::shared_ptr& rpCache) { PageCacheContainer::iterator iCache (::std::find_if( mpPageCaches->begin(), @@ -273,12 +273,12 @@ void PageCacheManager::ReleaseCache (const std::shared_ptr& rpCache) } } -std::shared_ptr PageCacheManager::ChangeSize ( - const std::shared_ptr& rpCache, +std::shared_ptr PageCacheManager::ChangeSize ( + const std::shared_ptr& rpCache, const Size&, const Size& rNewPreviewSize) { - std::shared_ptr pResult; + std::shared_ptr pResult; if (rpCache.get() != nullptr) { @@ -384,11 +384,11 @@ void PageCacheManager::ReleasePreviewBitmap (const SdrPage* pPage) iCache->second->ReleaseBitmap(pPage); } -std::shared_ptr PageCacheManager::GetRecentlyUsedCache ( +std::shared_ptr PageCacheManager::GetRecentlyUsedCache ( const DocumentKey& pDocument, const Size& rPreviewSize) { - std::shared_ptr pCache; + std::shared_ptr pCache; // Look for the cache in the list of recently used caches. RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument)); @@ -410,7 +410,7 @@ std::shared_ptr PageCacheManager::GetRecentlyUsedCache void PageCacheManager::PutRecentlyUsedCache( DocumentKey const & pDocument, const Size& rPreviewSize, - const std::shared_ptr& rpCache) + const std::shared_ptr& rpCache) { // Look up the list of recently used caches for the given document. RecentlyUsedPageCaches::iterator iQueue (mpRecentlyUsedPageCaches->find(pDocument)); diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx index 4d3efe48565b..fafb8605e887 100644 --- a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx +++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx @@ -40,7 +40,6 @@ class BitmapCache; class PageCacheManager { public: - typedef BitmapCache Cache; typedef std::vector< std::pair > > BestFittingPageCaches; typedef css::uno::Reference DocumentKey; @@ -57,7 +56,7 @@ public: The returned cache lives as long as somebody keeps a shared pointer and the ReleaseCache() method has not been called. */ - std::shared_ptr GetCache ( + std::shared_ptr GetCache ( const DocumentKey& pDocument, const Size& rPreviewSize); @@ -65,14 +64,14 @@ public: cache. After that the cache will live as long as the caller (and maybe others) holds its reference. */ - void ReleaseCache (const std::shared_ptr& rpCache); + void ReleaseCache (const std::shared_ptr& rpCache); /** This is an information to the cache manager that the size of preview bitmaps in the specified cache has changed. */ - std::shared_ptr ChangeSize ( - const std::shared_ptr& rpCache, + std::shared_ptr ChangeSize ( + const std::shared_ptr& rpCache, const Size& rOldPreviewSize, const Size& rNewPreviewSize); @@ -130,7 +129,7 @@ private: class Deleter; friend class Deleter; - std::shared_ptr GetRecentlyUsedCache( + std::shared_ptr GetRecentlyUsedCache( const DocumentKey& pDocument, const Size& rSize); @@ -141,13 +140,13 @@ private: void PutRecentlyUsedCache( DocumentKey const & pDocument, const Size& rPreviewSize, - const std::shared_ptr& rpCache); + const std::shared_ptr& rpCache); /** This method is used internally to initialize a newly created BitmapCache with already exisiting previews. */ void Recycle ( - const std::shared_ptr& rpCache, + const std::shared_ptr& rpCache, const DocumentKey& pDocument, const Size& rPreviewSize); }; -- cgit