[webkit-dev] FontCache refactoring proposal

Dan Bernstein mitz at apple.com
Thu Dec 11 09:40:37 PST 2008


Hi Julien,

On Dec 11, 2008, at 2:14 AM, Julien Chaffraix wrote:

> Hi everyone,
>
> while working on memory leaks inside WebCore, the Pleyo team has found
> that the FontCache was responsible for a few of them.

It would be good to have a bug filed about each leak.

> In order to
> solve those leaks and prevent future ones, we have done a refactoring
> of the FontCache and its internal working (mainly making the
> SimpleFontData Refcounted and change several sites inside WebCore to
> hold RefPtr). The modification are done and they are too big for
> integration right now so we would like to split them and contribute
> them back to WebKit. You will find below the different parts that we
> have worked on (this will follow more or less the order in which they
> will be contributed back):
>
> - initial clean-up
>    * share some methods that are the same in all implementations
>    * add a 'platform' suffix for those that should be implemented  
> per platform
>    * avoid using FontPlatformData ouside the few font files inside  
> platform
>    * make FontCache a singleton and remove all the current static  
> methods
>
> - Add leaks probe using RefCountedLeakCounter to track our progress as
> well as see where the leaks occurs.
>
> - Make the FontCache mechanism use smart pointers
>    * have SimpleFontData derive from RefCounted
>    * use internally RefPtr
>    * use RefPtr for external reference to SimpleFontData all over  
> WebCore
>
> - FontCache HashMap refactoring: currently some HashMaps return
> FontPlatformData internally and there is a mapping between those and
> SimpleFontData so it should be better to use the SimpleFontData
> instead.

How do you plan to maintain the constructor
Font::Font(const FontPlatformData& fontData, bool isPrinterFont)
without a mapping from FontPlatformData to FontData?

—Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20081211/14a65188/attachment.html>


More information about the webkit-dev mailing list