Title: [174045] trunk
Revision
174045
Author
[email protected]
Date
2014-09-28 13:59:28 -0700 (Sun, 28 Sep 2014)

Log Message

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.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (174044 => 174045)


--- 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)
@@ -1,3 +1,20 @@
+2014-09-26  Sam Weinig  <[email protected]>
+
+        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).
+
 2014-09-24  Filip Pizlo  <[email protected]>
 
         FTL should sink object allocations

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (174044 => 174045)


--- 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)
@@ -73,7 +73,6 @@
 		2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
 		2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
 		2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; };
-		7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */; };
 		7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */; };
 		7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF9186D2A54007433CD /* IteratorRange.h */; };
 		7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
@@ -360,7 +359,6 @@
 		5D247B7014689C4700E78B76 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
 		5D247B7314689C4700E78B76 /* WTF.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WTF.xcconfig; sourceTree = "<group>"; };
 		6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyWTFHeaders.xcconfig; sourceTree = "<group>"; };
-		7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSObjectPtr.h; sourceTree = "<group>"; };
 		7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorAdaptors.h; sourceTree = "<group>"; };
 		7CDD7FF9186D2A54007433CD /* IteratorRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorRange.h; sourceTree = "<group>"; };
 		7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjcRuntimeExtras.h; sourceTree = "<group>"; };
@@ -790,7 +788,6 @@
 				7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
 				A8A472D7151A825B004123FF /* OSAllocator.h */,
 				A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */,
-				7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */,
 				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
 				A8A472DB151A825B004123FF /* OSRandomSource.h */,
 				1AFDE6521953B23D00C48FFA /* Optional.h */,
@@ -1085,7 +1082,6 @@
 				A8A473E8151A825B004123FF /* MathExtras.h in Headers */,
 				93B1AA80180E5AF3004A2F05 /* PassRef.h in Headers */,
 				A8A473EA151A825B004123FF /* MD5.h in Headers */,
-				7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */,
 				CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */,
 				A8A473EB151A825B004123FF /* MessageQueue.h in Headers */,
 				A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */,

Deleted: trunk/Source/WTF/wtf/OSObjectPtr.h (174044 => 174045)


