<!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>[204529] 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/204529">204529</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-08-16 15:32:50 -0700 (Tue, 16 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add WTF::ScopeExit
https://bugs.webkit.org/show_bug.cgi?id=160908

Reviewed by Geoffrey Garen.

Source/WTF:

WTF::ScopeExit and WTF::makeScopeExit let you define an object that will invoke a function when the
object goes out of scope. This is going to be used to avoid spagetti-code and gotos in a future patch.

The class is modeled after the LWG paper &quot;P0052 - Generic Scope Guard and RAII Wrapper for the Standard Library&quot;.

* WTF.xcodeproj/project.pbxproj:
* wtf/Scope.h: Added.
(WTF::makeScopeExit):

Tools:

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Scope.cpp: Added.
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPICMakeListstxt">trunk/Tools/TestWebKitAPI/CMakeLists.txt</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfScopeh">trunk/Source/WTF/wtf/Scope.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFScopecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/Scope.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (204528 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-08-16 22:26:40 UTC (rev 204528)
+++ trunk/Source/WTF/ChangeLog        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-08-16  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add WTF::ScopeExit
+        https://bugs.webkit.org/show_bug.cgi?id=160908
+
+        Reviewed by Geoffrey Garen.
+
+        WTF::ScopeExit and WTF::makeScopeExit let you define an object that will invoke a function when the
+        object goes out of scope. This is going to be used to avoid spagetti-code and gotos in a future patch.
+
+        The class is modeled after the LWG paper &quot;P0052 - Generic Scope Guard and RAII Wrapper for the Standard Library&quot;.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/Scope.h: Added.
+        (WTF::makeScopeExit):
+
</ins><span class="cx"> 2016-08-15  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add an address-of operator to RetainPtr
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (204528 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-08-16 22:26:40 UTC (rev 204528)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx">                 1A1D8B9C173186CE00141DA4 /* FunctionDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1D8B9B173186CE00141DA4 /* FunctionDispatcher.h */; };
</span><span class="cx">                 1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */; };
</span><span class="cx">                 1A233C7D17DAA6E300A93ACF /* MallocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A233C7C17DAA6E300A93ACF /* MallocPtr.h */; };
</span><ins>+                1A3524AB1D63A2FF0031729B /* Scope.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3524AA1D63A2FF0031729B /* Scope.h */; };
</ins><span class="cx">                 1A428B8C1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A428B8B1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h */; };
</span><span class="cx">                 1A4656191C7FC68E00F5920F /* OptionSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4656181C7FC68E00F5920F /* OptionSet.h */; };
</span><span class="cx">                 1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6BB768162F300500DD16DB /* StreamBuffer.h */; };
</span><span class="lines">@@ -416,6 +417,7 @@
</span><span class="cx">                 1A1D8B9B173186CE00141DA4 /* FunctionDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionDispatcher.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FunctionDispatcher.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A233C7C17DAA6E300A93ACF /* MallocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MallocPtr.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1A3524AA1D63A2FF0031729B /* Scope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scope.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A3F6BE6174ADA2100B2EEA7 /* NeverDestroyed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NeverDestroyed.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A428B8B1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppKitCompatibilityDeclarations.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4656181C7FC68E00F5920F /* OptionSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionSet.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -788,10 +790,10 @@
</span><span class="cx">                 A5BA15F11824339F00A82E69 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm */,
</del><span class="cx">                                 A5BA15F41824348000A82E69 /* StringImplMac.mm */,
</span><span class="cx">                                 A5BA15F2182433A900A82E69 /* StringMac.mm */,
</span><span class="cx">                                 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */,
</span><ins>+                                1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = mac;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -810,7 +812,6 @@
</span><span class="cx">                 A876DBD6151816E500DADB95 /* wtf */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */,
</del><span class="cx">                                 2CDED0F018115C3F004DBA70 /* cf */,
</span><span class="cx">                                 E4A0AD3B1A96251900536DF6 /* cocoa */,
</span><span class="cx">                                 A8A47281151A825A004123FF /* dtoa */,
</span><span class="lines">@@ -984,6 +985,7 @@
</span><span class="cx">                                 1469419416EAAFF80024E146 /* SchedulePair.h */,
</span><span class="cx">                                 1469419816EAB0410024E146 /* SchedulePairCF.cpp */,
</span><span class="cx">                                 1469419516EAAFF80024E146 /* SchedulePairMac.mm */,
</span><ins>+                                1A3524AA1D63A2FF0031729B /* Scope.h */,
</ins><span class="cx">                                 0FEC84B01BDACD390080FF74 /* ScopedLambda.h */,
</span><span class="cx">                                 A8A47306151A825B004123FF /* SegmentedVector.h */,
</span><span class="cx">                                 A8A47307151A825B004123FF /* SentinelLinkedList.h */,
</span><span class="lines">@@ -1025,6 +1027,7 @@
</span><span class="cx">                                 149EF16216BBFE0D000A4331 /* TriState.h */,
</span><span class="cx">                                 83FBA93119DF459700F30ADB /* TypeCasts.h */,
</span><span class="cx">                                 A8A4735C151A825B004123FF /* UnionFind.h */,
</span><ins>+                                5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */,
</ins><span class="cx">                                 A8A4736F151A825B004123FF /* ValueCheck.h */,
</span><span class="cx">                                 7CD0D5A71D55322A000CC9E1 /* Variant.h */,
</span><span class="cx">                                 A8A47370151A825B004123FF /* Vector.h */,
</span><span class="lines">@@ -1083,8 +1086,8 @@
</span><span class="cx">                 A8A4731B151A825B004123FF /* text */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                A5BA15F61824359E00A82E69 /* cf */,
</ins><span class="cx">                                 1C181C881D307AB800F5FA16 /* icu */,
</span><del>-                                A5BA15F61824359E00A82E69 /* cf */,
</del><span class="cx">                                 A5BA15F11824339F00A82E69 /* mac */,
</span><span class="cx">                                 A8A4731C151A825B004123FF /* ASCIIFastPath.h */,
</span><span class="cx">                                 A8A4731D151A825B004123FF /* AtomicString.cpp */,
</span><span class="lines">@@ -1101,6 +1104,7 @@
</span><span class="cx">                                 A8A47322151A825B004123FF /* CString.h */,
</span><span class="cx">                                 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */,
</span><span class="cx">                                 93AC91A718942FC400244939 /* LChar.h */,
</span><ins>+                                1C181C811D30797C00F5FA16 /* LineBreakIteratorPoolICU.h */,
</ins><span class="cx">                                 A8A47323151A825B004123FF /* StringBuffer.h */,
</span><span class="cx">                                 A8A47324151A825B004123FF /* StringBuilder.cpp */,
</span><span class="cx">                                 A8A47325151A825B004123FF /* StringBuilder.h */,
</span><span class="lines">@@ -1116,14 +1120,13 @@
</span><span class="cx">                                 70ECA60B1B02426800449739 /* SymbolImpl.h */,
</span><span class="cx">                                 70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */,
</span><span class="cx">                                 70A993FD1AD7151300FA615B /* SymbolRegistry.h */,
</span><ins>+                                1C181C7D1D3078DA00F5FA16 /* TextBreakIterator.cpp */,
+                                1C181C7E1D3078DA00F5FA16 /* TextBreakIterator.h */,
+                                1C181C821D3079AC00F5FA16 /* TextBreakIteratorInternalICU.h */,
</ins><span class="cx">                                 A8A4732C151A825B004123FF /* TextPosition.h */,
</span><span class="cx">                                 70ECA60C1B02426800449739 /* UniquedStringImpl.h */,
</span><span class="cx">                                 A8A4732D151A825B004123FF /* WTFString.cpp */,
</span><span class="cx">                                 A8A4732E151A825B004123FF /* WTFString.h */,
</span><del>-                                1C181C7D1D3078DA00F5FA16 /* TextBreakIterator.cpp */,
-                                1C181C7E1D3078DA00F5FA16 /* TextBreakIterator.h */,
-                                1C181C811D30797C00F5FA16 /* LineBreakIteratorPoolICU.h */,
-                                1C181C821D3079AC00F5FA16 /* TextBreakIteratorInternalICU.h */,
</del><span class="cx">                         );
</span><span class="cx">                         path = text;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1171,9 +1174,9 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 DE5A09FB1BA36992003D4424 /* CommonCryptoSPI.h */,
</span><ins>+                                93DDE9311CDC052D00FD3491 /* dyldSPI.h */,
</ins><span class="cx">                                 A5098AFF1C169E0700087797 /* SandboxSPI.h */,
</span><span class="cx">                                 CE73E02419DCB7AB00580D5C /* XPCSPI.h */,
</span><del>-                                93DDE9311CDC052D00FD3491 /* dyldSPI.h */,
</del><span class="cx">                         );
</span><span class="cx">                         path = darwin;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1218,10 +1221,9 @@
</span><span class="cx">                         isa = PBXHeadersBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                1A428B8C1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h in Headers */,
</ins><span class="cx">                                 A8A47385151A825B004123FF /* ASCIICType.h in Headers */,
</span><del>-                                5C7C88D41D0A3A0A009D2F6D /* UniqueRef.h in Headers */,
</del><span class="cx">                                 A8A47434151A825B004123FF /* ASCIIFastPath.h in Headers */,
</span><del>-                                539EB0631D55284200C82EF7 /* LEBDecoder.h in Headers */,
</del><span class="cx">                                 A8A47387151A825B004123FF /* Assertions.h in Headers */,
</span><span class="cx">                                 A8A47388151A825B004123FF /* Atomics.h in Headers */,
</span><span class="cx">                                 A8A47436151A825B004123FF /* AtomicString.h in Headers */,
</span><span class="lines">@@ -1229,8 +1231,8 @@
</span><span class="cx">                                 A8A47438151A825B004123FF /* AtomicStringImpl.h in Headers */,
</span><span class="cx">                                 9BD8F40B176C2B470002D865 /* AtomicStringTable.h in Headers */,
</span><span class="cx">                                 1469419C16EAB10A0024E146 /* AutodrainedPool.h in Headers */,
</span><ins>+                                DCEE22051CEB9869000C2396 /* BackwardsGraph.h in Headers */,
</ins><span class="cx">                                 0FB14E19180FA218009B6B4D /* Bag.h in Headers */,
</span><del>-                                DCEE22001CEA7551000C2396 /* BlockObjCExceptions.h in Headers */,
</del><span class="cx">                                 0FB14E1B1810E1DC009B6B4D /* BagToHashMap.h in Headers */,
</span><span class="cx">                                 8134013915B092FD001FF0B8 /* Base64.h in Headers */,
</span><span class="cx">                                 A8A473A9151A825B004123FF /* bignum-dtoa.h in Headers */,
</span><span class="lines">@@ -1238,9 +1240,8 @@
</span><span class="cx">                                 A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */,
</span><span class="cx">                                 A8A4738A151A825B004123FF /* Bitmap.h in Headers */,
</span><span class="cx">                                 A8A4738C151A825B004123FF /* BitVector.h in Headers */,
</span><del>-                                515F79561CFD3A6900CCED93 /* CrossThreadQueue.h in Headers */,
</del><ins>+                                DCEE22001CEA7551000C2396 /* BlockObjCExceptions.h in Headers */,
</ins><span class="cx">                                 1A944F471C3D8814005BD28C /* BlockPtr.h in Headers */,
</span><del>-                                93DDE9321CDC052D00FD3491 /* dyldSPI.h in Headers */,
</del><span class="cx">                                 A8A4738E151A825B004123FF /* BlockStack.h in Headers */,
</span><span class="cx">                                 A8A4738F151A825B004123FF /* BloomFilter.h in Headers */,
</span><span class="cx">                                 0F93274B1C17F4B700CF6564 /* Box.h in Headers */,
</span><span class="lines">@@ -1248,20 +1249,21 @@
</span><span class="cx">                                 A8A47391151A825B004123FF /* BumpPointerAllocator.h in Headers */,
</span><span class="cx">                                 EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */,
</span><span class="cx">                                 A8A473AD151A825B004123FF /* cached-powers.h in Headers */,
</span><del>-                                DCEE22051CEB9869000C2396 /* BackwardsGraph.h in Headers */,
</del><ins>+                                DCEE21FB1CEA7538000C2396 /* CFBundleSPI.h in Headers */,
</ins><span class="cx">                                 A8A4745E151A825B004123FF /* CharacterNames.h in Headers */,
</span><span class="cx">                                 A8A47394151A825B004123FF /* CheckedArithmetic.h in Headers */,
</span><span class="cx">                                 A8A47395151A825B004123FF /* CheckedBoolean.h in Headers */,
</span><span class="cx">                                 A8A4745F151A825B004123FF /* Collator.h in Headers */,
</span><span class="cx">                                 0FC4EDE61696149600F65041 /* CommaPrinter.h in Headers */,
</span><del>-                                79EC70611C99F9BC003A3AE2 /* SmallPtrSet.h in Headers */,
</del><span class="cx">                                 DE5A09FC1BA36992003D4424 /* CommonCryptoSPI.h in Headers */,
</span><span class="cx">                                 0F8F2B91172E00FC007DBDA5 /* CompilationThread.h in Headers */,
</span><span class="cx">                                 A8A47398151A825B004123FF /* Compiler.h in Headers */,
</span><del>-                                1A428B8C1C8F89DD0051E9EB /* AppKitCompatibilityDeclarations.h in Headers */,
</del><span class="cx">                                 0FDB698E1B7C643A000C1078 /* Condition.h in Headers */,
</span><span class="cx">                                 A8A4748C151A8264004123FF /* config.h in Headers */,
</span><span class="cx">                                 0F8F2B9C172F2596007DBDA5 /* ConversionMode.h in Headers */,
</span><ins>+                                515F794F1CFC9F4A00CCED93 /* CrossThreadCopier.h in Headers */,
+                                515F79561CFD3A6900CCED93 /* CrossThreadQueue.h in Headers */,
+                                515F79501CFC9F4A00CCED93 /* CrossThreadTask.h in Headers */,
</ins><span class="cx">                                 A8A4739B151A825B004123FF /* CryptographicallyRandomNumber.h in Headers */,
</span><span class="cx">                                 E15556F618A0CC18006F48FB /* CryptographicUtilities.h in Headers */,
</span><span class="cx">                                 A8A4743A151A825B004123FF /* CString.h in Headers */,
</span><span class="lines">@@ -1278,6 +1280,7 @@
</span><span class="cx">                                 A8A473B2151A825B004123FF /* double.h in Headers */,
</span><span class="cx">                                 A8A473A7151A825B004123FF /* DoublyLinkedList.h in Headers */,
</span><span class="cx">                                 A8A473BB151A825B004123FF /* dtoa.h in Headers */,
</span><ins>+                                93DDE9321CDC052D00FD3491 /* dyldSPI.h in Headers */,
</ins><span class="cx">                                 A8A473C1151A825B004123FF /* ExportMacros.h in Headers */,
</span><span class="cx">                                 A8A473B4151A825B004123FF /* fast-dtoa.h in Headers */,
</span><span class="cx">                                 0FD81AC5154FB22E00983E72 /* FastBitVector.h in Headers */,
</span><span class="lines">@@ -1287,6 +1290,7 @@
</span><span class="cx">                                 A8A473B6151A825B004123FF /* fixed-dtoa.h in Headers */,
</span><span class="cx">                                 0F2B66A717B6B4FD00A7AE3F /* FlipBytes.h in Headers */,
</span><span class="cx">                                 A8A473C8151A825B004123FF /* Forward.h in Headers */,
</span><ins>+                                83F2BADF1CF9524E003E99C3 /* Function.h in Headers */,
</ins><span class="cx">                                 1A1D8B9C173186CE00141DA4 /* FunctionDispatcher.h in Headers */,
</span><span class="cx">                                 A8A473CA151A825B004123FF /* GetPtr.h in Headers */,
</span><span class="cx">                                 0FEC84AF1BD825310080FF74 /* GraphNodeWorklist.h in Headers */,
</span><span class="lines">@@ -1293,7 +1297,6 @@
</span><span class="cx">                                 2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */,
</span><span class="cx">                                 A8A473D3151A825B004123FF /* HashCountedSet.h in Headers */,
</span><span class="cx">                                 A8A4742D151A825B004123FF /* Hasher.h in Headers */,
</span><del>-                                1C181C901D307AB800F5FA16 /* UTextProvider.h in Headers */,
</del><span class="cx">                                 A8A473D4151A825B004123FF /* HashFunctions.h in Headers */,
</span><span class="cx">                                 A8A473D5151A825B004123FF /* HashIterators.h in Headers */,
</span><span class="cx">                                 A8A473D6151A825B004123FF /* HashMap.h in Headers */,
</span><span class="lines">@@ -1301,7 +1304,7 @@
</span><span class="cx">                                 A8A473D9151A825B004123FF /* HashTable.h in Headers */,
</span><span class="cx">                                 A8A473DA151A825B004123FF /* HashTraits.h in Headers */,
</span><span class="cx">                                 A8A473DB151A825B004123FF /* HexNumber.h in Headers */,
</span><del>-                                83F2BADF1CF9524E003E99C3 /* Function.h in Headers */,
</del><ins>+                                FE8925B01D00DAEC0046907E /* Indenter.h in Headers */,
</ins><span class="cx">                                 2684D4361C000D400081D663 /* IndexSparseSet.h in Headers */,
</span><span class="cx">                                 A8A473DC151A825B004123FF /* InlineASM.h in Headers */,
</span><span class="cx">                                 A70DA0841799F04D00529A9B /* Insertion.h in Headers */,
</span><span class="lines">@@ -1309,18 +1312,17 @@
</span><span class="cx">                                 7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */,
</span><span class="cx">                                 7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */,
</span><span class="cx">                                 93AC91A818942FC400244939 /* LChar.h in Headers */,
</span><ins>+                                539EB0631D55284200C82EF7 /* LEBDecoder.h in Headers */,
</ins><span class="cx">                                 A70DA0851799F04D00529A9B /* ListDump.h in Headers */,
</span><del>-                                1C181C941D307AB800F5FA16 /* UTextProviderUTF16.h in Headers */,
</del><span class="cx">                                 A8A473E1151A825B004123FF /* ListHashSet.h in Headers */,
</span><span class="cx">                                 0FE1646B1B6FFC9600400E7C /* Lock.h in Headers */,
</span><span class="cx">                                 A8A473E3151A825B004123FF /* Locker.h in Headers */,
</span><ins>+                                513E170B1CD7D5BF00E3650B /* LoggingAccumulator.h in Headers */,
</ins><span class="cx">                                 A8A473E6151A825B004123FF /* MainThread.h in Headers */,
</span><del>-                                515F794F1CFC9F4A00CCED93 /* CrossThreadCopier.h in Headers */,
</del><span class="cx">                                 1A233C7D17DAA6E300A93ACF /* MallocPtr.h in Headers */,
</span><span class="cx">                                 A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
</span><span class="cx">                                 A8A473EA151A825B004123FF /* MD5.h in Headers */,
</span><span class="cx">                                 CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
</span><del>-                                1C181C801D3078DA00F5FA16 /* TextBreakIterator.h in Headers */,
</del><span class="cx">                                 A8A473EB151A825B004123FF /* MessageQueue.h in Headers */,
</span><span class="cx">                                 A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */,
</span><span class="cx">                                 A8A473EE151A825B004123FF /* MetaAllocatorHandle.h in Headers */,
</span><span class="lines">@@ -1347,6 +1349,7 @@
</span><span class="cx">                                 0F824A691B7443A0002E345D /* ParkingLot.h in Headers */,
</span><span class="cx">                                 A8A4740C151A825B004123FF /* PassRefPtr.h in Headers */,
</span><span class="cx">                                 A876DBD8151816E500DADB95 /* Platform.h in Headers */,
</span><ins>+                                DCEE22021CEA7551000C2396 /* PlatformUserPreferredLanguages.h in Headers */,
</ins><span class="cx">                                 0FF860951BCCBD740045127F /* PointerComparison.h in Headers */,
</span><span class="cx">                                 0F9D3363165DBA73005AD387 /* PrintStream.h in Headers */,
</span><span class="cx">                                 0FC4488316FE9FE100844BE9 /* ProcessID.h in Headers */,
</span><span class="lines">@@ -1354,7 +1357,6 @@
</span><span class="cx">                                 A8A47415151A825B004123FF /* RandomNumber.h in Headers */,
</span><span class="cx">                                 A8A47416151A825B004123FF /* RandomNumberSeed.h in Headers */,
</span><span class="cx">                                 0F725CAC1C50461600AD943A /* RangeSet.h in Headers */,
</span><del>-                                513E170B1CD7D5BF00E3650B /* LoggingAccumulator.h in Headers */,
</del><span class="cx">                                 0F87105A16643F190090B0AD /* RawPointer.h in Headers */,
</span><span class="cx">                                 A8A47417151A825B004123FF /* RedBlackTree.h in Headers */,
</span><span class="cx">                                 26299B6E17A9E5B800ADEBE5 /* Ref.h in Headers */,
</span><span class="lines">@@ -1364,12 +1366,12 @@
</span><span class="cx">                                 86F46F611A2840EE00CCBF22 /* RefCounter.h in Headers */,
</span><span class="cx">                                 A8A4741C151A825B004123FF /* RefPtr.h in Headers */,
</span><span class="cx">                                 A8A4741E151A825B004123FF /* RetainPtr.h in Headers */,
</span><del>-                                515F79501CFC9F4A00CCED93 /* CrossThreadTask.h in Headers */,
</del><span class="cx">                                 2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */,
</span><span class="cx">                                 1469419216EAAF6D0024E146 /* RunLoopTimer.h in Headers */,
</span><span class="cx">                                 A5098B001C169E0700087797 /* SandboxSPI.h in Headers */,
</span><span class="cx">                                 14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */,
</span><span class="cx">                                 1469419616EAAFF80024E146 /* SchedulePair.h in Headers */,
</span><ins>+                                1A3524AB1D63A2FF0031729B /* Scope.h in Headers */,
</ins><span class="cx">                                 0FEC84B11BDACD390080FF74 /* ScopedLambda.h in Headers */,
</span><span class="cx">                                 A5098B021C16A4F900087797 /* SecuritySPI.h in Headers */,
</span><span class="cx">                                 A8A4741F151A825B004123FF /* SegmentedVector.h in Headers */,
</span><span class="lines">@@ -1379,11 +1381,10 @@
</span><span class="cx">                                 A8A47423151A825B004123FF /* SimpleStats.h in Headers */,
</span><span class="cx">                                 A8A47424151A825B004123FF /* SinglyLinkedList.h in Headers */,
</span><span class="cx">                                 A748745317A0BDAE00FA04CB /* SixCharacterHash.h in Headers */,
</span><ins>+                                79EC70611C99F9BC003A3AE2 /* SmallPtrSet.h in Headers */,
</ins><span class="cx">                                 A8A47426151A825B004123FF /* Spectrum.h in Headers */,
</span><span class="cx">                                 A8A47428151A825B004123FF /* StackBounds.h in Headers */,
</span><del>-                                1C181C921D307AB800F5FA16 /* UTextProviderLatin1.h in Headers */,
</del><span class="cx">                                 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */,
</span><del>-                                7CD0D5A91D5534A7000CC9E1 /* Variant.h in Headers */,
</del><span class="cx">                                 A8A47429151A825B004123FF /* StaticConstructors.h in Headers */,
</span><span class="cx">                                 A8A4742A151A825B004123FF /* StdLibExtras.h in Headers */,
</span><span class="cx">                                 C4F8A93719C65EB400B2B15D /* Stopwatch.h in Headers */,
</span><span class="lines">@@ -1396,7 +1397,6 @@
</span><span class="cx">                                 A8A4743F151A825B004123FF /* StringHash.h in Headers */,
</span><span class="cx">                                 A748745417A0BDAE00FA04CB /* StringHashDumpContext.h in Headers */,
</span><span class="cx">                                 A8A47441151A825B004123FF /* StringImpl.h in Headers */,
</span><del>-                                DCEE21FB1CEA7538000C2396 /* CFBundleSPI.h in Headers */,
</del><span class="cx">                                 A8A47442151A825B004123FF /* StringOperators.h in Headers */,
</span><span class="cx">                                 0FDDBFA81666DFA300C55FEF /* StringPrintStream.h in Headers */,
</span><span class="cx">                                 1A6EB1E0187D0BD30030126F /* StringView.h in Headers */,
</span><span class="lines">@@ -1405,6 +1405,7 @@
</span><span class="cx">                                 70A993FF1AD7151300FA615B /* SymbolRegistry.h in Headers */,
</span><span class="cx">                                 0FB317C41C488001007E395A /* SystemTracing.h in Headers */,
</span><span class="cx">                                 A8A47433151A825B004123FF /* TemporaryChange.h in Headers */,
</span><ins>+                                1C181C801D3078DA00F5FA16 /* TextBreakIterator.h in Headers */,
</ins><span class="cx">                                 A8A47444151A825B004123FF /* TextPosition.h in Headers */,
</span><span class="cx">                                 A8A47447151A825B004123FF /* ThreadFunctionInvocation.h in Headers */,
</span><span class="cx">                                 A8A47449151A825B004123FF /* ThreadIdentifierDataPthreads.h in Headers */,
</span><span class="lines">@@ -1414,16 +1415,19 @@
</span><span class="cx">                                 A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */,
</span><span class="cx">                                 553071CA1C40427200384898 /* TinyLRUCache.h in Headers */,
</span><span class="cx">                                 0FED67B61B22D4D80066CE15 /* TinyPtrSet.h in Headers */,
</span><del>-                                DCEE22021CEA7551000C2396 /* PlatformUserPreferredLanguages.h in Headers */,
</del><span class="cx">                                 149EF16316BBFE0D000A4331 /* TriState.h in Headers */,
</span><span class="cx">                                 83FBA93219DF459700F30ADB /* TypeCasts.h in Headers */,
</span><span class="cx">                                 1AFDE648195201C300C48FFA /* TypeCastsCF.h in Headers */,
</span><del>-                                FE8925B01D00DAEC0046907E /* Indenter.h in Headers */,
</del><span class="cx">                                 A8A4746D151A825B004123FF /* UnionFind.h in Headers */,
</span><span class="cx">                                 70ECA60F1B02426800449739 /* UniquedStringImpl.h in Headers */,
</span><ins>+                                5C7C88D41D0A3A0A009D2F6D /* UniqueRef.h in Headers */,
+                                1C181C901D307AB800F5FA16 /* UTextProvider.h in Headers */,
+                                1C181C921D307AB800F5FA16 /* UTextProviderLatin1.h in Headers */,
+                                1C181C941D307AB800F5FA16 /* UTextProviderUTF16.h in Headers */,
</ins><span class="cx">                                 A8A4746A151A825B004123FF /* UTF8.h in Headers */,
</span><span class="cx">                                 A8A473B9151A825B004123FF /* utils.h in Headers */,
</span><span class="cx">                                 A8A4747D151A825B004123FF /* ValueCheck.h in Headers */,
</span><ins>+                                7CD0D5A91D5534A7000CC9E1 /* Variant.h in Headers */,
</ins><span class="cx">                                 A8A4747E151A825B004123FF /* Vector.h in Headers */,
</span><span class="cx">                                 A8A4747F151A825B004123FF /* VectorTraits.h in Headers */,
</span><span class="cx">                                 A8A47480151A825B004123FF /* VMTags.h in Headers */,
</span><span class="lines">@@ -1546,14 +1550,15 @@
</span><span class="cx">                                 A8A473AA151A825B004123FF /* bignum.cc in Sources */,
</span><span class="cx">                                 A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */,
</span><span class="cx">                                 A8A4738B151A825B004123FF /* BitVector.cpp in Sources */,
</span><ins>+                                DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */,
</ins><span class="cx">                                 A8A473AC151A825B004123FF /* cached-powers.cc in Sources */,
</span><span class="cx">                                 A8A47460151A825B004123FF /* CollatorDefault.cpp in Sources */,
</span><span class="cx">                                 A8A47463151A825B004123FF /* CollatorICU.cpp in Sources */,
</span><span class="cx">                                 0F8F2B92172E0103007DBDA5 /* CompilationThread.cpp in Sources */,
</span><ins>+                                515F794E1CFC9F4A00CCED93 /* CrossThreadCopier.cpp in Sources */,
</ins><span class="cx">                                 A8A4739A151A825B004123FF /* CryptographicallyRandomNumber.cpp in Sources */,
</span><span class="cx">                                 E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */,
</span><span class="cx">                                 A8A47439151A825B004123FF /* CString.cpp in Sources */,
</span><del>-                                1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm in Sources */,
</del><span class="cx">                                 A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */,
</span><span class="cx">                                 A8A4739E151A825B004123FF /* DataLog.cpp in Sources */,
</span><span class="cx">                                 A8A473A0151A825B004123FF /* DateMath.cpp in Sources */,
</span><span class="lines">@@ -1565,9 +1570,7 @@
</span><span class="cx">                                 A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */,
</span><span class="cx">                                 0F885E0F1845AEA900F1E3FA /* FastBitVector.cpp in Sources */,
</span><span class="cx">                                 A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
</span><del>-                                DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */,
</del><span class="cx">                                 0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
</span><del>-                                1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
</del><span class="cx">                                 A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */,
</span><span class="cx">                                 1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */,
</span><span class="cx">                                 2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */,
</span><span class="lines">@@ -1582,9 +1585,9 @@
</span><span class="cx">                                 A8A473F7151A825B004123FF /* OSAllocatorPosix.cpp in Sources */,
</span><span class="cx">                                 A8A473F9151A825B004123FF /* OSRandomSource.cpp in Sources */,
</span><span class="cx">                                 A8A47402151A825B004123FF /* PageBlock.cpp in Sources */,
</span><del>-                                1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
</del><span class="cx">                                 0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */,
</span><span class="cx">                                 0F824A681B7443A0002E345D /* ParkingLot.cpp in Sources */,
</span><ins>+                                DCEE22031CEA7551000C2396 /* PlatformUserPreferredLanguagesMac.mm in Sources */,
</ins><span class="cx">                                 0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */,
</span><span class="cx">                                 143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
</span><span class="cx">                                 A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
</span><span class="lines">@@ -1598,7 +1601,6 @@
</span><span class="cx">                                 A748745217A0BDAE00FA04CB /* SixCharacterHash.cpp in Sources */,
</span><span class="cx">                                 A8A47425151A825B004123FF /* SizeLimits.cpp in Sources */,
</span><span class="cx">                                 A8A47427151A825B004123FF /* StackBounds.cpp in Sources */,
</span><del>-                                515F794E1CFC9F4A00CCED93 /* CrossThreadCopier.cpp in Sources */,
</del><span class="cx">                                 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */,
</span><span class="cx">                                 A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */,
</span><span class="cx">                                 A5BA15FB182435A600A82E69 /* StringCF.cpp in Sources */,
</span><span class="lines">@@ -1612,16 +1614,18 @@
</span><span class="cx">                                 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */,
</span><span class="cx">                                 93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */,
</span><span class="cx">                                 A8A473B7151A825B004123FF /* strtod.cc in Sources */,
</span><ins>+                                70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */,
</ins><span class="cx">                                 1C181C7F1D3078DA00F5FA16 /* TextBreakIterator.cpp in Sources */,
</span><del>-                                1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
-                                70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */,
</del><ins>+                                1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm in Sources */,
</ins><span class="cx">                                 A8A47448151A825B004123FF /* ThreadIdentifierDataPthreads.cpp in Sources */,
</span><span class="cx">                                 A8A4744A151A825B004123FF /* Threading.cpp in Sources */,
</span><span class="cx">                                 A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */,
</span><ins>+                                1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
+                                1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
+                                1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
</ins><span class="cx">                                 A8A47469151A825B004123FF /* UTF8.cpp in Sources */,
</span><span class="cx">                                 1FA47C8A152502DA00568D1B /* WebCoreThread.cpp in Sources */,
</span><span class="cx">                                 0FE4479C1B7AAA03009498EB /* WordLock.cpp in Sources */,
</span><del>-                                DCEE22031CEA7551000C2396 /* PlatformUserPreferredLanguagesMac.mm in Sources */,
</del><span class="cx">                                 E4A0AD391A96245500536DF6 /* WorkQueue.cpp in Sources */,
</span><span class="cx">                                 E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */,
</span><span class="cx">                                 A8A47445151A825B004123FF /* WTFString.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfScopeh"></a>
<div class="addfile"><h4>Added: trunk/Source/WTF/wtf/Scope.h (0 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Scope.h                                (rev 0)
+++ trunk/Source/WTF/wtf/Scope.h        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &lt;type_traits&gt;
+#include &lt;wtf/StdLibExtras.h&gt;
+
+// Based on http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0052r2.pdf
+
+namespace WTF {
+
+template&lt;typename ExitFunction&gt;
+class ScopeExit final {
+public:
+    template&lt;typename ExitFunctionParameter&gt;
+    explicit ScopeExit(ExitFunctionParameter&amp;&amp; exitFunction)
+        : m_exitFunction(std::forward&lt;ExitFunction&gt;(m_exitFunction))
+    {
+    }
+
+    ScopeExit(ScopeExit&amp;&amp; other)
+        : m_exitFunction(WTFMove(other.m_exitFunction))
+        , m_executeOnDestruction(std::exchange(other.m_executeOnDestruction, false))
+    {
+    }
+
+    ~ScopeExit()
+    {
+        if (m_executeOnDestruction)
+            m_exitFunction();
+    }
+
+    void release()
+    {
+        m_executeOnDestruction = false;
+    }
+
+    ScopeExit(const ScopeExit&amp;) = delete;
+    ScopeExit&amp; operator=(const ScopeExit&amp;) = delete;
+    ScopeExit&amp; operator=(ScopeExit&amp;&amp;) = delete;
+
+private:
+    ExitFunction m_exitFunction;
+    bool m_executeOnDestruction { true };
+};
+
+template&lt;typename ExitFunction&gt;
+ScopeExit&lt;ExitFunction&gt; makeScopeExit(ExitFunction&amp;&amp; exitFunction)
+{
+    return ScopeExit&lt;ExitFunction&gt;(std::forward&lt;ExitFunction&gt;(exitFunction));
+}
+
+}
+
+using WTF::ScopeExit;
+using WTF::makeScopeExit;
</ins></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (204528 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-08-16 22:26:40 UTC (rev 204528)
+++ trunk/Tools/ChangeLog        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-08-16  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Add WTF::ScopeExit
+        https://bugs.webkit.org/show_bug.cgi?id=160908
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/Scope.cpp: Added.
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-08-16  Aakash Jain  &lt;aakash_jain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         EWS logs file are rotated too quickly
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPICMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (204528 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/CMakeLists.txt        2016-08-16 22:26:40 UTC (rev 204528)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Scope.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/ScopedLambda.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (204528 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-08-16 22:26:40 UTC (rev 204528)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">                 0F139E791A42457000F590F5 /* PlatformUtilitiesCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */; };
</span><span class="cx">                 0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */; };
</span><span class="cx">                 1A02C870125D4CFD00E3F4BD /* find.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A02C84B125D4A5E00E3F4BD /* find.html */; };
</span><ins>+                1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3524AC1D63A4FB0031729B /* Scope.cpp */; };
</ins><span class="cx">                 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A4F81CD1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm */; };
</span><span class="cx">                 1A50AA201A2A51FC00F4C345 /* close-from-within-create-page.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1A50AA1F1A2A4EA500F4C345 /* close-from-within-create-page.html */; };
</span><span class="cx">                 1A63479F183D72A4005B1707 /* all-content-in-one-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */; };
</span><span class="lines">@@ -656,6 +657,7 @@
</span><span class="cx">                 1A02C84B125D4A5E00E3F4BD /* find.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = find.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A02C84E125D4A8400E3F4BD /* Find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Find.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A3524A91D627BD40031729B /* DeletedAddressOfOperator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeletedAddressOfOperator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                1A3524AC1D63A4FB0031729B /* Scope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scope.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1A4F81C81BDFFD18004E672E /* RemoteObjectRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteObjectRegistry.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4F81CD1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteObjectRegistryPlugIn.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1A4F81D01BDFFDCF004E672E /* RemoteObjectRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteObjectRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1633,6 +1635,7 @@
</span><span class="cx">                                 93A427A8180D9B0700CD24D7 /* RefPtr.cpp */,
</span><span class="cx">                                 E4C9ABC71B3DB1710040A987 /* RunLoop.cpp */,
</span><span class="cx">                                 14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */,
</span><ins>+                                1A3524AC1D63A4FB0031729B /* Scope.cpp */,
</ins><span class="cx">                                 DC69AA621CF77C6500C6272F /* ScopedLambda.cpp */,
</span><span class="cx">                                 CD5393C91757BAC400C07123 /* SHA1.cpp */,
</span><span class="cx">                                 81B50192140F232300D9EB58 /* StringBuilder.cpp */,
</span><span class="lines">@@ -2093,6 +2096,7 @@
</span><span class="cx">                                 7C83DE9C1D0A590C00FEBCF3 /* BloomFilter.cpp in Sources */,
</span><span class="cx">                                 7C83DEA01D0A590C00FEBCF3 /* CheckedArithmeticOperations.cpp in Sources */,
</span><span class="cx">                                 7C83DEC31D0A590C00FEBCF3 /* Condition.cpp in Sources */,
</span><ins>+                                1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */,
</ins><span class="cx">                                 7C83DEA61D0A590C00FEBCF3 /* Counters.cpp in Sources */,
</span><span class="cx">                                 7C83DEA91D0A590C00FEBCF3 /* CString.cpp in Sources */,
</span><span class="cx">                                 7C83DEAD1D0A590C00FEBCF3 /* Deque.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFScopecpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WTF/Scope.cpp (0 => 204529)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/Scope.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Scope.cpp        2016-08-16 22:32:50 UTC (rev 204529)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &lt;wtf/Scope.h&gt;
+
+namespace TestWebKitAPI {
+
+TEST(WTF_Scope, ScopeExit)
+{
+    bool isCalled = false;
+    {
+        auto scopeExit = makeScopeExit([&amp;] {
+            EXPECT_FALSE(isCalled);
+            isCalled = true;
+        });
+        EXPECT_FALSE(isCalled);
+    }
+    EXPECT_TRUE(isCalled);
+
+    isCalled = false;
+    {
+        auto scopeExit = makeScopeExit([&amp;] {
+            isCalled = true;
+        });
+        scopeExit.release();
+    }
+    EXPECT_FALSE(isCalled);
+}
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>