[webkit-dev] Rename of selfOnlyRef to guardRef - ok if I change it back? (was Re: DOM tree traversal on detached nodes)

Maciej Stachowiak mjs at apple.com
Fri Jun 15 10:15:07 PDT 2012

On Jun 15, 2012, at 12:12 AM, Roland Steiner <rolandsteiner at google.com> wrote:

> Sorry for the late reply, this thread flew under my radar.
> I made the original name change, because I honestly was entirely confused about the meaning of "selfOnlyRef" (it's done by Node on Document, so what is "self"? Why is it needed?) - so I guess we'll have to agree to disagree which one is clearer. ^_-

I can see how the name is less than perfectly clear, but since it's generally called as doc->selfOnlyRef(), I think it's pretty clear that the Node doing the calling can't be the relevant "self". To me, guardRef() sounded like something for short-term protection in the scope of a function (the way we often use a local RefPtr on an object that may be destroyed), rather than like what it actually does. I think the main downside to selfOnlyRef() is that it's not fully clear what "self-only" means even if you know what "self" is. But it's hard to explain fully in a function name w/o excess verbosity.

 - Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120615/226e7f6e/attachment.html>

More information about the webkit-dev mailing list