--- 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)
@@ -1,166 +0,0 @@
-/*
- * 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 <os/object.h>
-#include <wtf/Assertions.h>
-#include <wtf/StdLibExtras.h>
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
-
-#if __has_include(<os/object_private.h>)
-#include <os/object_private.h>
-#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 "C" _os_object_t _os_object_retain(_os_object_t object);
-extern "C" void _os_object_release(_os_object_t object);
-
-#endif
-
-
-namespace WTF {
-
-template<typename T> class OSObjectPtr;
-template<typename T> OSObjectPtr<T> adoptOSObject(T);
-
-template<typename T>
-static inline void retainOSObject(T ptr)
-{
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 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<typename T>
-static inline void releaseOSObject(T ptr)
-{
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 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<typename T> 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& other)
-        : m_ptr(other.m_ptr)
-    {
-        if (m_ptr)
-            retainOSObject(m_ptr);
-    }
-
-    OSObjectPtr(OSObjectPtr&& other)
-        : m_ptr(other.m_ptr)
-    {
-        other.m_ptr = nullptr;
-    }
-
-    OSObjectPtr& operator=(const OSObjectPtr& other)
-    {
-        OSObjectPtr ptr = other;
-        swap(ptr);
-        return *this;
-    }
-
-    OSObjectPtr& operator=(OSObjectPtr&& other)
-    {
-        OSObjectPtr ptr = WTF::move(other);
-        swap(ptr);
-        return *this;
-    }
-
-    OSObjectPtr& operator=(std::nullptr_t)
-    {
-        if (m_ptr)
-            releaseOSObject(m_ptr);
-        m_ptr = nullptr;
-
-        return *this;
-    }
-
-    void swap(OSObjectPtr& other)
-    {
-        std::swap(m_ptr, other.m_ptr);
-    }
-
-    friend OSObjectPtr adoptOSObject<T>(T);
-
-private:
-    struct AdoptOSObject { };
-    OSObjectPtr(AdoptOSObject, T ptr)
-        : m_ptr(ptr)
-    {
-    }
-
-    T m_ptr;
-};
-
-template<typename T> inline OSObjectPtr<T> adoptOSObject(T ptr)
-{
-    return OSObjectPtr<T>(typename OSObjectPtr<T>::AdoptOSObject { }, ptr);
-}
-
-} // namespace WTF
-
-using WTF::OSObjectPtr;
-using WTF::adoptOSObject;
-
-#endif // OSObjectPtr_h

Modified: trunk/Source/WTF/wtf/RetainPtr.h (174044 => 174045)


--- 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)
@@ -50,6 +50,7 @@
 
     template<typename T> class RetainPtr;
 
+    template<typename T> RetainPtr<T> adoptOS(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
     template<typename T> RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
     template<typename T> RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
 
@@ -100,6 +101,7 @@
 
         void swap(RetainPtr&);
 
+        template<typename U> friend RetainPtr<U> adoptOS(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
         template<typename U> friend RetainPtr<U> adoptCF(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
         template<typename U> friend RetainPtr<U> adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
 
@@ -249,6 +251,11 @@
         return a != b.get(); 
     }
 
+    template<typename T> inline RetainPtr<T> adoptOS(T CF_RELEASES_ARGUMENT ptr)
+    {
+        return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
+    }
+
     template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT ptr)
     {
 #ifdef __OBJC__
@@ -314,6 +321,7 @@
 } // namespace WTF
 
 using WTF::RetainPtr;
+using WTF::adoptOS;
 using WTF::adoptCF;
 using WTF::adoptNS;
 using WTF::retainPtr;

Modified: trunk/Source/WebKit2/ChangeLog (174044 => 174045)


--- 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)
@@ -1,3 +1,39 @@
+2014-09-26  Sam Weinig  <[email protected]>
+
+        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):
+
 2014-09-26  Christophe Dumez  <[email protected]>
 
         Stop using legacy NODE_TYPE_CASTS() macro for HTML Elements

Modified: trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm (174044 => 174045)


--- 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)
@@ -36,5 +36,5 @@
 
 void DatabaseServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
 {
-    XPCServiceInitializer<DatabaseProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+    XPCServiceInitializer<DatabaseProcess, XPCServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
 }

Modified: trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm (174044 => 174045)


--- 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)
@@ -34,7 +34,7 @@
 
 class NetworkServiceInitializerDelegate : public XPCServiceInitializerDelegate {
 public:
-    NetworkServiceInitializerDelegate(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    NetworkServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
         : XPCServiceInitializerDelegate(WTF::move(connection), initializerMessage)
     {
     }
@@ -53,6 +53,6 @@
     // the this process don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/SecItemShim.dylib");
 
-    XPCServiceInitializer<NetworkProcess, NetworkServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+    XPCServiceInitializer<NetworkProcess, NetworkServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
 #endif
 }

Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (174044 => 174045)


--- 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)
@@ -42,8 +42,8 @@
 
 #if OS(DARWIN)
 #include <mach/mach_port.h>
+#include <wtf/RetainPtr.h>
 #include <xpc/xpc.h>
-#include <wtf/OSObjectPtr.h>
 #endif
 
 #if PLATFORM(GTK) || PLATFORM(EFL)
@@ -111,14 +111,14 @@
         {
         }
 
-        Identifier(mach_port_t port, OSObjectPtr<xpc_connection_t> xpcConnection)
+        Identifier(mach_port_t port, RetainPtr<xpc_connection_t> xpcConnection)
             : port(port)
             , xpcConnection(WTF::move(xpcConnection))
         {
         }
 
         mach_port_t port;
-        OSObjectPtr<xpc_connection_t> xpcConnection;
+        RetainPtr<xpc_connection_t> xpcConnection;
     };
     static bool identifierIsNull(Identifier identifier) { return identifier.port == MACH_PORT_NULL; }
     xpc_connection_t xpcConnection() { return m_xpcConnection.get(); }
@@ -320,7 +320,7 @@
     dispatch_source_t m_exceptionPortDataAvailableSource;
 #endif
 
-    OSObjectPtr<xpc_connection_t> m_xpcConnection;
+    RetainPtr<xpc_connection_t> m_xpcConnection;
 
 #elif USE(UNIX_DOMAIN_SOCKETS)
     // Called on the connection queue.

Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (174044 => 174045)


--- 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)
@@ -75,13 +75,13 @@
 //    to ensure it has a chance to terminate cleanly.
 class ConnectionTerminationWatchdog {
 public:
-    static void createConnectionTerminationWatchdog(OSObjectPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
+    static void createConnectionTerminationWatchdog(RetainPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
     {
         new ConnectionTerminationWatchdog(xpcConnection, intervalInSeconds);
     }
     
 private:
-    ConnectionTerminationWatchdog(OSObjectPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
+    ConnectionTerminationWatchdog(RetainPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
         : m_xpcConnection(xpcConnection)
         , m_watchdogTimer(RunLoop::main(), this, &ConnectionTerminationWatchdog::watchdogTimerFired)
 #if PLATFORM(IOS)
@@ -99,7 +99,7 @@
         delete this;
     }
 
-    OSObjectPtr<xpc_connection_t> m_xpcConnection;
+    RetainPtr<xpc_connection_t> m_xpcConnection;
     RunLoop::Timer<ConnectionTerminationWatchdog> m_watchdogTimer;
 #if PLATFORM(IOS)
     std::unique_ptr<WebKit::ProcessAndUIAssertion> m_assertion;

Modified: trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm (174044 => 174045)


--- 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)
@@ -29,6 +29,7 @@
 #import "PluginProcess.h"
 #import "WKBase.h"
 #import "XPCServiceEntryPoint.h"
+#import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
@@ -37,7 +38,7 @@
 
 class PluginServiceInitializerDelegate : public XPCServiceInitializerDelegate {
 public:
-    PluginServiceInitializerDelegate(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    PluginServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
         : XPCServiceInitializerDelegate(WTF::move(connection), initializerMessage)
     {
     }
@@ -76,6 +77,6 @@
     // spawned by the PluginProcess don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
 
-    XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+    XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 }

Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h (174044 => 174045)


--- 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)
@@ -28,7 +28,7 @@
 
 #import "ChildProcess.h"
 #import "WebKit2Initialize.h"
-#import <wtf/OSObjectPtr.h>
+#import <wtf/RetainPtr.h>
 
 #if HAVE(VOUCHERS)
 #if __has_include(<os/voucher_private.h>)
@@ -42,7 +42,7 @@
 
 class XPCServiceInitializerDelegate {
 public:
-    XPCServiceInitializerDelegate(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    XPCServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
         : m_connection(WTF::move(connection))
         , m_initializerMessage(initializerMessage)
     {
@@ -61,12 +61,12 @@
     bool hasEntitlement(const char* entitlement);
     bool isClientSandboxed();
 
-    OSObjectPtr<xpc_connection_t> m_connection;
+    RetainPtr<xpc_connection_t> m_connection;
     xpc_object_t m_initializerMessage;
 };
 
 template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
-void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+void XPCServiceInitializer(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
 {
     XPCServiceInitializerDelegateType delegate(WTF::move(connection), initializerMessage);
 

Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm (174044 => 174045)


--- 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)
@@ -28,6 +28,7 @@
 #import "ArgumentCodersCF.h"
 #import "SandboxUtilities.h"
 #import "XPCServiceEntryPoint.h"
+#import <wtf/RetainPtr.h>
 
 #if __has_include(<xpc/private.h>)
 #import <xpc/private.h>
@@ -55,7 +56,7 @@
     }
 #endif
 #if PLATFORM(IOS)
-    auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), "keychain-access-groups"));
+    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), "keychain-access-groups"));
     if (value && xpc_get_type(value.get()) == XPC_TYPE_ARRAY) {
         xpc_array_apply(value.get(), ^bool(size_t index, xpc_object_t object) {
             if (xpc_get_type(object) == XPC_TYPE_STRING && !strcmp(xpc_string_get_string_ptr(object), "com.apple.identities")) {
@@ -105,7 +106,7 @@
 
 bool XPCServiceInitializerDelegate::hasEntitlement(const char* entitlement)
 {
-    auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
+    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
     if (!value)
         return false;
 

Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm (174044 => 174045)


--- 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)
@@ -31,7 +31,7 @@
 #import <spawn.h> 
 #import <stdio.h>
 #import <stdlib.h>
-#import <wtf/OSObjectPtr.h>
+#import <wtf/RetainPtr.h>
 #import <xpc/xpc.h>
 
 namespace WebKit {
@@ -139,7 +139,7 @@
                     exit(EXIT_FAILURE);
                 }
 
-                auto reply = adoptOSObject(xpc_dictionary_create_reply(event));
+                auto reply = adoptOS(xpc_dictionary_create_reply(event));
                 xpc_dictionary_set_string(reply.get(), "message-name", "process-finished-launching");
                 xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply.get());
 

Modified: trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm (174044 => 174045)


--- 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)
@@ -26,7 +26,7 @@
 #import "config.h"
 
 #import <CoreFoundation/CoreFoundation.h>
-#import <wtf/OSObjectPtr.h>
+#import <wtf/RetainPtr.h>
 #import <xpc/xpc.h>
 
 namespace WebKit {
@@ -55,7 +55,7 @@
                     exit(EXIT_FAILURE);
                 }
 
-                auto reply = adoptOSObject(xpc_dictionary_create_reply(event));
+                auto reply = adoptOS(xpc_dictionary_create_reply(event));
                 xpc_dictionary_set_string(reply.get(), "message-name", "process-finished-launching");
                 xpc_connection_send_message(xpc_dictionary_get_remote_connection(event), reply.get());
 

Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (174044 => 174045)


--- 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)
@@ -202,7 +202,7 @@
 static void connectToService(const ProcessLauncher::LaunchOptions& launchOptions, bool forDevelopment, ProcessLauncher* that, DidFinishLaunchingProcessFunction didFinishLaunchingProcessFunction, UUIDHolder* instanceUUID)
 {
     // Create a connection to the WebKit XPC service.
-    auto connection = adoptOSObject(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
+    auto connection = adoptOS(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
     xpc_connection_set_instance(connection.get(), instanceUUID->uuid);
 
 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@@ -211,7 +211,7 @@
     // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks.
     // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes.
     if (_CFBundleSetupXPCBootstrapPtr()) {
-        auto initializationMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+        auto initializationMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
         _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get());
         xpc_connection_set_bootstrap(connection.get(), initializationMessage.get());
     }
@@ -222,7 +222,7 @@
     xpc_connection_resume(connection.get());
     
     if (shouldLeakBoost(launchOptions)) {
-        auto preBootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+        auto preBootstrapMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
         xpc_dictionary_set_string(preBootstrapMessage.get(), "message-name", "pre-bootstrap");
         xpc_connection_send_message(connection.get(), preBootstrapMessage.get());
     }
@@ -238,7 +238,7 @@
     CString clientIdentifier = bundleIdentifier ? String([[NSBundle mainBundle] bundleIdentifier]).utf8() : *_NSGetProgname();
 
     // FIXME: Switch to xpc_connection_set_bootstrap once it's available everywhere we need.
-    auto bootstrapMessage = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+    auto bootstrapMessage = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
     xpc_dictionary_set_string(bootstrapMessage.get(), "message-name", "bootstrap");
     xpc_dictionary_set_string(bootstrapMessage.get(), "framework-executable-path", [[[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] executablePath] fileSystemRepresentation]);
     xpc_dictionary_set_mach_send(bootstrapMessage.get(), "server-port", listeningPort);
@@ -250,7 +250,7 @@
         xpc_dictionary_set_fd(bootstrapMessage.get(), "stderr", STDERR_FILENO);
     }
 
-    auto extraInitializationData = adoptOSObject(xpc_dictionary_create(nullptr, nullptr, 0));
+    auto extraInitializationData = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
 
     for (const auto& keyValuePair : launchOptions.extraInitializationData)
         xpc_dictionary_set_string(extraInitializationData.get(), keyValuePair.key.utf8().data(), keyValuePair.value.utf8().data());
@@ -300,7 +300,7 @@
     // FIXME: This UUID should be stored on the ChildProcessProxy.
     RefPtr<UUIDHolder> instanceUUID = UUIDHolder::create();
 
-    // FIXME: It would be nice if we could use OSObjectPtr for this connection as well, but we'd have to be careful
+    // FIXME: It would be nice if we could use RetainPtr for this connection as well, but we'd have to be careful
     // not to introduce any retain cycles in the call to xpc_connection_set_event_handler below.
     xpc_connection_t reExecConnection = xpc_connection_create(serviceName(launchOptions, true), 0);
     xpc_connection_set_instance(reExecConnection, instanceUUID->uuid);

Modified: trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm (174044 => 174045)


--- 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)
@@ -52,5 +52,5 @@
     InitWebCoreThreadSystemInterface();
 #endif // PLATFORM(IOS)
 
-    XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
+    XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
 }

Modified: trunk/Tools/ChangeLog (174044 => 174045)


--- trunk/Tools/ChangeLog	2014-09-28 08:23:11 UTC (rev 174044)
+++ trunk/Tools/ChangeLog	2014-09-28 20:59:28 UTC (rev 174045)
@@ -1,3 +1,15 @@
+2014-09-26  Sam Weinig  <[email protected]>
+
+        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.
+
 2014-09-26  Filip Pizlo  <[email protected]>
 
         Disable function.arguments

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (174044 => 174045)


--- 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)
@@ -123,7 +123,7 @@
 		7C74D42F188228F300E5ED57 /* StringView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C74D42D188228F300E5ED57 /* StringView.cpp */; };
 		7C8DDAAB1735DEEE00EA5AC0 /* CloseThenTerminate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */; };
 		7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */; };
