bug 717175 - flush shaped-word caches if they grow excessively large. r=roc

This commit is contained in:
Jonathan Kew 2012-04-03 12:22:18 +01:00
parent 91ee28a3e2
commit 4db8132fe1

View File

@ -2129,6 +2129,12 @@ gfxFont::GetShapedWord(gfxContext *aContext,
PRInt32 aAppUnitsPerDevUnit,
PRUint32 aFlags)
{
// if the cache is getting too big, flush it and start over
if (mWordCache.Count() > 10000) {
NS_WARNING("flushing shaped-word cache");
ClearCachedWords();
}
// if there's a cached entry for this word, just return it
CacheHashKey key(aText, aLength, aHash,
aRunScript,