mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
LruCache: Make the LRU cache implementation thread safe
This commit is contained in:
parent
c1affc0a0e
commit
667b3fae86
3 changed files with 35 additions and 6 deletions
|
|
@ -479,7 +479,7 @@ RectangleListSpriteBatch::~RectangleListSpriteBatch()
|
|||
void RectangleListSpriteBatch::release()
|
||||
{
|
||||
whiteRectangle = nullptr;
|
||||
spriteBatches = {};
|
||||
spriteBatches.clear();
|
||||
destinations.free();
|
||||
destinationsCapacity = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,13 +196,11 @@ public:
|
|||
//==============================================================================
|
||||
void reset()
|
||||
{
|
||||
const ScopedLock sl { lock };
|
||||
cache = {};
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
const auto& get (const Font& font, const int glyphNumber)
|
||||
{
|
||||
const ScopedLock sl { lock };
|
||||
return cache.get (Key { font, glyphNumber }, [] (const auto& key)
|
||||
{
|
||||
auto fontHeight = key.font.getHeight();
|
||||
|
|
@ -233,7 +231,6 @@ private:
|
|||
};
|
||||
|
||||
LruCache<Key, std::vector<GlyphLayer>> cache;
|
||||
CriticalSection lock;
|
||||
|
||||
static GlyphCache*& getSingletonPointer() noexcept
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue