Bug 1409446 - Deal with scenario of two interchangeable DisplayItemClipChain objects causing a cache miss. r=mstange

MozReview-Commit-ID: 4FQvOmMUUKH

--HG--
extra : rebase_source : 9b497dc5f97345aee55f8dbf25d1db926c93c68f
This commit is contained in:
Kartikaya Gupta 2017-10-24 15:45:59 -04:00
Родитель fdefb982b7
Коммит 9b3a9d0d62
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -228,6 +228,19 @@ ScrollingLayersHelper::RecurseAndDefineAsr(nsDisplayItem* aItem,
ids.second = mBuilder->GetCacheOverride(aChain); ids.second = mBuilder->GetCacheOverride(aChain);
} else { } else {
auto it = aCache.find(aChain); auto it = aCache.find(aChain);
if (it == aCache.end()) {
// Degenerate case, where there are two clip chain items that are
// fundamentally the same but are different objects and so we can't
// find it in the cache via hashing. Linear search for it instead.
// XXX This shouldn't happen very often but it might still turn out
// to be a performance cliff, so we should figure out a better way to
// deal with this.
for (it = aCache.begin(); it != aCache.end(); it++) {
if (DisplayItemClipChain::Equal(aChain, it->first)) {
break;
}
}
}
MOZ_ASSERT(it != aCache.end()); MOZ_ASSERT(it != aCache.end());
ids.second = Some(it->second); ids.second = Some(it->second);
} }