Bug 22861 - Turn the FontCache into a singleton
Summary: Turn the FontCache into a singleton
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-14 18:52 PST by Julien Chaffraix
Modified: 2009-01-12 02:52 PST (History)
3 users (show)

See Also:


Attachments
Proposed fix (19.67 KB, patch)
2008-12-14 18:58 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff
Same as the first version, with corrected ChangeLogs (19.76 KB, patch)
2008-12-16 13:17 PST, Julien Chaffraix
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2008-12-14 18:52:22 PST
As discussed on the mailing list, this is part of the initial clean-up for the fontcache.

Patch forthcoming.
Comment 1 Julien Chaffraix 2008-12-14 18:58:34 PST
Created attachment 26020 [details]
Proposed fix
Comment 2 Sam Weinig 2008-12-15 14:00:19 PST
Why is it a good idea to turn the FontCache into a singleton?  What does this get us?
Comment 3 Julien Chaffraix 2008-12-16 02:09:18 PST
(In reply to comment #2)
> Why is it a good idea to turn the FontCache into a singleton?  What does this
> get us?
> 

First it makes FontCache coherent with the rest of WebCore: I have not found another class that only bears static methods inside WebCore. IMHO it is also particularly relevant to make this class close to the Cache.
Then it makes it cristal clear that we are using a singleton: static methods + static HashMaps / HashList inside the .cpp sounds like a hidden singleton.
Finally when you start hacking the FontCache as it is now, you have to find the different definitions mixed with the code in FontCache.cpp. Making it a real class is a first step into moving those definitons in their own files and move the static HashMaps / HashList in the header.

So to answer the benefits: right now, it adds a little overhead to the compiled code. But within a few changes, we should have a more readable code.
Comment 4 Julien Chaffraix 2008-12-16 13:17:08 PST
Created attachment 26065 [details]
Same as the first version, with corrected ChangeLogs

I had forgotten to update the ChangeLog in the WebKit directory, so attached is an updated version.
Comment 5 Darin Adler 2009-01-02 10:56:14 PST
Comment on attachment 26065 [details]
Same as the first version, with corrected ChangeLogs

I'm not entirely convinced this is an improvement, but it seems OK. r=me
Comment 6 Julien Chaffraix 2009-01-12 02:52:18 PST
Landed patch in r39823.