[webkit-dev] FontCache refactoring proposal

Julien Chaffraix jchaffraix at pleyo.com
Thu Dec 11 02:14:07 PST 2008


Hi everyone,

while working on memory leaks inside WebCore, the Pleyo team has found
that the FontCache was responsible for a few of them. 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.

Those items are open to discussion and we will try to address the
comments before starting and as the work moves forward.

Best regards,
Julien


More information about the webkit-dev mailing list