<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183001] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183001">183001</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2015-04-19 21:42:39 -0700 (Sun, 19 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update RefPtr documentation and deprecation
https://bugs.webkit.org/show_bug.cgi?id=143936
Reviewed by Andreas Kling.
Source/WTF:
* WTF.vcxproj/WTF.vcxproj: Removed PassRef.h
* WTF.vcxproj/WTF.vcxproj.filters: Ditto.
* WTF.xcodeproj/project.pbxproj: Ditto.
* wtf/CMakeLists.txt: Ditto.
Tools:
* Scripts/do-webcore-rename: Put in some DeprecatedPassRefPtr renames.
Websites/webkit.org:
* coding/RefPtr.html: Updated.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxproj">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxprojfilters">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsdowebcorerename">trunk/Tools/Scripts/do-webcore-rename</a></li>
<li><a href="#trunkWebsiteswebkitorgChangeLog">trunk/Websites/webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsiteswebkitorgcodingRefPtrhtml">trunk/Websites/webkit.org/coding/RefPtr.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Source/WTF/ChangeLog        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-04-19 Darin Adler <darin@apple.com>
+
+ Update RefPtr documentation and deprecation
+ https://bugs.webkit.org/show_bug.cgi?id=143936
+
+ Reviewed by Andreas Kling.
+
+ * WTF.vcxproj/WTF.vcxproj: Removed PassRef.h
+ * WTF.vcxproj/WTF.vcxproj.filters: Ditto.
+ * WTF.xcodeproj/project.pbxproj: Ditto.
+ * wtf/CMakeLists.txt: Ditto.
+
</ins><span class="cx"> 2015-04-17 Alexey Proskuryakov <ap@apple.com>
</span><span class="cx">
</span><span class="cx"> Use ASan poisoning to taint moved-out-of Refs
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -248,7 +248,6 @@
</span><span class="cx"> <ClInclude Include="..\wtf\ParallelJobsLibdispatch.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\ParallelJobsOpenMP.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\PassOwnPtr.h" />
</span><del>- <ClInclude Include="..\wtf\PassRef.h" />
</del><span class="cx"> <ClInclude Include="..\wtf\PassRefPtr.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\Platform.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\PrintStream.h" />
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -561,9 +561,6 @@
</span><span class="cx"> <ClInclude Include="..\wtf\PassOwnPtr.h">
</span><span class="cx"> <Filter>wtf</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\wtf\PassRef.h">
- <Filter>wtf</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\wtf\PassRefPtr.h">
</span><span class="cx"> <Filter>wtf</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -88,7 +88,6 @@
</span><span class="cx">                 93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */; };
</span><span class="cx">                 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; };
</span><span class="cx">                 93AC91A818942FC400244939 /* LChar.h in Headers */ = {isa = PBXBuildFile; fileRef = 93AC91A718942FC400244939 /* LChar.h */; };
</span><del>-                93B1AA80180E5AF3004A2F05 /* PassRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B1AA7F180E5AF3004A2F05 /* PassRef.h */; };
</del><span class="cx">                 93F1993E19D7958D00C2390B /* StringView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1993D19D7958D00C2390B /* StringView.cpp */; };
</span><span class="cx">                 974CFC8E16A4F327006D5404 /* WeakPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 974CFC8D16A4F327006D5404 /* WeakPtr.h */; };
</span><span class="cx">                 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */; };
</span><span class="lines">@@ -377,7 +376,6 @@
</span><span class="cx">                 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; };
</span><span class="cx">                 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; };
</span><del>-                93B1AA7F180E5AF3004A2F05 /* PassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassRef.h; sourceTree = "<group>"; };
</del><span class="cx">                 93F1993D19D7958D00C2390B /* StringView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringView.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 974CFC8D16A4F327006D5404 /* WeakPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakPtr.h; sourceTree = "<group>"; };
</span><span class="cx">                 9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringTable.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -807,7 +805,6 @@
</span><span class="cx">                                 A8A472E6151A825B004123FF /* ParallelJobs.h */,
</span><span class="cx">                                 A8A472E9151A825B004123FF /* ParallelJobsLibdispatch.h */,
</span><span class="cx">                                 A8A472EC151A825B004123FF /* PassOwnPtr.h */,
</span><del>-                                93B1AA7F180E5AF3004A2F05 /* PassRef.h */,
</del><span class="cx">                                 A8A472ED151A825B004123FF /* PassRefPtr.h */,
</span><span class="cx">                                 A876DBD7151816E500DADB95 /* Platform.h */,
</span><span class="cx">                                 0F9D335D165DBA73005AD387 /* PrintStream.cpp */,
</span><span class="lines">@@ -1120,7 +1117,6 @@
</span><span class="cx">                                 A8A473E3151A825B004123FF /* Locker.h in Headers */,
</span><span class="cx">                                 A8A473E6151A825B004123FF /* MainThread.h in Headers */,
</span><span class="cx">                                 A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
</span><del>-                                93B1AA80180E5AF3004A2F05 /* PassRef.h in Headers */,
</del><span class="cx">                                 A8A473EA151A825B004123FF /* MD5.h in Headers */,
</span><span class="cx">                                 7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */,
</span><span class="cx">                                 CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -65,7 +65,6 @@
</span><span class="cx"> ParallelJobsLibdispatch.h
</span><span class="cx"> ParallelJobsOpenMP.h
</span><span class="cx"> PassOwnPtr.h
</span><del>- PassRef.h
</del><span class="cx"> PassRefPtr.h
</span><span class="cx"> Platform.h
</span><span class="cx"> PrintStream.h
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Tools/ChangeLog        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-04-19 Darin Adler <darin@apple.com>
+
+ Update RefPtr documentation and deprecation
+ https://bugs.webkit.org/show_bug.cgi?id=143936
+
+ Reviewed by Andreas Kling.
+
+ * Scripts/do-webcore-rename: Put in some DeprecatedPassRefPtr renames.
+
</ins><span class="cx"> 2015-04-19 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> Introduce bytecode intrinsics
</span></span></pre></div>
<a id="trunkToolsScriptsdowebcorerename"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/do-webcore-rename (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/do-webcore-rename        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Tools/Scripts/do-webcore-rename        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -102,6 +102,10 @@
</span><span class="cx"> );
</span><span class="cx">
</span><span class="cx"> my %renamesContemplatedForTheFuture = (
</span><ins>+ "PassRefPtr" => "DeprecatedPassRefPtr",
+ "OwnPtr" => "DeprecatedOwnPtr",
+ "PassOwnPtr" => "DeprecatedPassOwnPtr",
+
</ins><span class="cx"> "HTMLPlugInImageElement" => "HTMLEmbeddedObjectElement",
</span><span class="cx"> "isPlugInImageElement" => "isEmbeddedObjectElement",
</span><span class="cx"> "isHTMLPlugInImageElement" => "isHTMLEmbeddedObjectElement",
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/ChangeLog (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/ChangeLog        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Websites/webkit.org/ChangeLog        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2015-04-19 Darin Adler <darin@apple.com>
+
+ Update RefPtr documentation and deprecation
+ https://bugs.webkit.org/show_bug.cgi?id=143936
+
+ Reviewed by Andreas Kling.
+
+ * coding/RefPtr.html: Updated.
+
</ins><span class="cx"> 2015-03-10 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix warning about loading insecure content from secure webkit.org/blog
</span></span></pre></div>
<a id="trunkWebsiteswebkitorgcodingRefPtrhtml"></a>
<div class="modfile"><h4>Modified: trunk/Websites/webkit.org/coding/RefPtr.html (183000 => 183001)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/webkit.org/coding/RefPtr.html        2015-04-20 04:17:27 UTC (rev 183000)
+++ trunk/Websites/webkit.org/coding/RefPtr.html        2015-04-20 04:42:39 UTC (rev 183001)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><del>-<?php
- $title="RefPtr and PassRefPtr Basics";
</del><ins>+<?php
+ $title="RefPtr Basics";
</ins><span class="cx"> include("../header.inc");
</span><span class="cx"> ?>
</span><span class="cx">
</span><span class="lines">@@ -16,40 +16,43 @@
</span><span class="cx"> }
</span><span class="cx"> </style>
</span><span class="cx">
</span><del>-<h1><span class="class">RefPtr</span> and <span class="class">PassRefPtr</span> Basics</h1>
</del><ins>+<h1><span class="class">RefPtr</span> Basics</h1>
</ins><span class="cx"> <div>Darin Adler</div>
</span><del>-<div>Version 4, 2010-08-27</div>
</del><ins>+<div>Version 5, 2015-04-19</div>
</ins><span class="cx">
</span><span class="cx"> <h2>History</h2>
</span><span class="cx">
</span><del>-<p>Many objects in WebKit are reference counted. The pattern used is that classes have
-member functions <span class="function">ref</span> and <span class="function">deref</span>
-that increment and decrement the reference count. Each call to <span class="function">ref</span>
-has to be matched by a call to <span class="function">deref</span>. When the function is called
</del><ins>+<p>Many objects in WebKit are reference counted. The pattern is that classes have
+member functions named <span class="function">ref</span> and <span class="function">deref</span>
+that increment and decrement a reference count. When the <span class="function">deref</span> function is called
</ins><span class="cx"> on an object with a reference count of 1, the object is deleted. Many classes in WebKit implement
</span><span class="cx"> this pattern by deriving from the <span class="class">RefCounted</span> class template.</p>
</span><span class="cx">
</span><span class="cx"> <p>Back in 2005, we discovered that there were many memory leaks, especially in HTML
</span><span class="cx"> editing code, caused by misuse of <span class="function">ref</span> and
</span><del>-<span class="function">deref</span> calls.</p>
-
-<p>We wanted
-to use smart pointers to mitigate the problem. However, some early experiments showed that
</del><ins>+<span class="function">deref</span> calls.
+We decided to use smart pointers to mitigate the problem. Early experiments showed that
</ins><span class="cx"> smart pointers led to additional manipulation of reference counts that hurt performance.
</span><del>-For example, for a function that took a smart pointer as a parameter and returned that same smart
-pointer as a return value, just passing the parameter and returning the value would increment
</del><ins>+For example, for a function that took a smart pointer as an argument and returned that same smart
+pointer as a return value, passing the parameter and returning the value would increment
</ins><span class="cx"> and then decrement the reference count two to four times
</span><del>-as the object moved from one smart pointer to another. So we looked for an
-idiom that would let us use smart pointers and avoid this reference count churn.</p>
</del><ins>+as the object moved from one smart pointer to another.</p>
</ins><span class="cx">
</span><del>-<p>The inspiration for a solution came from the C++ standard class template <span class="class">auto_ptr</span>.
-These objects implement a model where assignment is transfer of ownership. When you assign
-from one <span class="class">auto_ptr</span> to another, the donor becomes 0.</p>
</del><ins>+<p>We solved that problem in 2005 with a set of smart pointer class templates. C++ move semantics,
+introduced in C++11, made it possible to streamline those class templates without
+reintroducing reference count churn.</p>
</ins><span class="cx">
</span><del>-<p>Maciej Stachowiak devised a pair of class templates, <span class="class">RefPtr</span>
-and <span class="class">PassRefPtr</span>, that implement this scheme
-for WebCore’s intrusive reference counting.</p>
</del><ins>+<p>Later, in 2013, we noticed that our use of pointers in general, and smart pointers in particular,
+was causing a proliferation of null checks and uncertainty about what can be null.
+We started using references rather than pointers wherever possible in WebKit code.</p>
</ins><span class="cx">
</span><ins>+<p>Maciej Stachowiak created the class template, <span class="class">RefPtr</span>,
+that implements WebKit’s intrusive reference counting, and we have since adapted it so that it
+works well with move semantics. Andreas Kling created a related class template,
+<span class="class">Ref</span>, which works with RefPtr and provides clarity and
+even greater efficiency when dealing with
+reference counted objects in contexts where there is no need for a null pointer.</p>
+
</ins><span class="cx"> <h2>Raw pointers</h2>
</span><span class="cx">
</span><span class="cx"> <p>When discussing smart pointers such as the <span class="class">RefPtr</span>
</span><span class="lines">@@ -60,14 +63,9 @@
</span><span class="cx">
</span><span class="cx"> class Document {
</span><span class="cx"> <span class="comment">...</span>
</span><del>- Title* m_title;
</del><ins>+ Title* m_title { nullptr };
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Document::Document()
- : m_title(0)
-{
-}
-
</del><span class="cx"> Document::~Document()
</span><span class="cx"> {
</span><span class="cx"> if (m_title)
</span><span class="lines">@@ -85,7 +83,7 @@
</span><span class="cx">
</span><span class="cx"> <h2><span class="class">RefPtr</span></h2>
</span><span class="cx">
</span><del>-<p><span class="class">RefPtr</span> is a simple smart pointer class that calls <span class="function">ref</span>
</del><ins>+<p><span class="class">RefPtr</span> is a smart pointer class template that calls <span class="function">ref</span>
</ins><span class="cx"> on incoming values and
</span><span class="cx"> <span class="function">deref</span> on outgoing values.
</span><span class="cx"> <span class="class">RefPtr</span> works on any object with both a <span class="function">ref</span> and
</span><span class="lines">@@ -93,7 +91,7 @@
</span><span class="cx"> Here’s the setter function example, written with <span class="class">RefPtr</span>:</p>
</span><span class="cx">
</span><span class="cx"> <pre class="code"><span class="comment">// example, not preferred style</span>
</span><del>-
</del><ins>+
</ins><span class="cx"> class Document {
</span><span class="cx"> <span class="comment">...</span>
</span><span class="cx"> RefPtr&lt;Title&gt; m_title;
</span><span class="lines">@@ -104,208 +102,166 @@
</span><span class="cx"> m_title = title;
</span><span class="cx"> }</pre>
</span><span class="cx">
</span><del>-<p>Use of <span class="class">RefPtr</span> alone can lead to reference count churn.</p>
</del><ins>+<p>Functions that take take ownership of reference counted arguments can lead to reference count churn.</p>
</ins><span class="cx">
</span><del>-<pre class="code"><span class="comment">// example, not preferred style; should use RefCounted and adoptRef (see below)</span>
</del><ins>+<pre class="code"><span class="comment">// example, not preferred style
</ins><span class="cx">
</span><del>-RefPtr&lt;Node&gt; createSpecialNode()
-{
- RefPtr&lt;Node&gt; a = new Node;
- a-&gt;setSpecial(true);
- return a;
-}
</del><ins>+RefPtr&lt;Title&gt; untitledTitle = titleFactory().createUniqueUntitledTitle();
</ins><span class="cx">
</span><del>-RefPtr&lt;Node&gt; b = createSpecialNode();</pre>
</del><ins>+document.setTitle(untitledTitle);</pre>
</ins><span class="cx">
</span><del>-<p>For purposes of this discussion, lets assume that the node object starts with a
-reference count of 0 (more on this later). When it’s assigned to <span class="variable">a</span>,
-the reference count is incremented to 1. The reference count is incremented to 2 to
-create the return value, then decremented back to 1 when <span class="variable">a</span> is destroyed.
-Then the reference count is incremented to 2 to create <span class="variable">b</span>, and then decremented back
-to 1 when the return value of <span class="function">createSpecialNode</span> is destroyed.</p>
</del><ins>+<p>The title starts with a reference count of 1. The <span class="function">setTitle</span> function stores it in the data member,
+and the reference count is incremented to 2. Then the local variable <span class="variable">untitledTitle</span> goes out of
+scope and the reference count is decremented back to 1.</p>
</ins><span class="cx">
</span><del>-<p>(If the compiler implements the
-<a href="http://en.wikipedia.org/wiki/Return_value_optimization">return value optimization</a>,
-there may be one less increment and decrement of the reference count.)</p>
</del><ins>+<p>The way to define a function that takes ownership of an object is to use an rvalue reference.</p>
</ins><span class="cx">
</span><del>-<p>The overhead of reference count churn is even greater when both function arguments and return
-values are involved. The solution is <span class="class">PassRefPtr</span>.</p>
</del><ins>+<pre class="code"><span class="comment">// preferred style</span>
+
+class Document {
+ <span class="comment">...</span>
+ RefPtr&lt;Title&gt; m_title;
+}
</ins><span class="cx">
</span><del>-<h2><span class="class">PassRefPtr</span></h2>
-
-<p><span class="class">PassRefPtr</span> is like <span class="class">RefPtr</span> with a difference.
-When you copy a <span class="class">PassRefPtr</span> or
-assign the value of a <span class="class">PassRefPtr</span> to a <span class="class">RefPtr</span> or
-another <span class="class">PassRefPtr</span>, the original
-pointer value is set to 0; the operation is done without any change to the reference count.
-Let’s take a look at a new version of our example:</p>
-
-<pre class="code"><span class="comment">// example, not preferred style; should use RefCounted and adoptRef (see below)</span>
-
-PassRefPtr&lt;Node&gt; createSpecialNode()
</del><ins>+void Document::setTitle(RefPtr&lt;Title&gt;&amp;&amp; title)
</ins><span class="cx"> {
</span><del>- PassRefPtr&lt;Node&gt; a = new Node;
- a-&gt;setSpecial(true);
- return a;
</del><ins>+ m_title = WTF::move(title);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr&lt;Node&gt; b = createSpecialNode();</pre>
</del><ins>+<span class="comment">...</span>
</ins><span class="cx">
</span><del>-<p>The node object starts with a reference count of 0. When it’s assigned to <span class="variable">a</span>,
-the reference count is incremented to 1. Then <span class="variable">a</span> gets set to 0 when the return
-value <span class="class">PassRefPtr</span> is created. Then the return value is set to 0 when
-<span class="variable">b</span> is created.</p>
</del><ins>+RefPtr&lt;Title&gt; untitledTitle = titleFactory().createUniqueUntitledTitle();
</ins><span class="cx">
</span><del>-<p>However, as the Safari team learned when we started programming with <span class="class">PassRefPtr</span>,
-the rule that a pointer becomes 0 when it’s assigned to another variable can easily lead to mistakes.</p>
</del><ins>+document.setTitle(WTF::move(untitledTitle));</pre>
</ins><span class="cx">
</span><del>-<pre class="code"><span class="comment">// warning, will dereference a null pointer and will not work</span>
-
-static RefPtr&lt;Ring&gt; g_oneRingToRuleThemAll;
</del><ins>+<p>The title makes it all the way into the data member with a reference count of 1;
+it’s never incremented or decremented.</p>
</ins><span class="cx">
</span><del>-void finish(PassRefPtr&lt;Ring&gt; ring)
-{
- g_oneRingToRuleThemAll = ring;
- <span class="comment">...</span>
- ring-&gt;wear();
-}</pre>
</del><ins>+<p>Note the use of <span class="function">WTF::move</span>
+instead of <span class="function">std::move</span>.
+The WTF version adds a couple of compile time checks to catch common errors, and should be
+used throughout the WebKit project in place of <span class="function">std::move</span>.</p>
</ins><span class="cx">
</span><del>-<p>By the time <span class="function">wear</span> is called, <span class="variable">ring</span>
-is already 0. To avoid this, we recommend <span class="class">PassRefPtr</span> only for
-function argument and result types, copying arguments into <span class="class">RefPtr</span>
-local variables.</p>
</del><ins>+<h2><span class="class">Ref</span></h2>
</ins><span class="cx">
</span><del>-<pre class="code">static RefPtr&lt;Ring&gt; g_oneRingToRuleThemAll;
</del><ins>+<p><span class="class">Ref</span> is like <span class="class">RefPtr</span>, except that it
+acts like a reference rather than a pointer; it doesn’t have a null value.</p>
</ins><span class="cx">
</span><del>-void finish(PassRefPtr&lt;Ring&gt; prpRing)
-{
- RefPtr&lt;Ring&gt; ring = prpRing;
- g_oneRingToRuleThemAll = ring;
- <span class="comment">...</span>
- ring-&gt;wear();
-}</pre>
</del><ins>+<p><span class="class">Ref</span> works particularly well with return values; it’s often
+straightforward to be sure that a newly created object will never be null.</p>
</ins><span class="cx">
</span><del>-<h2>Mixing <span class="class">RefPtr</span> and <span class="class">PassRefPtr</span></h2>
-
-<p>Since we recommend use of <span class="class">RefPtr</span> in all cases except when passing arguments to or
-returning values from a function, there will be times when you have a <span class="class">RefPtr</span>
-and wish to transfer ownership as <span class="class">PassRefPtr</span> does.
-<span class="class">RefPtr</span> has a member function named
-<span class="function">release</span> that does the trick. It sets the value of the original
-<span class="class">RefPtr</span> to 0 and constructs a <span class="class">PassRefPtr</span>, without
-changing reference counts.</p>
-
-<pre class="code"><span class="comment">// example, not preferred style; should use RefCounted and adoptRef (see below)</span>
</del><ins>+<pre class="code"><span class="comment">// preferred style</span>
</ins><span class="cx">
</span><del>-PassRefPtr&lt;Node&gt; createSpecialNode()
</del><ins>+Ref&lt;Title&gt; TitleFactory::createUniqueUntitledTitle()
</ins><span class="cx"> {
</span><del>- RefPtr&lt;Node&gt; a = new Node;
- a-&gt;setCreated(true);
- return a.release();
-}
</del><ins>+ return createTitle("untitled " + m_nextAvailableUntitledNumber++);
+}</pre>
</ins><span class="cx">
</span><del>-RefPtr&lt;Node&gt; b = createSpecialNode();</pre>
</del><ins>+<p>Using <span class="class">Ref</span> helps makes it clear to the caller that this function will never return null.</p>
</ins><span class="cx">
</span><del>-<p>This keeps the efficiency of <span class="class">PassRefPtr</span> while reducing the chance
-that its relatively tricky semantics will cause problems.</p>
-
</del><span class="cx"> <h2>Mixing with raw pointers</h2>
</span><span class="cx">
</span><ins>+<p>The <span class="class">RefPtr</span> class mixes with raw pointers much as the smart
+pointers in the C++ standard library, such as <span class="class">std::unique_ptr</span>, do.</p>
+
</ins><span class="cx"> <p>When using a <span class="class">RefPtr</span> to call a function that takes a raw pointer,
</span><span class="cx"> use the <span class="function">get</span> function.</p>
</span><span class="cx">
</span><span class="cx"> <pre class="code">printNode(stderr, a.get());</pre>
</span><span class="cx">
</span><del>-<p>However, many operations can be done on a <span class="class">RefPtr</span>
-or <span class="class">PassRefPtr</span> directly, without resorting to an explicit <span class="function">get</span> call.</p>
</del><ins>+<p>With a <span class="class">Ref</span>, the <span class="function">get</span> function
+produces a raw reference, and the <span class="function">ptr</span> function produces a raw pointer.</p>
</ins><span class="cx">
</span><del>-<pre class="code">RefPtr&lt;Node&gt; a = createSpecialNode();
-Node* b = getOrdinaryNode();
</del><ins>+<pre class="code">printString(stderr, a.get().caption());
+printNode(stderr, a.ptr());</pre>
</ins><span class="cx">
</span><ins>+<p>Many operations can be done on a <span class="class">RefPtr</span>
+directly, without resorting to an explicit <span class="function">get</span> call.</p>
+
+<pre class="code">Ref&lt;Node&gt; a = createSpecialNode();
+RefPtr&lt;Node&gt; b = findNode();
+Node* c = getOrdinaryNode();
+
</ins><span class="cx"> <span class="comment">// the * operator</span>
</span><del>-*a = value;
</del><ins>+*b = value;
</ins><span class="cx">
</span><span class="cx"> <span class="comment">// the -&gt; operator</span>
</span><span class="cx"> a-&gt;clear();
</span><ins>+b-&gt;clear();
</ins><span class="cx">
</span><span class="cx"> <span class="comment">// null check in an if statement</span>
</span><del>-if (a)
</del><ins>+if (b)
</ins><span class="cx"> log("not empty");
</span><span class="cx">
</span><span class="cx"> <span class="comment">// the ! operator</span>
</span><del>-if (!a)
</del><ins>+if (!b)
</ins><span class="cx"> log("empty");
</span><span class="cx">
</span><span class="cx"> <span class="comment">// the == and != operators, mixing with raw pointers</span>
</span><del>-if (a == b)
</del><ins>+if (b == c)
</ins><span class="cx"> log("equal");
</span><del>-if (a != b)
</del><ins>+if (b != c)
</ins><span class="cx"> log("not equal");
</span><span class="cx">
</span><span class="cx"> <span class="comment">// some type casts</span>
</span><del>-RefPtr&lt;DerivedNode&gt; d = static_pointer_cast&lt;DerivedNode&gt;(a);</pre>
</del><ins>+RefPtr&lt;DerivedNode&gt; d = static_pointer_cast&lt;DerivedNode&gt;(d);</pre>
</ins><span class="cx">
</span><del>-<p>Normally, <span class="class">RefPtr</span> and <span class="class">PassRefPtr</span>
-enforce a simple rule; they always balance <span class="function">ref</span> and
</del><ins>+<p>Normally, <span class="class">RefPtr</span> enforces a simple rule; it always
+balances <span class="function">ref</span> and
</ins><span class="cx"> <span class="function">deref</span> calls, guaranteeing a programmer can’t miss a
</span><del>-<span class="function">deref</span>. But in the case where we have a raw pointer,
</del><ins>+<span class="function">deref</span>. But in the case where we start with a raw pointer,
</ins><span class="cx"> already have a reference count, and want to transfer ownership the
</span><span class="cx"> <span class="function">adoptRef</span> function should be used.</p>
</span><span class="cx">
</span><span class="cx"> <pre class="code"><span class="comment">// warning, requires a pointer that already has a ref</span>
</span><span class="cx"> RefPtr&lt;Node&gt; node = adoptRef(rawNodePointer);</pre>
</span><span class="cx">
</span><del>-<p>To transfer from a <span class="class">RefPtr</span> to a raw pointer without
-changing the reference count, <span class="class">PassRefPtr</span> provides the
</del><ins>+<p>In the rare case where we have a need to transfer from a <span class="class">RefPtr</span>
+to a raw pointer without changing the reference count, use the
</ins><span class="cx"> <span class="function">leakRef</span> function.</p>
</span><span class="cx">
</span><span class="cx"> <pre class="code"><span class="comment">// warning, results in a pointer that must get an explicit deref</span>
</span><span class="cx"> RefPtr&lt;Node&gt; node = createSpecialNode();
</span><del>-Node* rawNodePointer = node.release().leakRef();</pre>
</del><ins>+Node* rawNodePointer = node.leakRef();</pre>
</ins><span class="cx">
</span><del>-<p>Since <span class="function">leakRef</span> is rarely used, it’s provided only in the
-<span class="class">PassRefPtr</span> class, hence the need to call <span class="function">release</span>,
-then <span class="function">leakRef</span>.</p>
-
</del><span class="cx"> <h2>RefPtr and new objects</h2>
</span><span class="cx">
</span><del>-<p>In the examples in this discussion, we talked about objects with a reference
-count of 0. However, for efficiency and simplicity, the <span class="class">RefCounted</span> class doesn't
-use a reference count of 0 at all. Objects are created with a reference count
</del><ins>+<p>New objects of classes that make use of the <span class="class">RefCounted</span> class template
+are created with a reference count
</ins><span class="cx"> of 1. The best programming idiom to use is to put such objects right into a
</span><del>-<span class="class">RefPtr</span> to make it impossible to forget to deref the object when done with
</del><ins>+<span class="class">Ref</span> to make it impossible to forget to deref the object when done with
</ins><span class="cx"> it. This means that anyone calling new on such an object should immediately
</span><del>-call adoptRef. In WebCore we use functions named create instead of direct calls
-to new.</p>
</del><ins>+call adoptRef. In WebKit we use functions named create instead of direct calls
+to new for these classes.</p>
</ins><span class="cx">
</span><span class="cx"> <pre class="code"><span class="comment">// preferred style</span>
</span><span class="cx">
</span><del>-PassRefPtr&lt;Node&gt; Node::create()
</del><ins>+Ref&lt;Node&gt; Node::create()
</ins><span class="cx"> {
</span><del>- return adoptRef(new Node);
</del><ins>+ return adoptRef(*new Node);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr&lt;Node&gt; e = Node::create();</pre>
</del><ins>+Ref&lt;Node&gt; e = Node::create();</pre>
</ins><span class="cx">
</span><del>-<p>Because of the way <span class="function">adoptRef</span> and
-<span class="class">PassRefPtr</span> are implemented, this is an efficient idiom.
-The object starts with a reference count of 1 and no manipulation of the reference
-count happens at all.</p>
</del><ins>+<p>Because of the way <span class="function">adoptRef</span> is implemented,
+this is an efficient idiom.
+The object starts with a reference count of 1 and no code is generated to
+examine or modify the reference count.</p>
</ins><span class="cx">
</span><span class="cx"> <pre class="code"><span class="comment">// preferred style</span>
</span><span class="cx">
</span><del>-PassRefPtr&lt;Node&gt; createSpecialNode()
</del><ins>+Ref&lt;Node&gt; createSpecialNode()
</ins><span class="cx"> {
</span><del>- RefPtr&lt;Node&gt; a = Node::create();
</del><ins>+ Ref&lt;Node&gt; a = Node::create();
</ins><span class="cx"> a-&gt;setCreated(true);
</span><del>- return a.release();
</del><ins>+ return a;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr&lt;Node&gt; b = createSpecialNode();</pre>
</del><ins>+Ref&lt;Node&gt; b = createSpecialNode();</pre>
</ins><span class="cx">
</span><del>-<p>The node object is put into a <span class="class">PassRefPtr</span> by a call
</del><ins>+<p>The node object is put into a <span class="class">Ref</span> by a call
</ins><span class="cx"> to <span class="function">adoptRef</span> inside <span class="function">Node::create</span>,
</span><del>-then passes into <span class="variable">a</span> and is released and passes into
</del><ins>+then passes into <span class="variable">a</span> and is passed into
</ins><span class="cx"> <span class="variable">b</span>, all without touching the reference count.</p>
</span><span class="cx">
</span><span class="cx"> <p>The <span class="class">RefCounted</span> class implements a runtime check
</span><span class="lines">@@ -315,56 +271,69 @@
</span><span class="cx"> <h2>Guidelines</h2>
</span><span class="cx">
</span><span class="cx"> <p>We’ve developed these guidelines for use of <span class="class">RefPtr</span>
</span><del>-and <span class="class">PassRefPtr</span> in WebKit code.</p>
</del><ins>+and <span class="class">Ref</span> in WebKit code.</p>
</ins><span class="cx">
</span><span class="cx"> <h3>Local variables</h3>
</span><span class="cx"> <ul>
</span><del>-<li>If ownership and lifetime are guaranteed, a local variable can be a raw pointer.</li>
</del><ins>+<li>If ownership and lifetime are guaranteed, a local variable can be a raw reference or pointer.</li>
</ins><span class="cx"> <li>If the code needs to hold ownership or guarantee lifetime, a local variable should
</span><del>-be a <span class="class">RefPtr</span>.</li>
-<li>Local variables should never be <span class="class">PassRefPtr</span>.</li>
</del><ins>+be a <span class="class">Ref</span>, or if it can be null, a <span class="class">RefPtr</span>.</li>
</ins><span class="cx"> </ul>
</span><span class="cx">
</span><span class="cx"> <h3>Data members</h3>
</span><span class="cx"> <ul>
</span><del>-<li>If ownership and lifetime are guaranteed, a data member can be a raw pointer.</li>
</del><ins>+<li>If ownership and lifetime are guaranteed, a data member can be a raw reference or pointer.</li>
</ins><span class="cx"> <li>If the class needs to hold ownership or guarantee lifetime, the data member should
</span><del>-be a <span class="class">RefPtr</span>.</li>
-<li>Data members should never be <span class="class">PassRefPtr</span>.</li>
</del><ins>+be a <span class="class">Ref</span> or <span class="class">RefPtr</span>.</li>
</ins><span class="cx"> </ul>
</span><span class="cx">
</span><span class="cx"> <h3>Function arguments</h3>
</span><span class="cx"> <ul>
</span><del>-<li>If a function does not take ownership of an object, the argument should be a raw pointer.</li>
-<li>If a function does take ownership of an object, the argument should be a <span class="class">PassRefPtr</span>.
-This includes most setter functions.
-Unless the use of the argument is very simple, the argument should be transferred to a
-<span class="class">RefPtr</span> at the start of the function; the argument can be named with
-a “prp” prefix in such cases.</li>
</del><ins>+<li>If a function does not take ownership of an object, the argument should be a raw reference or raw pointer.</li>
+<li>If a function does take ownership of an object, the argument should be a <span class="class">Ref&amp;&amp;</span>
+or a <span class="class">RefPtr&amp;&amp;</span>. This includes many setter functions.
</ins><span class="cx"> </ul>
</span><span class="cx">
</span><span class="cx"> <h3>Function results</h3>
</span><span class="cx"> <ul>
</span><span class="cx"> <li>If a function’s result is an object, but ownership is not being transferred, the result
</span><del>-should be a raw pointer. This includes most getter functions.</li>
</del><ins>+should be a raw reference or raw pointer. This includes most getter functions.</li>
</ins><span class="cx"> <li>If a function’s result is a new object or ownership is being transferred for any other
</span><del>-reason, the result should be a <span class="class">PassRefPtr</span>.
-Since local variables are typically <span class="class">RefPtr</span>, it’s common to call
-<span class="function">release</span> in the return statement to transfer the
-<span class="class">RefPtr</span> to the <span class="class">PassRefPtr</span>.</li>
</del><ins>+reason, the result should be a <span class="class">Ref</span> or <span class="class">RefPtr</span>.</li>
</ins><span class="cx"> </ul>
</span><span class="cx">
</span><span class="cx"> <h3>New objects</h3>
</span><span class="cx"> <ul>
</span><del>-<li>New objects should be put into a <span class="class">RefPtr</span> as soon as possible
</del><ins>+<li>New objects should be put into a <span class="class">Ref</span> as soon as possible
</ins><span class="cx"> after creation to allow the smart pointers to do all reference counting automatically.</li>
</span><span class="cx"> <li>For <span class="class">RefCounted</span> objects, the above should be done with the
</span><span class="cx"> <span class="function">adoptRef</span> function.</li>
</span><span class="cx"> <li>Best idiom is to use a private constructor and a public
</span><span class="cx"> <span class="function">create</span> function that
</span><del>-returns a <span class="class">PassRefPtr</span>.</li>
</del><ins>+returns a <span class="class">Ref</span>.</li>
</ins><span class="cx"> </ul>
</span><span class="cx">
</span><ins>+<h2>Pitfalls</h2>
+
+<h3>PassRefPtr</h3>
+<p>Programmers who worked on WebKit before C++11 are familiar with a class template called PassRefPtr
+(soon to be renamed to DeprecatedPassRefPtr) and you will see it in older WebKit code.</p>
+<ul>
+<li>Any function result or local variable of type PassRefPtr should be replaced with one of type RefPtr or Ref.</li>
+<li>Any argument of type PassRefPtr should be replaced with one of type RefPtr&amp;&amp; or Ref&amp;&amp;.</li>
+<li>Code calling RefPtr::release to turn a RefPtr into a PassRefPtr should instead call WTF::move.</li>
+</ul>
+
+<h3>Common mistakes</h3>
+<ul>
+<li>Giving a function argument a type of Ref, RefPtr, Ref&amp;&amp;, or RefPtr&amp;&amp;
+when it should instead be a raw reference or raw pointer. A function that sometimes takes ownership
+can work just fine with a raw reference or raw pointer. The rvalue reference form is appropriate
+when passing ownership is the primary way the function is used and the is case that needs to be optimized.
+Not all setters need to take an rvalue reference.</li>
+<li>Forgetting to call WTF::move can result in unnecessary reference count churn.</li>
+</ul>
+
</ins><span class="cx"> <h2>Improving this document</h2>
</span><span class="cx">
</span><span class="cx"> <p>We should add answers to any frequently asked questions are not covered by this document.
</span><span class="lines">@@ -372,31 +341,32 @@
</span><span class="cx">
</span><span class="cx"> <ul>
</span><span class="cx">
</span><del>-<li>The “protector” idiom, where a local RefPtr variable is used to keep an object alive.</li>
</del><ins>+<li>copyRef</li>
+<li>releaseNonNull</li>
</ins><span class="cx">
</span><del>-<li>Perils of programming with <span class="class">TreeShared</span>.</li>
</del><ins>+<li>How this works when these are stored in collections such as vectors and hash maps.</li>
</ins><span class="cx">
</span><ins>+<li>Better explanation of when WTF::move is needed and not needed.</li>
+
+<li>The “protector” idiom, where a local <span class="class">Ref</span> variable is used to keep an object alive.</li>
+
+<li>Perils of programming with <span class="class">TreeShared</span>.
+(Or after we merge <span class="class">TreeShared</span> into <span class="class">Node</span>,
+the perils of programming with <span class="class">Node</span>).</li>
+
</ins><span class="cx"> <li>Our desire to eliminate <span class="class">TreeShared</span> and instead have
</span><del>-<span class="variable">m_firstChild</span> and <span class="variable">m_next</span> be
-<span class="class">ListRefPtr</span> or the equivalent.</li>
</del><ins>+nodes hold a reference to their first child and next sibling.</li>
</ins><span class="cx">
</span><span class="cx"> <li>How we we mix reference counting with garbage collection to implement the DOM
</span><span class="cx"> and the JavaScript and Objective-C DOM bindings.</li>
</span><span class="cx">
</span><del>-<li>Comparison of our intrusive reference counting with other schemes such as the
-external reference counting in Boost <span class="class">shared_ptr</class>.</li>
</del><ins>+<li>Comparison of WebKit intrusive reference counting with other schemes such as the
+external reference counting in <span class="class">std::shared_ptr</class>.</li>
</ins><span class="cx">
</span><del>-<li>The <span class="class">OwnPtr</span> class template, and how it can be used
-with <span class="class">PassOwnPtr</span> and <span class="function">adoptPtr</span>.</li>
</del><ins>+<li>Guidelines for use of <span class="class">std::unique_ptr</span> and <span class="class">std::make_unique</span>.</li>
</ins><span class="cx">
</span><del>-<li>The <span class="class">OwnArrayPtr</span> class template,
-and <span class="class">PassOwnArrayPtr</span>.</li>
</del><ins>+<li>The <span class="class">RetainPtr</span> class template.</li>
</ins><span class="cx">
</span><del>-<li>The <span class="class">RetainPtr</span> class template,
-and the lack of a <span class="class">PassRetainPtr</span>.</li>
-
-<li>The <span class="class">ListRefPtr</span> class template.</li>
-
</del><span class="cx"> </ul>
</span><span class="cx">
</span><span class="cx"> <p>If you have any comments on the above or other ideas about improving the clarity,
</span></span></pre>
</div>
</div>
</body>
</html>