/src/libreoffice/include/o3tl/lru_map.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | */ |
10 | | |
11 | | #pragma once |
12 | | |
13 | | #include <cassert> |
14 | | #include <list> |
15 | | #include <version> |
16 | | #if defined __cpp_lib_memory_resource |
17 | | #include <memory_resource> |
18 | | #endif |
19 | | #include <unordered_map> |
20 | | #include <cstddef> |
21 | | |
22 | | namespace o3tl |
23 | | { |
24 | | namespace detail |
25 | | { |
26 | | // Helper base class to keep total cost for lru_map with custom item size. |
27 | | // Custom size is specified by the ValueSize functor, the default of each |
28 | | // item counting as 1 is specified using the void type. |
29 | | template <class ValueSize> class lru_map_base |
30 | | { |
31 | | public: |
32 | | // Returns total of ValueSize for all items. |
33 | | size_t total_size() const { return mCurrentSize; } |
34 | | |
35 | | protected: |
36 | | size_t mCurrentSize = 0; // sum of ValueSize for all items |
37 | | }; |
38 | | |
39 | | // By default cost of each item is 1, so it doesn't need to be tracked. |
40 | | template <> class lru_map_base<void> |
41 | | { |
42 | | }; |
43 | | } // namespace |
44 | | |
45 | | /** LRU map |
46 | | * |
47 | | * Similar to unordered_map (it actually uses it) with additionally functionality |
48 | | * which removes the entries that have been "least recently used" when the size |
49 | | * hits the specified capacity. |
50 | | * |
51 | | * It only implements the minimal methods needed and the implementation is NOT |
52 | | * thread safe. |
53 | | * |
54 | | * The implementation is as simple as possible but it still uses O(1) complexity |
55 | | * for most of the operations with a combination unordered map and linked list. |
56 | | * |
57 | | * It is optionally possible to specify a function for ValueSize template |
58 | | * argument (that can be called as 'size_t func(Value)') that will return |
59 | | * a size (cost) for an item instead of the default size of 1 for each item. |
60 | | * The size of an item must not change for an item (if needed, re-insert |
61 | | * the item). A newly inserted item is guaranteed to be in the container, |
62 | | * even if its size exceeds the maximum size. |
63 | | * |
64 | | **/ |
65 | | template <typename Key, typename Value, class KeyHash = std::hash<Key>, |
66 | | class KeyEqual = std::equal_to<Key>, class ValueSize = void> |
67 | | class lru_map final : public detail::lru_map_base<ValueSize> |
68 | | { |
69 | | public: |
70 | | typedef typename std::pair<Key, Value> key_value_pair_t; |
71 | | |
72 | | private: |
73 | | #if defined __cpp_lib_memory_resource |
74 | | typedef std::pmr::list<key_value_pair_t> list_t; |
75 | | #else |
76 | | typedef std::list<key_value_pair_t> list_t; |
77 | | #endif |
78 | | typedef typename list_t::iterator list_iterator_t; |
79 | | typedef typename list_t::const_iterator list_const_iterator_t; |
80 | | |
81 | | #if defined __cpp_lib_memory_resource |
82 | | typedef std::pmr::unordered_map<Key, list_iterator_t, KeyHash, KeyEqual> map_t; |
83 | | #else |
84 | | typedef std::unordered_map<Key, list_iterator_t, KeyHash, KeyEqual> map_t; |
85 | | #endif |
86 | | typedef typename map_t::iterator map_iterator_t; |
87 | | typedef typename map_t::const_iterator map_const_iterator_t; |
88 | | |
89 | | list_t mLruList; |
90 | | map_t mLruMap; |
91 | | size_t mMaxSize; |
92 | | |
93 | | void addSize(const Value& value) |
94 | 10.4M | { |
95 | | // by default total size is equal to number of items |
96 | | if constexpr (!std::is_void_v<ValueSize>) |
97 | 9.11M | this->mCurrentSize += ValueSize()(value); |
98 | 10.4M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::addSize((anonymous namespace)::WavyLineCache::WavyLineCacheItem const&) TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::addSize(std::__1::shared_ptr<vcl::text::TextLayoutCache const> const&) Line | Count | Source | 94 | 3.53M | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | 3.53M | this->mCurrentSize += ValueSize()(value); | 98 | 3.53M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::addSize(SalLayoutGlyphs const&) Line | Count | Source | 94 | 5.57M | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | 5.57M | this->mCurrentSize += ValueSize()(value); | 98 | 5.57M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::addSize(Bitmap const&) Line | Count | Source | 94 | 2.10k | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 2.10k | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::addSize(rtl::Reference<LogicalFontInstance> const&) Line | Count | Source | 94 | 273k | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 273k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::addSize(basegfx::B2DRange const&) Line | Count | Source | 94 | 1.08M | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 1.08M | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::addSize(std::__1::shared_ptr<SvMemoryStream> const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::addSize(Bitmap const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::addSize(gfx::DrawRoot const&) fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::addSize(std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter> const&) Line | Count | Source | 94 | 827 | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 827 | } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::addSize(rtl::OUString const&) Line | Count | Source | 94 | 108 | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::addSize(std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> > const&) Line | Count | Source | 94 | 7.02k | { | 95 | | // by default total size is equal to number of items | 96 | | if constexpr (!std::is_void_v<ValueSize>) | 97 | | this->mCurrentSize += ValueSize()(value); | 98 | 7.02k | } |
|
99 | | |
100 | | void removeSize(const Value& value) |
101 | 7.94M | { |
102 | | // by default total size is equal to number of items |
103 | | if constexpr (!std::is_void_v<ValueSize>) |
104 | 6.87M | { |
105 | 6.87M | size_t itemSize = ValueSize()(value); |
106 | 6.87M | assert(itemSize <= this->mCurrentSize); |
107 | 6.87M | this->mCurrentSize -= itemSize; |
108 | 6.87M | } |
109 | 7.94M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::removeSize((anonymous namespace)::WavyLineCache::WavyLineCacheItem const&) TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::removeSize(std::__1::shared_ptr<vcl::text::TextLayoutCache const> const&) Line | Count | Source | 101 | 3.53M | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | 3.53M | { | 105 | 3.53M | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | 3.53M | this->mCurrentSize -= itemSize; | 108 | 3.53M | } | 109 | 3.53M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::removeSize(SalLayoutGlyphs const&) Line | Count | Source | 101 | 3.33M | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | 3.33M | { | 105 | 3.33M | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | 3.33M | this->mCurrentSize -= itemSize; | 108 | 3.33M | } | 109 | 3.33M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::removeSize(Bitmap const&) Line | Count | Source | 101 | 2.10k | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | | { | 105 | | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | | this->mCurrentSize -= itemSize; | 108 | | } | 109 | 2.10k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::removeSize(basegfx::B2DRange const&) Line | Count | Source | 101 | 852k | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | | { | 105 | | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | | this->mCurrentSize -= itemSize; | 108 | | } | 109 | 852k | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::removeSize(rtl::Reference<LogicalFontInstance> const&) Line | Count | Source | 101 | 219k | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | | { | 105 | | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | | this->mCurrentSize -= itemSize; | 108 | | } | 109 | 219k | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::removeSize(std::__1::shared_ptr<SvMemoryStream> const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeSize(Bitmap const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeSize(gfx::DrawRoot const&) fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::removeSize(std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter> const&) Line | Count | Source | 101 | 816 | { | 102 | | // by default total size is equal to number of items | 103 | | if constexpr (!std::is_void_v<ValueSize>) | 104 | | { | 105 | | size_t itemSize = ValueSize()(value); | 106 | | assert(itemSize <= this->mCurrentSize); | 107 | | this->mCurrentSize -= itemSize; | 108 | | } | 109 | 816 | } |
Unexecuted instantiation: o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeSize(rtl::OUString const&) Unexecuted instantiation: o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::removeSize(std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> > const&) |
110 | | |
111 | | void removeOldestItem() |
112 | 6.87M | { |
113 | 6.87M | removeSize(mLruList.back().second); |
114 | | // remove from map |
115 | 6.87M | mLruMap.erase(mLruList.back().first); |
116 | | // remove from list |
117 | 6.87M | mLruList.pop_back(); |
118 | 6.87M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::removeOldestItem() TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::removeOldestItem() Line | Count | Source | 112 | 3.53M | { | 113 | 3.53M | removeSize(mLruList.back().second); | 114 | | // remove from map | 115 | 3.53M | mLruMap.erase(mLruList.back().first); | 116 | | // remove from list | 117 | 3.53M | mLruList.pop_back(); | 118 | 3.53M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::removeOldestItem() Line | Count | Source | 112 | 3.33M | { | 113 | 3.33M | removeSize(mLruList.back().second); | 114 | | // remove from map | 115 | 3.33M | mLruMap.erase(mLruList.back().first); | 116 | | // remove from list | 117 | 3.33M | mLruList.pop_back(); | 118 | 3.33M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::removeOldestItem() Line | Count | Source | 112 | 962 | { | 113 | 962 | removeSize(mLruList.back().second); | 114 | | // remove from map | 115 | 962 | mLruMap.erase(mLruList.back().first); | 116 | | // remove from list | 117 | 962 | mLruList.pop_back(); | 118 | 962 | } |
Unexecuted instantiation: o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::removeOldestItem() o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::removeOldestItem() Line | Count | Source | 112 | 872 | { | 113 | 872 | removeSize(mLruList.back().second); | 114 | | // remove from map | 115 | 872 | mLruMap.erase(mLruList.back().first); | 116 | | // remove from list | 117 | 872 | mLruList.pop_back(); | 118 | 872 | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::removeOldestItem() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeOldestItem() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeOldestItem() fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::removeOldestItem() Line | Count | Source | 112 | 816 | { | 113 | 816 | removeSize(mLruList.back().second); | 114 | | // remove from map | 115 | 816 | mLruMap.erase(mLruList.back().first); | 116 | | // remove from list | 117 | 816 | mLruList.pop_back(); | 118 | 816 | } |
Unexecuted instantiation: o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::removeOldestItem() Unexecuted instantiation: o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::removeOldestItem() |
119 | | |
120 | | void checkLRUItemInsert() |
121 | 10.4M | { |
122 | | if constexpr (std::is_void_v<ValueSize>) |
123 | 1.36M | { // One added, so it's enough to remove one, if needed. |
124 | 1.36M | if (mLruMap.size() > mMaxSize) |
125 | 2.65k | removeOldestItem(); |
126 | | } |
127 | | else |
128 | 9.11M | { |
129 | | // This must leave at least one item (it's called from insert). |
130 | 15.9M | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) |
131 | 6.87M | removeOldestItem(); |
132 | 9.11M | } |
133 | 10.4M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::checkLRUItemInsert() TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::checkLRUItemInsert() Line | Count | Source | 121 | 3.53M | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | | { // One added, so it's enough to remove one, if needed. | 124 | | if (mLruMap.size() > mMaxSize) | 125 | | removeOldestItem(); | 126 | | } | 127 | | else | 128 | 3.53M | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | 7.06M | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | 3.53M | removeOldestItem(); | 132 | 3.53M | } | 133 | 3.53M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::checkLRUItemInsert() Line | Count | Source | 121 | 5.57M | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | | { // One added, so it's enough to remove one, if needed. | 124 | | if (mLruMap.size() > mMaxSize) | 125 | | removeOldestItem(); | 126 | | } | 127 | | else | 128 | 5.57M | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | 8.91M | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | 3.33M | removeOldestItem(); | 132 | 5.57M | } | 133 | 5.57M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::checkLRUItemInsert() Line | Count | Source | 121 | 2.10k | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 2.10k | { // One added, so it's enough to remove one, if needed. | 124 | 2.10k | if (mLruMap.size() > mMaxSize) | 125 | 962 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 2.10k | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::checkLRUItemInsert() Line | Count | Source | 121 | 273k | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 273k | { // One added, so it's enough to remove one, if needed. | 124 | 273k | if (mLruMap.size() > mMaxSize) | 125 | 0 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 273k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::checkLRUItemInsert() Line | Count | Source | 121 | 1.08M | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 1.08M | { // One added, so it's enough to remove one, if needed. | 124 | 1.08M | if (mLruMap.size() > mMaxSize) | 125 | 872 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 1.08M | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::checkLRUItemInsert() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemInsert() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemInsert() fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::checkLRUItemInsert() Line | Count | Source | 121 | 827 | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 827 | { // One added, so it's enough to remove one, if needed. | 124 | 827 | if (mLruMap.size() > mMaxSize) | 125 | 816 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 827 | } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemInsert() Line | Count | Source | 121 | 108 | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 108 | { // One added, so it's enough to remove one, if needed. | 124 | 108 | if (mLruMap.size() > mMaxSize) | 125 | 0 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::checkLRUItemInsert() Line | Count | Source | 121 | 7.02k | { | 122 | | if constexpr (std::is_void_v<ValueSize>) | 123 | 7.02k | { // One added, so it's enough to remove one, if needed. | 124 | 7.02k | if (mLruMap.size() > mMaxSize) | 125 | 0 | removeOldestItem(); | 126 | | } | 127 | | else | 128 | | { | 129 | | // This must leave at least one item (it's called from insert). | 130 | | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) | 131 | | removeOldestItem(); | 132 | | } | 133 | 7.02k | } |
|
134 | | |
135 | | void checkLRUItemUpdate() |
136 | 0 | { |
137 | | // Item update does not change total size by default. |
138 | | if constexpr (!std::is_void_v<ValueSize>) |
139 | 0 | { |
140 | | // This must leave at least one item (it's called from insert). |
141 | 0 | while (this->mCurrentSize > mMaxSize && mLruMap.size() > 1) |
142 | 0 | removeOldestItem(); |
143 | 0 | } |
144 | 0 | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::checkLRUItemUpdate() Unexecuted instantiation: TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemUpdate() Unexecuted instantiation: fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::checkLRUItemUpdate() Unexecuted instantiation: o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::checkLRUItemUpdate() |
145 | | |
146 | | void checkLRUMaxSize() |
147 | 0 | { |
148 | | if constexpr (std::is_void_v<ValueSize>) |
149 | 0 | { |
150 | 0 | while (mLruMap.size() > mMaxSize) |
151 | 0 | removeOldestItem(); |
152 | | } |
153 | | else |
154 | | { |
155 | | while (this->mCurrentSize > mMaxSize) |
156 | | removeOldestItem(); |
157 | | } |
158 | 0 | } |
159 | | |
160 | | void clearSize() |
161 | 344k | { |
162 | | if constexpr (!std::is_void_v<ValueSize>) |
163 | 4.62k | { |
164 | | #ifdef DBG_UTIL |
165 | | for (const key_value_pair_t& item : mLruList) |
166 | | removeSize(item.second); |
167 | | assert(this->mCurrentSize == 0); |
168 | | #else |
169 | 4.62k | this->mCurrentSize = 0; |
170 | 4.62k | #endif |
171 | 4.62k | } |
172 | 344k | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::clearSize() TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::clearSize() Line | Count | Source | 161 | 29 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | 29 | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | 29 | this->mCurrentSize = 0; | 170 | 29 | #endif | 171 | 29 | } | 172 | 29 | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::clearSize() Line | Count | Source | 161 | 4.59k | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | 4.59k | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | 4.59k | this->mCurrentSize = 0; | 170 | 4.59k | #endif | 171 | 4.59k | } | 172 | 4.59k | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::clearSize() Line | Count | Source | 161 | 108 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 108 | } |
o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::clearSize() Line | Count | Source | 161 | 108 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 108 | } |
o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::clearSize() Line | Count | Source | 161 | 108 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 108 | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::clearSize() Line | Count | Source | 161 | 167k | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 167k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::clearSize() Line | Count | Source | 161 | 167k | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 167k | } |
o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::clearSize() Line | Count | Source | 161 | 4.57k | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 4.57k | } |
Unexecuted instantiation: fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::clearSize() o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::clearSize() Line | Count | Source | 161 | 108 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::clearSize() Line | Count | Source | 161 | 43 | { | 162 | | if constexpr (!std::is_void_v<ValueSize>) | 163 | | { | 164 | | #ifdef DBG_UTIL | 165 | | for (const key_value_pair_t& item : mLruList) | 166 | | removeSize(item.second); | 167 | | assert(this->mCurrentSize == 0); | 168 | | #else | 169 | | this->mCurrentSize = 0; | 170 | | #endif | 171 | | } | 172 | 43 | } |
|
173 | | |
174 | | public: |
175 | | typedef list_iterator_t iterator; |
176 | | typedef list_const_iterator_t const_iterator; |
177 | | |
178 | | lru_map(size_t nMaxSize) |
179 | 340k | : mMaxSize(nMaxSize) |
180 | 340k | { |
181 | 340k | assert(mMaxSize > 0); |
182 | 340k | } o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 108 | : mMaxSize(nMaxSize) | 180 | 108 | { | 181 | | assert(mMaxSize > 0); | 182 | 108 | } |
o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 108 | : mMaxSize(nMaxSize) | 180 | 108 | { | 181 | | assert(mMaxSize > 0); | 182 | 108 | } |
o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 108 | : mMaxSize(nMaxSize) | 180 | 108 | { | 181 | | assert(mMaxSize > 0); | 182 | 108 | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::lru_map(unsigned long) Line | Count | Source | 179 | 167k | : mMaxSize(nMaxSize) | 180 | 167k | { | 181 | | assert(mMaxSize > 0); | 182 | 167k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 167k | : mMaxSize(nMaxSize) | 180 | 167k | { | 181 | | assert(mMaxSize > 0); | 182 | 167k | } |
o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 4.57k | : mMaxSize(nMaxSize) | 180 | 4.57k | { | 181 | | assert(mMaxSize > 0); | 182 | 4.57k | } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 108 | : mMaxSize(nMaxSize) | 180 | 108 | { | 181 | | assert(mMaxSize > 0); | 182 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::lru_map(unsigned long) Line | Count | Source | 179 | 43 | : mMaxSize(nMaxSize) | 180 | 43 | { | 181 | | assert(mMaxSize > 0); | 182 | 43 | } |
|
183 | | #if defined __cpp_lib_memory_resource |
184 | | lru_map(size_t nMaxSize, std::pmr::memory_resource* r) |
185 | 151 | : mLruList(r) |
186 | 151 | , mLruMap(r) |
187 | 151 | , mMaxSize(nMaxSize) |
188 | 151 | { |
189 | 151 | assert(mMaxSize > 0); |
190 | 151 | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::lru_map(unsigned long, std::__1::pmr::memory_resource*) TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::lru_map(unsigned long, std::__1::pmr::memory_resource*) Line | Count | Source | 185 | 29 | : mLruList(r) | 186 | 29 | , mLruMap(r) | 187 | 29 | , mMaxSize(nMaxSize) | 188 | 29 | { | 189 | | assert(mMaxSize > 0); | 190 | 29 | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::lru_map(unsigned long, std::__1::pmr::memory_resource*) Line | Count | Source | 185 | 14 | : mLruList(r) | 186 | 14 | , mLruMap(r) | 187 | 14 | , mMaxSize(nMaxSize) | 188 | 14 | { | 189 | | assert(mMaxSize > 0); | 190 | 14 | } |
fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::lru_map(unsigned long, std::__1::pmr::memory_resource*) Line | Count | Source | 185 | 108 | : mLruList(r) | 186 | 108 | , mLruMap(r) | 187 | 108 | , mMaxSize(nMaxSize) | 188 | 108 | { | 189 | | assert(mMaxSize > 0); | 190 | 108 | } |
|
191 | | #endif |
192 | | ~lru_map() |
193 | 340k | { |
194 | 340k | clearSize(); |
195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we |
196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. |
197 | 340k | mLruMap.clear(); |
198 | 340k | list_t(mLruList.get_allocator()).swap(mLruList); |
199 | 340k | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::~lru_map() TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::~lru_map() Line | Count | Source | 193 | 29 | { | 194 | 29 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 29 | mLruMap.clear(); | 198 | 29 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 29 | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::~lru_map() Line | Count | Source | 193 | 14 | { | 194 | 14 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 14 | mLruMap.clear(); | 198 | 14 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 14 | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::~lru_map() Line | Count | Source | 193 | 108 | { | 194 | 108 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 108 | mLruMap.clear(); | 198 | 108 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 108 | } |
o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::~lru_map() Line | Count | Source | 193 | 108 | { | 194 | 108 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 108 | mLruMap.clear(); | 198 | 108 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 108 | } |
o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::~lru_map() Line | Count | Source | 193 | 108 | { | 194 | 108 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 108 | mLruMap.clear(); | 198 | 108 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 108 | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::~lru_map() Line | Count | Source | 193 | 167k | { | 194 | 167k | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 167k | mLruMap.clear(); | 198 | 167k | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 167k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::~lru_map() Line | Count | Source | 193 | 167k | { | 194 | 167k | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 167k | mLruMap.clear(); | 198 | 167k | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 167k | } |
o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::~lru_map() Line | Count | Source | 193 | 4.57k | { | 194 | 4.57k | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 4.57k | mLruMap.clear(); | 198 | 4.57k | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 4.57k | } |
Unexecuted instantiation: fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::~lru_map() o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::~lru_map() Line | Count | Source | 193 | 108 | { | 194 | 108 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 108 | mLruMap.clear(); | 198 | 108 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::~lru_map() Line | Count | Source | 193 | 43 | { | 194 | 43 | clearSize(); | 195 | | // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we | 196 | | // get calls into lru_map while we are in destruction, so use the swap-and-clear idiom to avoid those problems. | 197 | 43 | mLruMap.clear(); | 198 | 43 | list_t(mLruList.get_allocator()).swap(mLruList); | 199 | 43 | } |
|
200 | | |
201 | | void setMaxSize(size_t nMaxSize) |
202 | 0 | { |
203 | 0 | mMaxSize = nMaxSize; |
204 | 0 | assert(mMaxSize > 0); |
205 | 0 | checkLRUMaxSize(); |
206 | 0 | } |
207 | | |
208 | | list_const_iterator_t insert(key_value_pair_t& rPair) |
209 | | { |
210 | | map_iterator_t i = mLruMap.find(rPair.first); |
211 | | |
212 | | if (i == mLruMap.end()) // doesn't exist -> add to queue and map |
213 | | { |
214 | | addSize(rPair.second); |
215 | | // add to front of the list |
216 | | mLruList.push_front(rPair); |
217 | | // add the list position (iterator) to the map |
218 | | auto it = mLruList.begin(); |
219 | | mLruMap[it->first] = it; |
220 | | checkLRUItemInsert(); |
221 | | } |
222 | | else // already exists -> replace value |
223 | | { |
224 | | // update total cost |
225 | | removeSize(i->second->second); |
226 | | addSize(rPair.second); |
227 | | // replace value |
228 | | i->second->second = rPair.second; |
229 | | // bring to front of the lru list |
230 | | mLruList.splice(mLruList.begin(), mLruList, i->second); |
231 | | checkLRUItemUpdate(); |
232 | | } |
233 | | |
234 | | return mLruList.cbegin(); |
235 | | } |
236 | | |
237 | | list_const_iterator_t insert(key_value_pair_t&& rPair) |
238 | 10.4M | { |
239 | 10.4M | map_iterator_t i = mLruMap.find(rPair.first); |
240 | | |
241 | 10.4M | if (i == mLruMap.end()) // doesn't exist -> add to list and map |
242 | 10.4M | { |
243 | 10.4M | addSize(rPair.second); |
244 | | // add to front of the list |
245 | 10.4M | mLruList.push_front(std::move(rPair)); |
246 | | // add the list position (iterator) to the map |
247 | 10.4M | auto it = mLruList.begin(); |
248 | 10.4M | mLruMap[it->first] = it; |
249 | 10.4M | checkLRUItemInsert(); |
250 | 10.4M | } |
251 | 0 | else // already exists -> replace value |
252 | 0 | { |
253 | 0 | removeSize(i->second->second); |
254 | 0 | addSize(rPair.second); |
255 | | // replace value |
256 | 0 | i->second->second = std::move(rPair.second); |
257 | | // push to back of the lru list |
258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); |
259 | 0 | checkLRUItemUpdate(); |
260 | 0 | } |
261 | | |
262 | 10.4M | return mLruList.cbegin(); |
263 | 10.4M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::insert(std::__1::pair<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem>&&) TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::insert(std::__1::pair<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const> >&&) Line | Count | Source | 238 | 3.53M | { | 239 | 3.53M | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 3.53M | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 3.53M | { | 243 | 3.53M | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 3.53M | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 3.53M | auto it = mLruList.begin(); | 248 | 3.53M | mLruMap[it->first] = it; | 249 | 3.53M | checkLRUItemInsert(); | 250 | 3.53M | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 3.53M | return mLruList.cbegin(); | 263 | 3.53M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::insert(std::__1::pair<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs>&&) Line | Count | Source | 238 | 5.57M | { | 239 | 5.57M | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 5.57M | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 5.57M | { | 243 | 5.57M | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 5.57M | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 5.57M | auto it = mLruList.begin(); | 248 | 5.57M | mLruMap[it->first] = it; | 249 | 5.57M | checkLRUItemInsert(); | 250 | 5.57M | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 5.57M | return mLruList.cbegin(); | 263 | 5.57M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::insert(std::__1::pair<ScaleCacheKey, Bitmap>&&) Line | Count | Source | 238 | 2.10k | { | 239 | 2.10k | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 2.10k | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 2.10k | { | 243 | 2.10k | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 2.10k | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 2.10k | auto it = mLruList.begin(); | 248 | 2.10k | mLruMap[it->first] = it; | 249 | 2.10k | checkLRUItemInsert(); | 250 | 2.10k | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 2.10k | return mLruList.cbegin(); | 263 | 2.10k | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::insert(std::__1::pair<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance> >&&) Line | Count | Source | 238 | 273k | { | 239 | 273k | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 273k | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 273k | { | 243 | 273k | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 273k | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 273k | auto it = mLruList.begin(); | 248 | 273k | mLruMap[it->first] = it; | 249 | 273k | checkLRUItemInsert(); | 250 | 273k | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 273k | return mLruList.cbegin(); | 263 | 273k | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::insert(std::__1::pair<GlyphBoundRectCacheKey, basegfx::B2DRange>&&) Line | Count | Source | 238 | 1.08M | { | 239 | 1.08M | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 1.08M | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 1.08M | { | 243 | 1.08M | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 1.08M | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 1.08M | auto it = mLruList.begin(); | 248 | 1.08M | mLruMap[it->first] = it; | 249 | 1.08M | checkLRUItemInsert(); | 250 | 1.08M | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 1.08M | return mLruList.cbegin(); | 263 | 1.08M | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::insert(std::__1::pair<unsigned int, std::__1::shared_ptr<SvMemoryStream> >&&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::insert(std::__1::pair<rtl::OUString, Bitmap>&&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::insert(std::__1::pair<rtl::OUString, gfx::DrawRoot>&&) fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::insert(std::__1::pair<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter> >&&) Line | Count | Source | 238 | 827 | { | 239 | 827 | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 827 | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 827 | { | 243 | 827 | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 827 | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 827 | auto it = mLruList.begin(); | 248 | 827 | mLruMap[it->first] = it; | 249 | 827 | checkLRUItemInsert(); | 250 | 827 | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 827 | return mLruList.cbegin(); | 263 | 827 | } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::insert(std::__1::pair<rtl::OUString, rtl::OUString>&&) Line | Count | Source | 238 | 108 | { | 239 | 108 | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 108 | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 108 | { | 243 | 108 | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 108 | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 108 | auto it = mLruList.begin(); | 248 | 108 | mLruMap[it->first] = it; | 249 | 108 | checkLRUItemInsert(); | 250 | 108 | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 108 | return mLruList.cbegin(); | 263 | 108 | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::insert(std::__1::pair<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> > >&&) Line | Count | Source | 238 | 7.02k | { | 239 | 7.02k | map_iterator_t i = mLruMap.find(rPair.first); | 240 | | | 241 | 7.02k | if (i == mLruMap.end()) // doesn't exist -> add to list and map | 242 | 7.02k | { | 243 | 7.02k | addSize(rPair.second); | 244 | | // add to front of the list | 245 | 7.02k | mLruList.push_front(std::move(rPair)); | 246 | | // add the list position (iterator) to the map | 247 | 7.02k | auto it = mLruList.begin(); | 248 | 7.02k | mLruMap[it->first] = it; | 249 | 7.02k | checkLRUItemInsert(); | 250 | 7.02k | } | 251 | 0 | else // already exists -> replace value | 252 | 0 | { | 253 | 0 | removeSize(i->second->second); | 254 | 0 | addSize(rPair.second); | 255 | | // replace value | 256 | 0 | i->second->second = std::move(rPair.second); | 257 | | // push to back of the lru list | 258 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 259 | 0 | checkLRUItemUpdate(); | 260 | 0 | } | 261 | | | 262 | 7.02k | return mLruList.cbegin(); | 263 | 7.02k | } |
|
264 | | |
265 | | list_const_iterator_t find(const Key& key) |
266 | 123M | { |
267 | 123M | const map_iterator_t i = mLruMap.find(key); |
268 | 123M | if (i == mLruMap.cend()) // can't find entry for the key |
269 | 32.6M | { |
270 | | // return empty iterator |
271 | 32.6M | return mLruList.cend(); |
272 | 32.6M | } |
273 | 90.4M | else |
274 | 90.4M | { |
275 | | // push to back of the lru list |
276 | 90.4M | mLruList.splice(mLruList.begin(), mLruList, i->second); |
277 | 90.4M | return i->second; |
278 | 90.4M | } |
279 | 123M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::find((anonymous namespace)::WavyLineCache::Key const&) TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::find(rtl::OUString const&) Line | Count | Source | 266 | 20.6M | { | 267 | 20.6M | const map_iterator_t i = mLruMap.find(key); | 268 | 20.6M | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 3.53M | { | 270 | | // return empty iterator | 271 | 3.53M | return mLruList.cend(); | 272 | 3.53M | } | 273 | 17.0M | else | 274 | 17.0M | { | 275 | | // push to back of the lru list | 276 | 17.0M | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 17.0M | return i->second; | 278 | 17.0M | } | 279 | 20.6M | } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::find(SalLayoutGlyphsCache::CachedGlyphsKey const&) Line | Count | Source | 266 | 13.3M | { | 267 | 13.3M | const map_iterator_t i = mLruMap.find(key); | 268 | 13.3M | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 8.27M | { | 270 | | // return empty iterator | 271 | 8.27M | return mLruList.cend(); | 272 | 8.27M | } | 273 | 5.09M | else | 274 | 5.09M | { | 275 | | // push to back of the lru list | 276 | 5.09M | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 5.09M | return i->second; | 278 | 5.09M | } | 279 | 13.3M | } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::find(ScaleCacheKey const&) Line | Count | Source | 266 | 2.10k | { | 267 | 2.10k | const map_iterator_t i = mLruMap.find(key); | 268 | 2.10k | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 2.10k | { | 270 | | // return empty iterator | 271 | 2.10k | return mLruList.cend(); | 272 | 2.10k | } | 273 | 0 | else | 274 | 0 | { | 275 | | // push to back of the lru list | 276 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 0 | return i->second; | 278 | 0 | } | 279 | 2.10k | } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::find(vcl::font::FontSelectPattern const&) Line | Count | Source | 266 | 38.7M | { | 267 | 38.7M | const map_iterator_t i = mLruMap.find(key); | 268 | 38.7M | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 19.6M | { | 270 | | // return empty iterator | 271 | 19.6M | return mLruList.cend(); | 272 | 19.6M | } | 273 | 19.1M | else | 274 | 19.1M | { | 275 | | // push to back of the lru list | 276 | 19.1M | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 19.1M | return i->second; | 278 | 19.1M | } | 279 | 38.7M | } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::find(GlyphBoundRectCacheKey const&) Line | Count | Source | 266 | 50.2M | { | 267 | 50.2M | const map_iterator_t i = mLruMap.find(key); | 268 | 50.2M | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 1.08M | { | 270 | | // return empty iterator | 271 | 1.08M | return mLruList.cend(); | 272 | 1.08M | } | 273 | 49.1M | else | 274 | 49.1M | { | 275 | | // push to back of the lru list | 276 | 49.1M | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 49.1M | return i->second; | 278 | 49.1M | } | 279 | 50.2M | } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::find(unsigned int const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::find(rtl::OUString const&) Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::find(rtl::OUString const&) fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::find((anonymous namespace)::FontOptionsKey const&) Line | Count | Source | 266 | 1.56k | { | 267 | 1.56k | const map_iterator_t i = mLruMap.find(key); | 268 | 1.56k | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 827 | { | 270 | | // return empty iterator | 271 | 827 | return mLruList.cend(); | 272 | 827 | } | 273 | 735 | else | 274 | 735 | { | 275 | | // push to back of the lru list | 276 | 735 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 735 | return i->second; | 278 | 735 | } | 279 | 1.56k | } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::find(rtl::OUString const&) Line | Count | Source | 266 | 63.7k | { | 267 | 63.7k | const map_iterator_t i = mLruMap.find(key); | 268 | 63.7k | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 63.7k | { | 270 | | // return empty iterator | 271 | 63.7k | return mLruList.cend(); | 272 | 63.7k | } | 273 | 0 | else | 274 | 0 | { | 275 | | // push to back of the lru list | 276 | 0 | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 0 | return i->second; | 278 | 0 | } | 279 | 63.7k | } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::find(ScAddress const&) Line | Count | Source | 266 | 14.0k | { | 267 | 14.0k | const map_iterator_t i = mLruMap.find(key); | 268 | 14.0k | if (i == mLruMap.cend()) // can't find entry for the key | 269 | 7.02k | { | 270 | | // return empty iterator | 271 | 7.02k | return mLruList.cend(); | 272 | 7.02k | } | 273 | 7.01k | else | 274 | 7.01k | { | 275 | | // push to back of the lru list | 276 | 7.01k | mLruList.splice(mLruList.begin(), mLruList, i->second); | 277 | 7.01k | return i->second; | 278 | 7.01k | } | 279 | 14.0k | } |
|
280 | | |
281 | | // reverse-iterates the list removing all items matching the predicate |
282 | | template <class UnaryPredicate> void remove_if(UnaryPredicate pred) |
283 | 4.52M | { |
284 | 4.52M | auto it = mLruList.rbegin(); |
285 | 69.2M | while (it != mLruList.rend()) |
286 | 64.7M | { |
287 | 64.7M | if (pred(*it)) |
288 | 1.07M | { |
289 | 1.07M | removeSize(it->second); |
290 | 1.07M | mLruMap.erase(it->first); |
291 | 1.07M | it = decltype(it){ mLruList.erase(std::next(it).base()) }; |
292 | 1.07M | } |
293 | 63.6M | else |
294 | 63.6M | ++it; |
295 | 64.7M | } |
296 | 4.52M | } salvtables.cxx:void o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::remove_if<SalBitmap::DropScaledCache()::$_0>(SalBitmap::DropScaledCache()::$_0) Line | Count | Source | 283 | 4.08M | { | 284 | 4.08M | auto it = mLruList.rbegin(); | 285 | 4.15M | while (it != mLruList.rend()) | 286 | 73.4k | { | 287 | 73.4k | if (pred(*it)) | 288 | 1.14k | { | 289 | 1.14k | removeSize(it->second); | 290 | 1.14k | mLruMap.erase(it->first); | 291 | 1.14k | it = decltype(it){ mLruList.erase(std::next(it).base()) }; | 292 | 1.14k | } | 293 | 72.3k | else | 294 | 72.3k | ++it; | 295 | 73.4k | } | 296 | 4.08M | } |
Unexecuted instantiation: svdata.cxx:void o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::remove_if<ImplSVData::dropCaches()::$_0>(ImplSVData::dropCaches()::$_0) fontcache.cxx:void o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::remove_if<ImplFontCache::GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&)::$_0>(ImplFontCache::GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&)::$_0) Line | Count | Source | 283 | 219k | { | 284 | 219k | auto it = mLruList.rbegin(); | 285 | 18.5M | while (it != mLruList.rend()) | 286 | 18.3M | { | 287 | 18.3M | if (pred(*it)) | 288 | 219k | { | 289 | 219k | removeSize(it->second); | 290 | 219k | mLruMap.erase(it->first); | 291 | 219k | it = decltype(it){ mLruList.erase(std::next(it).base()) }; | 292 | 219k | } | 293 | 18.0M | else | 294 | 18.0M | ++it; | 295 | 18.3M | } | 296 | 219k | } |
fontcache.cxx:void o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::remove_if<ImplFontCache::GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&)::$_0::operator()(std::__1::pair<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance> > const&) const::{lambda(std::__1::pair<GlyphBoundRectCacheKey, basegfx::B2DRange> const&)#1}>(ImplFontCache::GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&)::$_0::operator()(std::__1::pair<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance> > const&) const::{lambda(std::__1::pair<GlyphBoundRectCacheKey, basegfx::B2DRange> const&)#1})Line | Count | Source | 283 | 219k | { | 284 | 219k | auto it = mLruList.rbegin(); | 285 | 46.5M | while (it != mLruList.rend()) | 286 | 46.3M | { | 287 | 46.3M | if (pred(*it)) | 288 | 851k | { | 289 | 851k | removeSize(it->second); | 290 | 851k | mLruMap.erase(it->first); | 291 | 851k | it = decltype(it){ mLruList.erase(std::next(it).base()) }; | 292 | 851k | } | 293 | 45.4M | else | 294 | 45.4M | ++it; | 295 | 46.3M | } | 296 | 219k | } |
|
297 | | |
298 | 5.74M | list_const_iterator_t begin() const { return mLruList.cbegin(); }Unexecuted instantiation: TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::begin() const o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::begin() const Line | Count | Source | 298 | 5.57M | list_const_iterator_t begin() const { return mLruList.cbegin(); } |
Unexecuted instantiation: o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::begin() const o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::begin() const Line | Count | Source | 298 | 167k | list_const_iterator_t begin() const { return mLruList.cbegin(); } |
Unexecuted instantiation: o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::begin() const |
299 | | |
300 | 125M | list_const_iterator_t end() const { return mLruList.cend(); }Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::end() const TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::end() const Line | Count | Source | 300 | 20.6M | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::end() const Line | Count | Source | 300 | 16.1M | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::end() const Line | Count | Source | 300 | 2.10k | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::end() const Line | Count | Source | 300 | 38.9M | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::end() const Line | Count | Source | 300 | 50.2M | list_const_iterator_t end() const { return mLruList.cend(); } |
Unexecuted instantiation: o3tl::lru_map<unsigned int, std::__1::shared_ptr<SvMemoryStream>, std::__1::hash<unsigned int>, std::__1::equal_to<unsigned int>, void>::end() const Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::end() const Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::end() const fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::end() const Line | Count | Source | 300 | 1.56k | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<rtl::OUString, rtl::OUString, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::end() const Line | Count | Source | 300 | 63.7k | list_const_iterator_t end() const { return mLruList.cend(); } |
o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::end() const Line | Count | Source | 300 | 14.0k | list_const_iterator_t end() const { return mLruList.cend(); } |
|
301 | | |
302 | | size_t size() const |
303 | 18.5M | { |
304 | 18.5M | assert(mLruMap.size() == mLruList.size()); |
305 | 18.5M | return mLruMap.size(); |
306 | 18.5M | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::size() const Unexecuted instantiation: TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::size() const Unexecuted instantiation: o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::size() const Unexecuted instantiation: o3tl::lru_map<ScaleCacheKey, Bitmap, std::__1::hash<ScaleCacheKey>, std::__1::equal_to<ScaleCacheKey>, void>::size() const o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::size() const Line | Count | Source | 303 | 18.5M | { | 304 | | assert(mLruMap.size() == mLruList.size()); | 305 | 18.5M | return mLruMap.size(); | 306 | 18.5M | } |
Unexecuted instantiation: fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::size() const Unexecuted instantiation: o3tl::lru_map<ScAddress, std::__1::unique_ptr<ScFormulaCell, std::__1::default_delete<ScFormulaCell> >, std::__1::hash<ScAddress>, std::__1::equal_to<ScAddress>, void>::size() const |
307 | | |
308 | | size_t empty() const |
309 | | { |
310 | | assert(mLruMap.empty() == mLruList.empty()); |
311 | | return mLruMap.empty(); |
312 | | } |
313 | | |
314 | | // size_t total_size() const; - only if custom ValueSize |
315 | | |
316 | | void clear() |
317 | 4.57k | { |
318 | 4.57k | clearSize(); |
319 | 4.57k | map_t(mLruMap.get_allocator()).swap(mLruMap); |
320 | 4.57k | list_t(mLruList.get_allocator()).swap(mLruList); |
321 | 4.57k | } Unexecuted instantiation: textline.cxx:o3tl::lru_map<(anonymous namespace)::WavyLineCache::Key, (anonymous namespace)::WavyLineCache::WavyLineCacheItem, (anonymous namespace)::WavyLineCache::Hash, std::__1::equal_to<(anonymous namespace)::WavyLineCache::Key>, void>::clear() Unexecuted instantiation: TextLayoutCache.cxx:o3tl::lru_map<rtl::OUString, std::__1::shared_ptr<vcl::text::TextLayoutCache const>, vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual, vcl::text::(anonymous namespace)::TextLayoutCacheCost>::clear() o3tl::lru_map<SalLayoutGlyphsCache::CachedGlyphsKey, SalLayoutGlyphs, SalLayoutGlyphsCache::CachedGlyphsHash, std::__1::equal_to<SalLayoutGlyphsCache::CachedGlyphsKey>, SalLayoutGlyphsCache::GlyphsCost>::clear() Line | Count | Source | 317 | 4.57k | { | 318 | 4.57k | clearSize(); | 319 | 4.57k | map_t(mLruMap.get_allocator()).swap(mLruMap); | 320 | 4.57k | list_t(mLruList.get_allocator()).swap(mLruList); | 321 | 4.57k | } |
Unexecuted instantiation: o3tl::lru_map<rtl::OUString, gfx::DrawRoot, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::clear() Unexecuted instantiation: o3tl::lru_map<rtl::OUString, Bitmap, std::__1::hash<rtl::OUString>, std::__1::equal_to<rtl::OUString>, void>::clear() Unexecuted instantiation: o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, ImplFontCache::IFSD_Hash, ImplFontCache::IFSD_Equal, void>::clear() Unexecuted instantiation: o3tl::lru_map<GlyphBoundRectCacheKey, basegfx::B2DRange, GlyphBoundRectCacheHash, std::__1::equal_to<GlyphBoundRectCacheKey>, void>::clear() Unexecuted instantiation: fontconfig.cxx:o3tl::lru_map<(anonymous namespace)::FontOptionsKey, std::__1::unique_ptr<_FcPattern, (anonymous namespace)::FcPatternDeleter>, std::__1::hash<(anonymous namespace)::FontOptionsKey>, std::__1::equal_to<(anonymous namespace)::FontOptionsKey>, void>::clear() |
322 | | }; |
323 | | } |
324 | | |
325 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |