[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-dev
Subject:    Re: [webkit-dev] Ref counting questions
From:       Maciej Stachowiak <mjs () apple ! com>
Date:       2013-05-22 19:38:18
Message-ID: D9A4960E-33C4-48CD-B498-C3E7187294D6 () apple ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


We could probably phase out TreeShared if we were really careful to avoid refcount \
thrash during tree construction/manipulation. I believe this can be done with careful \
use of PassRefPtr and swap() and it would likely be easier to understand if Nodes \
normally had a refcount of 1 instead of 0.

On May 22, 2013, at 10:41 AM, Antti Koivisto <koivisto@iki.fi> wrote:

> TreeShared is essentially an implementation detail of the DOM tree (the only other \
> client besides Node is SVGElementInstance).  It shouldn't be used for anything \
> else. 
> TreeShared keeps Nodes alive when they are part of a tree (have a parent node) even \
> when they have zero refcount. This way nodes don't need to explicitly ref and deref \
> their children. 
> 
> antti
> 
> 
> On Wed, May 22, 2013 at 7:26 PM, Bem Jones-Bey <bjonesbe@adobe.com> wrote:
> Hey all,
> 
> I've read the document at http://www.webkit.org/coding/RefPtr.html, but I still \
> have some questions about using RefPtrs. 
> The first one is listed in the "Improving this document" section of the \
> aforementioned documentation: • Perils of programming with TreeShared.
> What does that mean? What gotchas should I be aware of? (Heck, more details on any \
> of the things in "improving this document" would be helpful, and I'll do my best to \
> update the document with anything I learn if that's desired.) 
> Also, I've noticed that there's both TreeShared and RefCounted, and they seem \
> fairly similar to my uninitiated eye. What's the difference between the two and \
> when should one use one or the other? Also, are there other templates/classes that \
> I should be aware of? 
> Thanks,
> Bem
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev


[Attachment #5 (text/html)]

<html><head><meta http-equiv="Content-Type" content="text/html \
charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; -webkit-line-break: after-white-space;"><div><br></div>We could probably phase \
out TreeShared if we were really careful to avoid refcount thrash during tree \
construction/manipulation. I believe this can be done with careful use of PassRefPtr \
and swap() and it would likely be easier to understand if Nodes normally had a \
refcount of 1 instead of 0.<div><br><div><div>On May 22, 2013, at 10:41 AM, Antti \
Koivisto &lt;<a href="mailto:koivisto@iki.fi">koivisto@iki.fi</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: \
normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; \
white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: \
0px;"><div dir="ltr"><font face="arial, sans-serif">TreeShared is essentially an \
implementation detail of the DOM tree (the only other client besides Node \
is&nbsp;SVGElementInstance).&nbsp; It shouldn't be used for anything \
else.</font><br><div><br></div><div><font face="arial, sans-serif">TreeShared keeps \
Nodes alive when they are part of a tree (have a parent node) even when they have \
zero refcount. This way nodes don't need to explicitly ref and deref their \
children.</font><br></div><div><span style="font-family: arial, sans-serif; \
font-size: 13px;"><br></span></div><div><span style="font-family: arial, sans-serif; \
font-size: 13px;"><br></span></div><div><span style="font-family: arial, sans-serif; \
font-size: 13px;">&nbsp; antti</span></div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 22, 2013 at 7:26 PM, \
Bem Jones-Bey<span class="Apple-converted-space">&nbsp;</span><span dir="ltr">&lt;<a \
href="mailto:bjonesbe@adobe.com" \
target="_blank">bjonesbe@adobe.com</a>&gt;</span><span \
class="Apple-converted-space">&nbsp;</span>wrote:<br><blockquote class="gmail_quote" \
style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, \
204, 204); border-left-style: solid; padding-left: 1ex;">Hey all,<br><br>I've read \
the document at<span class="Apple-converted-space">&nbsp;</span><a \
href="http://www.webkit.org/coding/RefPtr.html" \
target="_blank">http://www.webkit.org/coding/RefPtr.html</a>, but I still have some \
questions about using RefPtrs.<br><br>The first one is listed in the "Improving this \
document" section of the aforementioned documentation:<br>&nbsp; &nbsp; &nbsp; \
&nbsp;<span class="Apple-converted-space">&nbsp;</span>• Perils of programming with \
TreeShared.<br>What does that mean? What gotchas should I be aware of? (Heck, more \
details on any of the things in "improving this document" would be helpful, and I'll \
do my best to update the document with anything I learn if that's \
desired.)<br><br>Also, I've noticed that there's both TreeShared and RefCounted, and \
they seem fairly similar to my uninitiated eye. What's the difference between the two \
and when should one use one or the other? Also, are there other templates/classes \
that I should be aware \
of?<br><br>Thanks,<br>Bem<br><br>_______________________________________________<br>webkit-dev \
mailing list<br><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br><a \
href="https://lists.webkit.org/mailman/listinfo/webkit-dev" \
target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br></blockquote></div><br></div>_______________________________________________<br>webkit-dev \
mailing list<br><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br><a \
href="https://lists.webkit.org/mailman/listinfo/webkit-dev">https://lists.webkit.org/mailman/listinfo/webkit-dev</a></div></blockquote></div><br></div></body></html>




_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic