[Webkit-unassigned] [Bug 205617] Add makeRefCounted<>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Dec 28 11:20:47 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=205617

--- Comment #2 from Sam Weinig <sam at webkit.org> ---
I'm not sure if this is a good idea or not.

For context, we historically used the create() pattern, rather than introduce a makeRefCounted(), based on the assumption that it never makes sense to directly call the constructor of a RefCounted object and not put it into a Ref/RefPtr, and therefore making the constructor private would avoid bugs since you couldn't misuse it.

This is in contrast to objects that live in std::unique_ptr<> or WTF::UniqueRef<>, which often make sense as stack allocated or as a member of another class/struct.

Perhaps there is something in-between we can do, though I can't think of a way to do it at the moment, where we keep RefCounted derived objects' constructors private, but allow makeRefCounted<>() to call it, perhaps via friend or some such.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191228/5c44bc59/attachment.htm>


More information about the webkit-unassigned mailing list