-		7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */; };
+		7CBBA07819BB8A9100BBF025 /* RetainPtrOSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */; };
 		7CC3E1FC197E234100BE6252 /* UserContentController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CC3E1FA197E234100BE6252 /* UserContentController.mm */; };
 		7CFBCADF1743234F00B2BFCF /* WillLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */; };
 		7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; };
@@ -472,7 +472,7 @@
 		7C74D42D188228F300E5ED57 /* StringView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringView.cpp; sourceTree = "<group>"; };
 		7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseThenTerminate.cpp; sourceTree = "<group>"; };
 		7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = attributedStringStrikethrough.html; sourceTree = "<group>"; };
-		7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSObjectPtr.cpp; sourceTree = "<group>"; };
+		7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RetainPtrOSObject.cpp; sourceTree = "<group>"; };
 		7CC3E1FA197E234100BE6252 /* UserContentController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserContentController.mm; sourceTree = "<group>"; };
 		7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad.cpp; sourceTree = "<group>"; };
 		7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = "<group>"; };
@@ -766,7 +766,7 @@
 		7CBBA07519BB8A0900BBF025 /* darwin */ = {
 			isa = PBXGroup;
 			children = (
-				7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */,
+				7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */,
 			);
 			path = darwin;
 			sourceTree = "<group>";
@@ -1345,7 +1345,7 @@
 				1AEF994917A09F5400998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */,
 				BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */,
 				BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */,
-				7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */,
+				7CBBA07819BB8A9100BBF025 /* RetainPtrOSObject.cpp in Sources */,
 				C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
 				CD5393CA1757BAC400C07123 /* SHA1.cpp in Sources */,
 				14F3B11315E45EAB00210069 /* SaturatedArithmeticOperations.cpp in Sources */,

Deleted: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp (174044 => 174045)


--- 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)
@@ -1,54 +0,0 @@
-/*
- * 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 "config.h"
-
-#include <wtf/OSObjectPtr.h>
-
-#include <dispatch/dispatch.h>
-#include <CoreFoundation/CoreFoundation.h>
-
-namespace TestWebKitAPI {
-
-TEST(OSObjectPtr, AdoptOSObject)
-{
-    OSObjectPtr<dispatch_queue_t> 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

Copied: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp (from rev 174017, trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp) (0 => 174045)


--- 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)
@@ -0,0 +1,42 @@
+/*
+ * 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 "config.h"
+
+#include <wtf/RetainPtr.h>
+
+#include <dispatch/dispatch.h>
+#include <CoreFoundation/CoreFoundation.h>
+
+namespace TestWebKitAPI {
+
+TEST(RetainPtrOSObject, AdoptOSObject)
+{
+    RetainPtr<dispatch_queue_t> foo = adoptOS(dispatch_queue_create(0, DISPATCH_QUEUE_SERIAL));
+
+    EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+}
+
+} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to