[Webkit-unassigned] [Bug 173266] Objects owning API clients should use UniqueRef

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 13 22:24:00 PDT 2017


--- Comment #10 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to Alex Christensen from comment #8)
> I think it's better to use UniqueRef and to use makeUniqueRef to make them. 
> If you can't go to the source of these std::unique_ptrs and replace them
> with makeUniqueRef, let's leave them as std::unique_ptrs for now.

The problem is not the source of the unique_ptrs, but the setters. This is what we do:

void setClient(std::unique_ptr<Client> client)
    if (!client)
        m_client = std::make_unique<Client>();
        m_client = WTFMove(client);

There's no problem in using makeUniqueRef there, the problem is that the setter can't receive a null client if we use UniqueRef as the parameter. I guess we can still do this, keeping the unique_ptr as the parameter and leaking it to adopt it by the UniqueRef. I added the UniqueRef just for convenience.

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/20170614/b1caec9d/attachment-0001.html>

More information about the webkit-unassigned mailing list