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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 3 05:19:07 PST 2020


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

--- Comment #9 from Antti Koivisto <koivisto at iki.fi> ---
(In reply to Alex Christensen from comment #7)
> Another approach is something like what we've done in classes like
> CustomHeaderFields.  We templatize the create function to just call whatever
> constructor it can.  This templatized create can be moved to RefCounted and
> ThreadSafeRefCounted, but then we would need to befriend that class (like we
> do in many places with our "friend class NeverDestroyed" instances) or have
> a public constructor.

What would this achieve?

> Either way, I think that it would be a bit nicer to continue having
> T::create() rather than makeRefCounted<T>() because the code reads nicer. 
> It's an implementation detail that it's ref counted and we don't need to
> remind ourselves at every call site.

Duplicating constructors as static functions seems opposite of nice to me. 

Understanding memory management of an object is important and making it more explicit seems like a good thing (though since we only use create() pattern with refcounted objects it isn't much of a change).

-- 
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/20200103/dd31a8d1/attachment-0001.htm>


More information about the webkit-unassigned mailing list