diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index 7abfcf1efaa5f..8032ed81b65b6 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -78,8 +78,10 @@ void TextLayoutCache::operator()(TextLayoutCacheKey& text, sp& /* * Cache clearing */ -void TextLayoutCache::clear() { +void TextLayoutCache::purgeCaches() { + AutoMutex _l(mLock); mCache.clear(); + mShaper->purgeCaches(); } /* @@ -965,8 +967,7 @@ sp TextLayoutEngine::getValue(const SkPaint* paint, const jchar void TextLayoutEngine::purgeCaches() { #if USE_TEXT_LAYOUT_CACHE - mTextLayoutCache->clear(); - mShaper->purgeCaches(); + mTextLayoutCache->purgeCaches(); #if DEBUG_GLYPHS ALOGD("Purged TextLayoutEngine caches"); #endif diff --git a/core/jni/android/graphics/TextLayoutCache.h b/core/jni/android/graphics/TextLayoutCache.h index 64b33a0a2c3d2..1f4e22c8274fc 100644 --- a/core/jni/android/graphics/TextLayoutCache.h +++ b/core/jni/android/graphics/TextLayoutCache.h @@ -276,7 +276,7 @@ public: /** * Clear the cache */ - void clear(); + void purgeCaches(); private: TextLayoutShaper* mShaper;