[webkit-reviews] review requested: [Bug 61875] Fonts returned by FontCache::getFontDataForCharacters() are never released : [Attachment 95641] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 1 12:22:12 PDT 2011


Michael Saboff <msaboff at apple.com> has asked  for review:
Bug 61875: Fonts returned by FontCache::getFontDataForCharacters() are never
released
https://bugs.webkit.org/show_bug.cgi?id=61875

Attachment 95641: Proposed patch
https://bugs.webkit.org/attachment.cgi?id=95641&action=review

------- Additional Comments from Michael Saboff <msaboff at apple.com>
This patch adds cleanup code for system fall back fonts.  It also provides an
auto release object to wrap around accesses to fonts via the
FontCache::getFontDataForCharacters() method.  When that object is destructed,
it calls FontCache::releaseFontData with the appropriate reference count.

The assureOneHold code is needed for the case where a view uses a system
fallback font that was brought into the glyph page trees via another prior and
currently open view.  The second view would still have one reference, even if
the first view closed dereferenced the font.  This makes it so that every using
view has at least one reference on a system fallback font that it uses.

NOTE: This patch does not add the appropriate code to platforms other than Mac
to keep track of the number of references via those platform's
FontCache::getFontDataForCharacters method.  That code will be added in a
subsequent patch.

An alternative approach to this problem has been considered and that is using
RefPtr<FontData> for most accesses to font data. The exception is the glyph
page node tree, since that tree is purged of references when via the
SimpleFontData destructor.  FontData returned from the glyph page tree code
would need to increment the returned font's reference count.

This patch allows for almost all fonts to be released when all views are
closed.  The only active fonts are those used by the rest of the application.


More information about the webkit-reviews mailing list