[webkit-dev] Pattern for singleton classes instance getters

Chris Dumez cdumez at apple.com
Wed Jan 28 11:30:59 PST 2015


Hi,

I noticed that we are currently not very consistent in WebKit in the way we implement singleton classes instance getters.
- Some classes use free functions (like MemoryCache, and PageCache until I updated it yesterday). e.g. memoryCache().xxx()
- Some classes are using static functions in the class (e.g. DatabaseProcess::shared(), PluginProcess::shared()).

As I said, I landed a patch yesterday so that the global page cache is now accessed via PageCache::shared() because I thought this was the currently preferred pattern (given it seems very common in WebKit2 code).
However, I thought I would email webkit-dev to make sure this is actually the case and make sure we agree on a given pattern (one way or another) for current and future code. We could then maybe document this
as part of our coding style.

Any feedback on this matter?

Kr,
--
Chris Dumez - Apple Inc.
Cupertino, CA




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20150128/8ca9befc/attachment.html>


More information about the webkit-dev mailing list