Chromium Code Reviews
DescriptionFix Refcount in FontDataCache for objects from FontFallbackIterator
FontFallbackIterator did previously not maintain the refcount in
FontDataCache correctly. All calls to FontDataCache::get() should be
balanced with a call to FontCache::releaseFontData().
FontFallbackIterator does not ensure this, so we'll end up never moving
fonts to m_inactiveFontData in FontDataCache, and thus practically never
releasing them on PurgeIfNeeded.
The approach for fixing this is to add a destructor to
FontDataForRangeSet so that those types of SimpleFontDatas that need to
be released in the FontDataCache actually are released.
FontDataForRangeSet is the data structure that is returned from
FontFallbackIterator to HarfBuzzShaper. So when the shaper is done using
the font, the refcount can be reduced.
In order to ensure the correct lifecyle for when the chache-releasing
destructor is called, and avoid additional copies, FontDataForRangeSet
is also turned into a RefPtr in this CL. This helps to simplify the code
on the HarfBuzzShaper side.
Unfortunately I did not see a way to create an automated test for
this. Local testing on Linux and Mac shows with logging added to
FontDataCache and the FontDataCache target size values reduced, then
visiting a URL which cycles a set of URLs in the same renderer, this
change reintroduces effective purges in FontDataCache, while there are
no effective purges in FontDataCache without this change.
Simple path maintains the refcounting correctly and does the
releaseFontData calls in FontFallbackLists destructor. So this change is
likely to affect memory consumption of the complex font code path
positively for long running renderer processes.
BUG=620283
R=eae,tzik
Committed: https://crrev.com/4eb64d8ed0fb5f4f9c90c8c6d9b24c79fd7f3a35
Cr-Commit-Position: refs/heads/master@{#401269}
Patch Set 1 #
Total comments: 1
Patch Set 2 : Fallback and fontDataAt() calls do not need release calls #Patch Set 3 : Rebased #Messages
Total messages: 28 (10 generated)
|