[webkit-dev] Rationale for PlatformRefPtr?

Martin Robinson mrobinson at webkit.org
Thu Sep 30 17:12:14 PDT 2010


On Thu, Sep 30, 2010 at 5:02 PM, Darin Adler <darin at apple.com> wrote:
> But couldn’t someone get into a situation where they want to use GObject and Cairo reference counted types in the same port?

This is the situation with the GTK+ port now. The GTK+ port simply
adds template specializations for GObject types in the GRefPtr.h
header and the Cairo code includes template specializations for Cairo
types.

>> 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.

I think this would be great. I'd be happy to embark on this.

> 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.

It does not use compile-time settings, but template specialization.
Sorry if I misrepresented that.

Martin


More information about the webkit-dev mailing list