[webkit-dev] Rationale for PlatformRefPtr?

Darin Adler darin at apple.com
Thu Sep 30 17:02:16 PDT 2010


On Sep 30, 2010, at 4:54 PM, Martin Robinson wrote:

> There are several ports that use third party libraries with reference counted types. GTK+ / EFL / and gstreamer based ports use GObject and its associated reference-counting mechanism. In addition, Cairo-based ports (including GTK+ and the WinCairo port) use Cairo reference counted types (which don't use GObject) and ports that use FontConfig also have reference counted types (that is also unrelated to GObject or Cairo).

But couldn’t someone get into a situation where they want to use GObject and Cairo reference counted types in the same port?

> We'd like to share the same templated class for all of these smart pointers to avoid duplicate code.

If this is the goal, there are multiple ways to achieve it. There are template techniques to do it that we decided not to use before, because the tools don’t support them well enough. There are macro techniques to do it that we could use right now and then we could have these new classes share code with RefPtr, RetainPtr, and JSRetainPtr as well.

Making one class that is one of these three based on a compile-time setting does not seem like the right way to go to me.

    -- Darin



More information about the webkit-dev mailing list