[webkit-help] Passing RefPtr<T> to function expecting Ref<T>

Konstantin Tokarev annulen at yandex.ru
Sun Mar 26 23:46:47 PDT 2017



27.03.2017, 09:37, "Ryosuke Niwa" <rniwa at webkit.org>:
> On Sun, Mar 26, 2017 at 12:28 PM, Konstantin Tokarev <annulen at yandex.ru> wrote:
>>  Hello,
>>
>>  What is the most appropriate way to do subject, given that ptr is RefPtr<T>?
>>
>>  1. f(*ptr)
>>  2. f(ptr.releaseNonNull())
>
> Both forms are depending on what you're trying to do. 1 is appropriate
> and necessary if ptr is used after the call to f but it results in an
> unnecessary ref-churn if ptr is never used after the call. 2 is
> appropriate if ptr is never after the call, and would avoid a
> ref-churn.
>
> - R. Niwa

Thanks!

-- 
Regards,
Konstantin


More information about the webkit-help mailing list