<!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>[174045] 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/174045">174045</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-09-28 13:59:28 -0700 (Sun, 28 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Replace OSObjectPtr with RetainPtr/adoptOS
https://bugs.webkit.org/show_bug.cgi?id=137158

Reviewed by Dan Bernstein.

Source/WebKit2:

* DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
(DatabaseServiceInitializer):
* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(WebKit::NetworkServiceInitializerDelegate::NetworkServiceInitializerDelegate):
(NetworkServiceInitializer):
* Platform/IPC/Connection.h:
(IPC::Connection::Identifier::Identifier):
* Platform/IPC/mac/ConnectionMac.mm:
(IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
(IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
* PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
(WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
(PluginServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::checkEntitlements):
(WebKit::XPCServiceInitializerDelegate::hasEntitlement):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
(WebKit::XPCServiceEventHandler):
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
(WebKit::XPCServiceEventHandler):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::connectToService):
(WebKit::connectToReExecService):
* WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
(WebContentServiceInitializer):

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/OSObjectPtr.h: Removed.
* wtf/RetainPtr.h:
(WTF::adoptOS):
Added. This adopt function is slightly different than both adoptCF and adoptNS,
in that unlike adoptCF(), it can be passed an Objective-C type (since OS objects
are sometimes Objective-C objects, but not always), and unlike adoptNS() it doesn't 
require us to jump through hoops to appease GC (since OS objects are not Objective-C
objects if GC is enabled).

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp: Removed.
* TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp.
Rename and change test to use RetainPtr. Remove now unneeded part testing WTF::retainOSObject/WTF::releaseOSObject.</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="#trunkSourceWTFwtfRetainPtrh">trunk/Source/WTF/wtf/RetainPtr.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DatabaseProcessEntryPointmacXPCServiceDatabaseServiceEntryPointmm">trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessEntryPointmacXPCServiceNetworkServiceEntryPointmm">trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectionh">trunk/Source/WebKit2/Platform/IPC/Connection.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCmacConnectionMacmm">trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessEntryPointmacXPCServicePluginServiceEntryPointmm">trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointh">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainDevelopmentmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm">trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm">trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessEntryPointmacXPCServiceWebContentServiceEntryPointmm">trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWTFdarwinRetainPtrOSObjectcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfOSObjectPtrh">trunk/Source/WTF/wtf/OSObjectPtr.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFdarwinOSObjectPtrcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WTF/ChangeLog        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-09-26  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Replace OSObjectPtr with RetainPtr/adoptOS
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+
+        Reviewed by Dan Bernstein.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/OSObjectPtr.h: Removed.
+        * wtf/RetainPtr.h:
+        (WTF::adoptOS):
+        Added. This adopt function is slightly different than both adoptCF and adoptNS,
+        in that unlike adoptCF(), it can be passed an Objective-C type (since OS objects
+        are sometimes Objective-C objects, but not always), and unlike adoptNS() it doesn't 
+        require us to jump through hoops to appease GC (since OS objects are not Objective-C
+        objects if GC is enabled).
+
</ins><span class="cx"> 2014-09-24  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         FTL should sink object allocations
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -73,7 +73,6 @@
</span><span class="cx">                 2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
</span><span class="cx">                 2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
</span><span class="cx">                 2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; };
</span><del>-                7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */; };
</del><span class="cx">                 7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */; };
</span><span class="cx">                 7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF9186D2A54007433CD /* IteratorRange.h */; };
</span><span class="cx">                 7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
</span><span class="lines">@@ -360,7 +359,6 @@
</span><span class="cx">                 5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5D247B7314689C4700E78B76 /* WTF.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WTF.xcconfig; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyWTFHeaders.xcconfig; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSObjectPtr.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorAdaptors.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CDD7FF9186D2A54007433CD /* IteratorRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorRange.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -790,7 +788,6 @@
</span><span class="cx">                                 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
</span><span class="cx">                                 A8A472D7151A825B004123FF /* OSAllocator.h */,
</span><span class="cx">                                 A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */,
</span><del>-                                7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */,
</del><span class="cx">                                 A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
</span><span class="cx">                                 A8A472DB151A825B004123FF /* OSRandomSource.h */,
</span><span class="cx">                                 1AFDE6521953B23D00C48FFA /* Optional.h */,
</span><span class="lines">@@ -1085,7 +1082,6 @@
</span><span class="cx">                                 A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
</span><span class="cx">                                 93B1AA80180E5AF3004A2F05 /* PassRef.h in Headers */,
</span><span class="cx">                                 A8A473EA151A825B004123FF /* MD5.h in Headers */,
</span><del>-                                7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */,
</del><span class="cx">                                 CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
</span><span class="cx">                                 A8A473EB151A825B004123FF /* MessageQueue.h in Headers */,
</span><span class="cx">                                 A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWTFwtfOSObjectPtrh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/OSObjectPtr.h (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/OSObjectPtr.h        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WTF/wtf/OSObjectPtr.h        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -1,166 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef OSObjectPtr_h
-#define OSObjectPtr_h
-
-#include &lt;os/object.h&gt;
-#include &lt;wtf/Assertions.h&gt;
-#include &lt;wtf/StdLibExtras.h&gt;
-
-#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 101000
-
-#if __has_include(&lt;os/object_private.h&gt;)
-#include &lt;os/object_private.h&gt;
-#endif
-
-#if OS_OBJECT_USE_OBJC
-@class OS_object;
-typedef OS_object *_os_object_t;
-#else
-typedef struct _os_object_s *_os_object_t;
-#endif
-
-extern &quot;C&quot; _os_object_t _os_object_retain(_os_object_t object);
-extern &quot;C&quot; void _os_object_release(_os_object_t object);
-
-#endif
-
-
-namespace WTF {
-
-template&lt;typename T&gt; class OSObjectPtr;
-template&lt;typename T&gt; OSObjectPtr&lt;T&gt; adoptOSObject(T);
-
-template&lt;typename T&gt;
-static inline void retainOSObject(T ptr)
-{
-#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 || PLATFORM(IOS)
-    os_retain(ptr);
-#else
-#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
-    [ptr retain];
-#else
-    _os_object_retain((_os_object_t)ptr);
-#endif
-#endif
-}
-
-template&lt;typename T&gt;
-static inline void releaseOSObject(T ptr)
-{
-#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 || PLATFORM(IOS)
-    os_release(ptr);
-#else
-#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
-    [ptr release];
-#else
-    _os_object_release((_os_object_t)ptr);
-#endif
-#endif
-}
-
-template&lt;typename T&gt; class OSObjectPtr {
-public:
-    OSObjectPtr()
-        : m_ptr(nullptr)
-    {
-    }
-
-    ~OSObjectPtr()
-    {
-        if (m_ptr)
-            releaseOSObject(m_ptr);
-    }
-
-    T get() const { return m_ptr; }
-
-    explicit operator bool() const { return m_ptr; }
-    bool operator!() const { return !m_ptr; }
-
-    OSObjectPtr(const OSObjectPtr&amp; other)
-        : m_ptr(other.m_ptr)
-    {
-        if (m_ptr)
-            retainOSObject(m_ptr);
-    }
-
-    OSObjectPtr(OSObjectPtr&amp;&amp; other)
-        : m_ptr(other.m_ptr)
-    {
-        other.m_ptr = nullptr;
-    }
-
-    OSObjectPtr&amp; operator=(const OSObjectPtr&amp; other)
-    {
-        OSObjectPtr ptr = other;
-        swap(ptr);
-        return *this;
-    }
-
-    OSObjectPtr&amp; operator=(OSObjectPtr&amp;&amp; other)
-    {
-        OSObjectPtr ptr = WTF::move(other);
-        swap(ptr);
-        return *this;
-    }
-
-    OSObjectPtr&amp; operator=(std::nullptr_t)
-    {
-        if (m_ptr)
-            releaseOSObject(m_ptr);
-        m_ptr = nullptr;
-
-        return *this;
-    }
-
-    void swap(OSObjectPtr&amp; other)
-    {
-        std::swap(m_ptr, other.m_ptr);
-    }
-
-    friend OSObjectPtr adoptOSObject&lt;T&gt;(T);
-
-private:
-    struct AdoptOSObject { };
-    OSObjectPtr(AdoptOSObject, T ptr)
-        : m_ptr(ptr)
-    {
-    }
-
-    T m_ptr;
-};
-
-template&lt;typename T&gt; inline OSObjectPtr&lt;T&gt; adoptOSObject(T ptr)
-{
-    return OSObjectPtr&lt;T&gt;(typename OSObjectPtr&lt;T&gt;::AdoptOSObject { }, ptr);
-}
-
-} // namespace WTF
-
-using WTF::OSObjectPtr;
-using WTF::adoptOSObject;
-
-#endif // OSObjectPtr_h
</del></span></pre></div>
<a id="trunkSourceWTFwtfRetainPtrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/RetainPtr.h (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/RetainPtr.h        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WTF/wtf/RetainPtr.h        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt; class RetainPtr;
</span><span class="cx"> 
</span><ins>+    template&lt;typename T&gt; RetainPtr&lt;T&gt; adoptOS(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</ins><span class="cx">     template&lt;typename T&gt; RetainPtr&lt;T&gt; adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</span><span class="cx">     template&lt;typename T&gt; RetainPtr&lt;T&gt; adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</span><span class="cx"> 
</span><span class="lines">@@ -100,6 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">         void swap(RetainPtr&amp;);
</span><span class="cx"> 
</span><ins>+        template&lt;typename U&gt; friend RetainPtr&lt;U&gt; adoptOS(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</ins><span class="cx">         template&lt;typename U&gt; friend RetainPtr&lt;U&gt; adoptCF(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</span><span class="cx">         template&lt;typename U&gt; friend RetainPtr&lt;U&gt; adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</span><span class="cx"> 
</span><span class="lines">@@ -249,6 +251,11 @@
</span><span class="cx">         return a != b.get(); 
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    template&lt;typename T&gt; inline RetainPtr&lt;T&gt; adoptOS(T CF_RELEASES_ARGUMENT ptr)
+    {
+        return RetainPtr&lt;T&gt;(ptr, RetainPtr&lt;T&gt;::Adopt);
+    }
+
</ins><span class="cx">     template&lt;typename T&gt; inline RetainPtr&lt;T&gt; adoptCF(T CF_RELEASES_ARGUMENT ptr)
</span><span class="cx">     {
</span><span class="cx"> #ifdef __OBJC__
</span><span class="lines">@@ -314,6 +321,7 @@
</span><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::RetainPtr;
</span><ins>+using WTF::adoptOS;
</ins><span class="cx"> using WTF::adoptCF;
</span><span class="cx"> using WTF::adoptNS;
</span><span class="cx"> using WTF::retainPtr;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-09-26  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Replace OSObjectPtr with RetainPtr/adoptOS
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+
+        Reviewed by Dan Bernstein.
+
+        * DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm:
+        (DatabaseServiceInitializer):
+        * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
+        (WebKit::NetworkServiceInitializerDelegate::NetworkServiceInitializerDelegate):
+        (NetworkServiceInitializer):
+        * Platform/IPC/Connection.h:
+        (IPC::Connection::Identifier::Identifier):
+        * Platform/IPC/mac/ConnectionMac.mm:
+        (IPC::ConnectionTerminationWatchdog::createConnectionTerminationWatchdog):
+        (IPC::ConnectionTerminationWatchdog::ConnectionTerminationWatchdog):
+        * PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm:
+        (WebKit::PluginServiceInitializerDelegate::PluginServiceInitializerDelegate):
+        (PluginServiceInitializer):
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
+        (WebKit::XPCServiceInitializerDelegate::XPCServiceInitializerDelegate):
+        (WebKit::XPCServiceInitializer):
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::XPCServiceInitializerDelegate::checkEntitlements):
+        (WebKit::XPCServiceInitializerDelegate::hasEntitlement):
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm:
+        (WebKit::XPCServiceEventHandler):
+        * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
+        (WebKit::XPCServiceEventHandler):
+        * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+        (WebKit::connectToService):
+        (WebKit::connectToReExecService):
+        * WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm:
+        (WebContentServiceInitializer):
+
</ins><span class="cx"> 2014-09-26  Christophe Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Stop using legacy NODE_TYPE_CASTS() macro for HTML Elements
</span></span></pre></div>
<a id="trunkSourceWebKit2DatabaseProcessEntryPointmacXPCServiceDatabaseServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -36,5 +36,5 @@
</span><span class="cx"> 
</span><span class="cx"> void DatabaseServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
</span><span class="cx"> {
</span><del>-    XPCServiceInitializer&lt;DatabaseProcess, XPCServiceInitializerDelegate&gt;(adoptOSObject(connection), initializerMessage);
</del><ins>+    XPCServiceInitializer&lt;DatabaseProcess, XPCServiceInitializerDelegate&gt;(adoptOS(connection), initializerMessage);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessEntryPointmacXPCServiceNetworkServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> class NetworkServiceInitializerDelegate : public XPCServiceInitializerDelegate {
</span><span class="cx"> public:
</span><del>-    NetworkServiceInitializerDelegate(OSObjectPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</del><ins>+    NetworkServiceInitializerDelegate(RetainPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</ins><span class="cx">         : XPCServiceInitializerDelegate(WTF::move(connection), initializerMessage)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -53,6 +53,6 @@
</span><span class="cx">     // the this process don't try to insert the shim and crash.
</span><span class="cx">     EnvironmentUtilities::stripValuesEndingWithString(&quot;DYLD_INSERT_LIBRARIES&quot;, &quot;/SecItemShim.dylib&quot;);
</span><span class="cx"> 
</span><del>-    XPCServiceInitializer&lt;NetworkProcess, NetworkServiceInitializerDelegate&gt;(adoptOSObject(connection), initializerMessage);
</del><ins>+    XPCServiceInitializer&lt;NetworkProcess, NetworkServiceInitializerDelegate&gt;(adoptOS(connection), initializerMessage);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.h        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -42,8 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if OS(DARWIN)
</span><span class="cx"> #include &lt;mach/mach_port.h&gt;
</span><ins>+#include &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #include &lt;xpc/xpc.h&gt;
</span><del>-#include &lt;wtf/OSObjectPtr.h&gt;
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK) || PLATFORM(EFL)
</span><span class="lines">@@ -111,14 +111,14 @@
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        Identifier(mach_port_t port, OSObjectPtr&lt;xpc_connection_t&gt; xpcConnection)
</del><ins>+        Identifier(mach_port_t port, RetainPtr&lt;xpc_connection_t&gt; xpcConnection)
</ins><span class="cx">             : port(port)
</span><span class="cx">             , xpcConnection(WTF::move(xpcConnection))
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         mach_port_t port;
</span><del>-        OSObjectPtr&lt;xpc_connection_t&gt; xpcConnection;
</del><ins>+        RetainPtr&lt;xpc_connection_t&gt; xpcConnection;
</ins><span class="cx">     };
</span><span class="cx">     static bool identifierIsNull(Identifier identifier) { return identifier.port == MACH_PORT_NULL; }
</span><span class="cx">     xpc_connection_t xpcConnection() { return m_xpcConnection.get(); }
</span><span class="lines">@@ -320,7 +320,7 @@
</span><span class="cx">     dispatch_source_t m_exceptionPortDataAvailableSource;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    OSObjectPtr&lt;xpc_connection_t&gt; m_xpcConnection;
</del><ins>+    RetainPtr&lt;xpc_connection_t&gt; m_xpcConnection;
</ins><span class="cx"> 
</span><span class="cx"> #elif USE(UNIX_DOMAIN_SOCKETS)
</span><span class="cx">     // Called on the connection queue.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCmacConnectionMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -75,13 +75,13 @@
</span><span class="cx"> //    to ensure it has a chance to terminate cleanly.
</span><span class="cx"> class ConnectionTerminationWatchdog {
</span><span class="cx"> public:
</span><del>-    static void createConnectionTerminationWatchdog(OSObjectPtr&lt;xpc_connection_t&gt;&amp; xpcConnection, double intervalInSeconds)
</del><ins>+    static void createConnectionTerminationWatchdog(RetainPtr&lt;xpc_connection_t&gt;&amp; xpcConnection, double intervalInSeconds)
</ins><span class="cx">     {
</span><span class="cx">         new ConnectionTerminationWatchdog(xpcConnection, intervalInSeconds);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-    ConnectionTerminationWatchdog(OSObjectPtr&lt;xpc_connection_t&gt;&amp; xpcConnection, double intervalInSeconds)
</del><ins>+    ConnectionTerminationWatchdog(RetainPtr&lt;xpc_connection_t&gt;&amp; xpcConnection, double intervalInSeconds)
</ins><span class="cx">         : m_xpcConnection(xpcConnection)
</span><span class="cx">         , m_watchdogTimer(RunLoop::main(), this, &amp;ConnectionTerminationWatchdog::watchdogTimerFired)
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">         delete this;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    OSObjectPtr&lt;xpc_connection_t&gt; m_xpcConnection;
</del><ins>+    RetainPtr&lt;xpc_connection_t&gt; m_xpcConnection;
</ins><span class="cx">     RunLoop::Timer&lt;ConnectionTerminationWatchdog&gt; m_watchdogTimer;
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     std::unique_ptr&lt;WebKit::ProcessAndUIAssertion&gt; m_assertion;
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessEntryPointmacXPCServicePluginServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #import &quot;PluginProcess.h&quot;
</span><span class="cx"> #import &quot;WKBase.h&quot;
</span><span class="cx"> #import &quot;XPCServiceEntryPoint.h&quot;
</span><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #import &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="lines">@@ -37,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> class PluginServiceInitializerDelegate : public XPCServiceInitializerDelegate {
</span><span class="cx"> public:
</span><del>-    PluginServiceInitializerDelegate(OSObjectPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</del><ins>+    PluginServiceInitializerDelegate(RetainPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</ins><span class="cx">         : XPCServiceInitializerDelegate(WTF::move(connection), initializerMessage)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -76,6 +77,6 @@
</span><span class="cx">     // spawned by the PluginProcess don't try to insert the shim and crash.
</span><span class="cx">     EnvironmentUtilities::stripValuesEndingWithString(&quot;DYLD_INSERT_LIBRARIES&quot;, &quot;/PluginProcessShim.dylib&quot;);
</span><span class="cx"> 
</span><del>-    XPCServiceInitializer&lt;PluginProcess, PluginServiceInitializerDelegate&gt;(adoptOSObject(connection), initializerMessage);
</del><ins>+    XPCServiceInitializer&lt;PluginProcess, PluginServiceInitializerDelegate&gt;(adoptOS(connection), initializerMessage);
</ins><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;ChildProcess.h&quot;
</span><span class="cx"> #import &quot;WebKit2Initialize.h&quot;
</span><del>-#import &lt;wtf/OSObjectPtr.h&gt;
</del><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if HAVE(VOUCHERS)
</span><span class="cx"> #if __has_include(&lt;os/voucher_private.h&gt;)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> 
</span><span class="cx"> class XPCServiceInitializerDelegate {
</span><span class="cx"> public:
</span><del>-    XPCServiceInitializerDelegate(OSObjectPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</del><ins>+    XPCServiceInitializerDelegate(RetainPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</ins><span class="cx">         : m_connection(WTF::move(connection))
</span><span class="cx">         , m_initializerMessage(initializerMessage)
</span><span class="cx">     {
</span><span class="lines">@@ -61,12 +61,12 @@
</span><span class="cx">     bool hasEntitlement(const char* entitlement);
</span><span class="cx">     bool isClientSandboxed();
</span><span class="cx"> 
</span><del>-    OSObjectPtr&lt;xpc_connection_t&gt; m_connection;
</del><ins>+    RetainPtr&lt;xpc_connection_t&gt; m_connection;
</ins><span class="cx">     xpc_object_t m_initializerMessage;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename XPCServiceType, typename XPCServiceInitializerDelegateType&gt;
</span><del>-void XPCServiceInitializer(OSObjectPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</del><ins>+void XPCServiceInitializer(RetainPtr&lt;xpc_connection_t&gt; connection, xpc_object_t initializerMessage)
</ins><span class="cx"> {
</span><span class="cx">     XPCServiceInitializerDelegateType delegate(WTF::move(connection), initializerMessage);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #import &quot;ArgumentCodersCF.h&quot;
</span><span class="cx"> #import &quot;SandboxUtilities.h&quot;
</span><span class="cx"> #import &quot;XPCServiceEntryPoint.h&quot;
</span><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if __has_include(&lt;xpc/private.h&gt;)
</span><span class="cx"> #import &lt;xpc/private.h&gt;
</span><span class="lines">@@ -55,7 +56,7 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), &quot;keychain-access-groups&quot;));
</del><ins>+    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), &quot;keychain-access-groups&quot;));
</ins><span class="cx">     if (value &amp;&amp; xpc_get_type(value.get()) == XPC_TYPE_ARRAY) {
</span><span class="cx">         xpc_array_apply(value.get(), ^bool(size_t index, xpc_object_t object) {
</span><span class="cx">             if (xpc_get_type(object) == XPC_TYPE_STRING &amp;&amp; !strcmp(xpc_string_get_string_ptr(object), &quot;com.apple.identities&quot;)) {
</span><span class="lines">@@ -105,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool XPCServiceInitializerDelegate::hasEntitlement(const char* entitlement)
</span><span class="cx"> {
</span><del>-    auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
</del><ins>+    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
</ins><span class="cx">     if (!value)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainDevelopmentmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #import &lt;spawn.h&gt; 
</span><span class="cx"> #import &lt;stdio.h&gt;
</span><span class="cx"> #import &lt;stdlib.h&gt;
</span><del>-#import &lt;wtf/OSObjectPtr.h&gt;
</del><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #import &lt;xpc/xpc.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">                     exit(EXIT_FAILURE);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                auto reply = adoptOSObject(xpc_dictionary_create_reply(event));
</del><ins>+                auto reply = adoptOS(xpc_dictionary_create_reply(event));
</ins><span class="cx">                 xpc_dictionary_set_string(reply.get(), &quot;message-name&quot;, &quot;process-finished-launching&quot;);
</span><span class="cx">                 xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply.get());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEntryPointUtilitiesmacXPCServiceXPCServiceMainmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &lt;CoreFoundation/CoreFoundation.h&gt;
</span><del>-#import &lt;wtf/OSObjectPtr.h&gt;
</del><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> #import &lt;xpc/xpc.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">                     exit(EXIT_FAILURE);
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                auto reply = adoptOSObject(xpc_dictionary_create_reply(event));
</del><ins>+                auto reply = adoptOS(xpc_dictionary_create_reply(event));
</ins><span class="cx">                 xpc_dictionary_set_string(reply.get(), &quot;message-name&quot;, &quot;process-finished-launching&quot;);
</span><span class="cx">                 xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply.get());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessLaunchermacProcessLauncherMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -202,7 +202,7 @@
</span><span class="cx"> static void connectToService(const ProcessLauncher::LaunchOptions&amp; launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID)
</span><span class="cx"> {
</span><span class="cx">     // Create a connection to the WebKit XPC service.
</span><del>-    auto connection = adoptOSObject(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
</del><ins>+    auto connection = adoptOS(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
</ins><span class="cx">     xpc_connection_set_instance(connection.get(), instanceUUID-&gt;uuid);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="lines">@@ -211,7 +211,7 @@
</span><span class="cx">     // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
</span><span class="cx">     // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
</span><span class="cx">     if (_CFBundleSetupXPCBootstrapPtr()) {
</span><del>-        auto initializationMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
</del><ins>+        auto initializationMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
</ins><span class="cx">         _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get());
</span><span class="cx">         xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
</span><span class="cx">     }
</span><span class="lines">@@ -222,7 +222,7 @@
</span><span class="cx">     xpc_connection_resume(connection.get());
</span><span class="cx">     
</span><span class="cx">     if (shouldLeakBoost(launchOptions)) {
</span><del>-        auto preBootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
</del><ins>+        auto preBootstrapMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
</ins><span class="cx">         xpc_dictionary_set_string(preBootstrapMessage.get(), &quot;message-name&quot;, &quot;pre-bootstrap&quot;);
</span><span class="cx">         xpc_connection_send_message(connection.get(), preBootstrapMessage.get());
</span><span class="cx">     }
</span><span class="lines">@@ -238,7 +238,7 @@
</span><span class="cx">     CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname();
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need.
</span><del>-    auto bootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
</del><ins>+    auto bootstrapMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
</ins><span class="cx">     xpc_dictionary_set_string(bootstrapMessage.get(), &quot;message-name&quot;, &quot;bootstrap&quot;);
</span><span class="cx">     xpc_dictionary_set_string(bootstrapMessage.get(), &quot;framework-executable-path&quot;, [[[NSBundle bundleWithIdentifier:@&quot;com.apple.WebKit&quot;] executablePath] fileSystemRepresentation]);
</span><span class="cx">     xpc_dictionary_set_mach_send(bootstrapMessage.get(), &quot;server-port&quot;, listeningPort);
</span><span class="lines">@@ -250,7 +250,7 @@
</span><span class="cx">         xpc_dictionary_set_fd(bootstrapMessage.get(), &quot;stderr&quot;, STDERR_FILENO);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto extraInitializationData = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
</del><ins>+    auto extraInitializationData = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
</ins><span class="cx"> 
</span><span class="cx">     for (const auto&amp; keyValuePair : launchOptions.extraInitializationData)
</span><span class="cx">         xpc_dictionary_set_string(extraInitializationData.get(), keyValuePair.key.utf8().data(), keyValuePair.value.utf8().data());
</span><span class="lines">@@ -300,7 +300,7 @@
</span><span class="cx">     // FIXME: This UUID should be stored on the ChildProcessProxy.
</span><span class="cx">     RefPtr&lt;UUIDHolder&gt; instanceUUID = UUIDHolder::create();
</span><span class="cx"> 
</span><del>-    // FIXME: It would be nice if we could use OSObjectPtr for this connection as well, but we'd have to be careful
</del><ins>+    // FIXME: It would be nice if we could use RetainPtr for this connection as well, but we'd have to be careful
</ins><span class="cx">     // not to introduce any retain cycles in the call to xpc_connection_set_event_handler below.
</span><span class="cx">     xpc_connection_t reExecConnection = xpc_connection_create(serviceName(launchOptions, true), 0);
</span><span class="cx">     xpc_connection_set_instance(reExecConnection, instanceUUID-&gt;uuid);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessEntryPointmacXPCServiceWebContentServiceEntryPointmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -52,5 +52,5 @@
</span><span class="cx">     InitWebCoreThreadSystemInterface();
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><del>-    XPCServiceInitializer&lt;WebProcess, XPCServiceInitializerDelegate&gt;(adoptOSObject(connection), initializerMessage);
</del><ins>+    XPCServiceInitializer&lt;WebProcess, XPCServiceInitializerDelegate&gt;(adoptOS(connection), initializerMessage);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Tools/ChangeLog        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-09-26  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Replace OSObjectPtr with RetainPtr/adoptOS
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+
+        Reviewed by Dan Bernstein.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp: Removed.
+        * TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp: Copied from Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp.
+        Rename and change test to use RetainPtr. Remove now unneeded part testing WTF::retainOSObject/WTF::releaseOSObject.
+
</ins><span class="cx"> 2014-09-26  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Disable function.arguments
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx">                 7C74D42F188228F300E5ED57 /* StringView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D42D188228F300E5ED57 /* StringView.cpp */; };
</span><span class="cx">                 7C8DDAAB1735DEEE00EA5AC0 /* CloseThenTerminate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */; };
</span><span class="cx">                 7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */; };
</span><del>-                7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */; };
</del><ins>+                7CBBA07819BB8A9100BBF025 /* RetainPtrOSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */; };
</ins><span class="cx">                 7CC3E1FC197E234100BE6252 /* UserContentController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CC3E1FA197E234100BE6252 /* UserContentController.mm */; };
</span><span class="cx">                 7CFBCADF1743234F00B2BFCF /* WillLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */; };
</span><span class="cx">                 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; };
</span><span class="lines">@@ -472,7 +472,7 @@
</span><span class="cx">                 7C74D42D188228F300E5ED57 /* StringView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringView.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseThenTerminate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = attributedStringStrikethrough.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSObjectPtr.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RetainPtrOSObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 7CC3E1FA197E234100BE6252 /* UserContentController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserContentController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -766,7 +766,7 @@
</span><span class="cx">                 7CBBA07519BB8A0900BBF025 /* darwin */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */,
</del><ins>+                                7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = darwin;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -1345,7 +1345,7 @@
</span><span class="cx">                                 1AEF994917A09F5400998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */,
</span><span class="cx">                                 BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */,
</span><span class="cx">                                 BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */,
</span><del>-                                7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */,
</del><ins>+                                7CBBA07819BB8A9100BBF025 /* RetainPtrOSObject.cpp in Sources */,
</ins><span class="cx">                                 C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
</span><span class="cx">                                 CD5393CA1757BAC400C07123 /* SHA1.cpp in Sources */,
</span><span class="cx">                                 14F3B11315E45EAB00210069 /* SaturatedArithmeticOperations.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFdarwinOSObjectPtrcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp (174044 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp        2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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/OSObjectPtr.h&gt;
-
-#include &lt;dispatch/dispatch.h&gt;
-#include &lt;CoreFoundation/CoreFoundation.h&gt;
-
-namespace TestWebKitAPI {
-
-TEST(OSObjectPtr, AdoptOSObject)
-{
-    OSObjectPtr&lt;dispatch_queue_t&gt; foo = adoptOSObject(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL));
-
-    EXPECT_EQ(1, CFGetRetainCount(foo.get()));
-}
-
-TEST(OSObjectPtr, RetainRelease)
-{
-    dispatch_queue_t foo = dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL);
-    EXPECT_EQ(1, CFGetRetainCount(foo));
-
-    WTF::retainOSObject(foo);
-    EXPECT_EQ(2, CFGetRetainCount(foo));
-
-    WTF::releaseOSObject(foo);
-    EXPECT_EQ(1, CFGetRetainCount(foo));
-}
-
-} // namespace TestWebKitAPI
</del></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFdarwinRetainPtrOSObjectcppfromrev174017trunkToolsTestWebKitAPITestsWTFdarwinOSObjectPtrcpp"></a>
<div class="copfile"><h4>Copied: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp (from rev 174017, trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp) (0 => 174045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp        2014-09-28 20:59:28 UTC (rev 174045)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+/*
+ * Copyright (C) 2014 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/RetainPtr.h&gt;
+
+#include &lt;dispatch/dispatch.h&gt;
+#include &lt;CoreFoundation/CoreFoundation.h&gt;
+
+namespace TestWebKitAPI {
+
+TEST(RetainPtrOSObject, AdoptOSObject)
+{
+    RetainPtr&lt;dispatch_queue_t&gt; foo = adoptOS(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL));
+
+    EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>