Title: [174086] trunk
Revision
174086
Author
commit-qu...@webkit.org
Date
2014-09-29 14:26:06 -0700 (Mon, 29 Sep 2014)

Log Message

Unreviewed, rolling out r174045.
https://bugs.webkit.org/show_bug.cgi?id=137231

Introduced a crash during page loading tests on Mac (Requested
by rniwa on #webkit).

Reverted changeset:

"Replace OSObjectPtr with RetainPtr/adoptOS"
https://bugs.webkit.org/show_bug.cgi?id=137158
http://trac.webkit.org/changeset/174045

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (174085 => 174086)


--- trunk/Source/WTF/ChangeLog	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WTF/ChangeLog	2014-09-29 21:26:06 UTC (rev 174086)
@@ -1,3 +1,17 @@
+2014-09-29  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r174045.
+        https://bugs.webkit.org/show_bug.cgi?id=137231
+
+        Introduced a crash during page loading tests on Mac (Requested
+        by rniwa on #webkit).
+
+        Reverted changeset:
+
+        "Replace OSObjectPtr with RetainPtr/adoptOS"
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+        http://trac.webkit.org/changeset/174045
+
 2014-09-26  Sam Weinig  <s...@webkit.org>
 
         Replace OSObjectPtr with RetainPtr/adoptOS

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (174085 => 174086)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2014-09-29 21:26:06 UTC (rev 174086)
@@ -73,6 +73,7 @@
 		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 */; };
@@ -359,6 +360,7 @@
 		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>"; };
@@ -788,6 +790,7 @@
 				7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */,
 				A8A472D7151A825B004123FF /* OSAllocator.h */,
 				A8A472D8151A825B004123FF /* OSAllocatorPosix.cpp */,
+				7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */,
 				A8A472DA151A825B004123FF /* OSRandomSource.cpp */,
 				A8A472DB151A825B004123FF /* OSRandomSource.h */,
 				1AFDE6521953B23D00C48FFA /* Optional.h */,
@@ -1082,6 +1085,7 @@
 				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 */,

Added: trunk/Source/WTF/wtf/OSObjectPtr.h (0 => 174086)


--- trunk/Source/WTF/wtf/OSObjectPtr.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/OSObjectPtr.h	2014-09-29 21:26:06 UTC (rev 174086)
@@ -0,0 +1,166 @@
+/*
+ * 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 (174085 => 174086)


--- trunk/Source/WTF/wtf/RetainPtr.h	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WTF/wtf/RetainPtr.h	2014-09-29 21:26:06 UTC (rev 174086)
@@ -50,7 +50,6 @@
 
     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;
 
@@ -101,7 +100,6 @@
 
         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;
 
@@ -251,11 +249,6 @@
         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__
@@ -321,7 +314,6 @@
 } // namespace WTF
 
 using WTF::RetainPtr;
-using WTF::adoptOS;
 using WTF::adoptCF;
 using WTF::adoptNS;
 using WTF::retainPtr;

Modified: trunk/Source/WebKit2/ChangeLog (174085 => 174086)


--- trunk/Source/WebKit2/ChangeLog	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/ChangeLog	2014-09-29 21:26:06 UTC (rev 174086)
@@ -1,3 +1,17 @@
+2014-09-29  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r174045.
+        https://bugs.webkit.org/show_bug.cgi?id=137231
+
+        Introduced a crash during page loading tests on Mac (Requested
+        by rniwa on #webkit).
+
+        Reverted changeset:
+
+        "Replace OSObjectPtr with RetainPtr/adoptOS"
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+        http://trac.webkit.org/changeset/174045
+
 2014-09-29  Anders Carlsson  <ander...@apple.com>
 
         Set the TBA versions based on the PLATFORM_NAME

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


--- trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/DatabaseProcess/EntryPoint/mac/XPCService/DatabaseServiceEntryPoint.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -36,5 +36,5 @@
 
 void DatabaseServiceInitializer(xpc_connection_t connection, xpc_object_t initializerMessage)
 {
-    XPCServiceInitializer<DatabaseProcess, XPCServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
+    XPCServiceInitializer<DatabaseProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
 }

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


--- trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -34,7 +34,7 @@
 
 class NetworkServiceInitializerDelegate : public XPCServiceInitializerDelegate {
 public:
-    NetworkServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    NetworkServiceInitializerDelegate(OSObjectPtr<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>(adoptOS(connection), initializerMessage);
+    XPCServiceInitializer<NetworkProcess, NetworkServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
 #endif
 }

Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (174085 => 174086)


--- trunk/Source/WebKit2/Platform/IPC/Connection.h	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h	2014-09-29 21:26:06 UTC (rev 174086)
@@ -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, RetainPtr<xpc_connection_t> xpcConnection)
+        Identifier(mach_port_t port, OSObjectPtr<xpc_connection_t> xpcConnection)
             : port(port)
             , xpcConnection(WTF::move(xpcConnection))
         {
         }
 
         mach_port_t port;
-        RetainPtr<xpc_connection_t> xpcConnection;
+        OSObjectPtr<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
 
-    RetainPtr<xpc_connection_t> m_xpcConnection;
+    OSObjectPtr<xpc_connection_t> m_xpcConnection;
 
 #elif USE(UNIX_DOMAIN_SOCKETS)
     // Called on the connection queue.

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


--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -75,13 +75,13 @@
 //    to ensure it has a chance to terminate cleanly.
 class ConnectionTerminationWatchdog {
 public:
-    static void createConnectionTerminationWatchdog(RetainPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
+    static void createConnectionTerminationWatchdog(OSObjectPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
     {
         new ConnectionTerminationWatchdog(xpcConnection, intervalInSeconds);
     }
     
 private:
-    ConnectionTerminationWatchdog(RetainPtr<xpc_connection_t>& xpcConnection, double intervalInSeconds)
+    ConnectionTerminationWatchdog(OSObjectPtr<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;
     }
 
-    RetainPtr<xpc_connection_t> m_xpcConnection;
+    OSObjectPtr<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 (174085 => 174086)


--- trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/PluginProcess/EntryPoint/mac/XPCService/PluginServiceEntryPoint.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -29,7 +29,6 @@
 #import "PluginProcess.h"
 #import "WKBase.h"
 #import "XPCServiceEntryPoint.h"
-#import <wtf/RetainPtr.h>
 #import <wtf/RunLoop.h>
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
@@ -38,7 +37,7 @@
 
 class PluginServiceInitializerDelegate : public XPCServiceInitializerDelegate {
 public:
-    PluginServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    PluginServiceInitializerDelegate(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
         : XPCServiceInitializerDelegate(WTF::move(connection), initializerMessage)
     {
     }
@@ -77,6 +76,6 @@
     // spawned by the PluginProcess don't try to insert the shim and crash.
     EnvironmentUtilities::stripValuesEndingWithString("DYLD_INSERT_LIBRARIES", "/PluginProcessShim.dylib");
 
-    XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
+    XPCServiceInitializer<PluginProcess, PluginServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 }

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


--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h	2014-09-29 21:26:06 UTC (rev 174086)
@@ -28,7 +28,7 @@
 
 #import "ChildProcess.h"
 #import "WebKit2Initialize.h"
-#import <wtf/RetainPtr.h>
+#import <wtf/OSObjectPtr.h>
 
 #if HAVE(VOUCHERS)
 #if __has_include(<os/voucher_private.h>)
@@ -42,7 +42,7 @@
 
 class XPCServiceInitializerDelegate {
 public:
-    XPCServiceInitializerDelegate(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+    XPCServiceInitializerDelegate(OSObjectPtr<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();
 
-    RetainPtr<xpc_connection_t> m_connection;
+    OSObjectPtr<xpc_connection_t> m_connection;
     xpc_object_t m_initializerMessage;
 };
 
 template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
-void XPCServiceInitializer(RetainPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
+void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage)
 {
     XPCServiceInitializerDelegateType delegate(WTF::move(connection), initializerMessage);
 

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


--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -28,7 +28,6 @@
 #import "ArgumentCodersCF.h"
 #import "SandboxUtilities.h"
 #import "XPCServiceEntryPoint.h"
-#import <wtf/RetainPtr.h>
 
 #if __has_include(<xpc/private.h>)
 #import <xpc/private.h>
@@ -56,7 +55,7 @@
     }
 #endif
 #if PLATFORM(IOS)
-    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), "keychain-access-groups"));
+    auto value = adoptOSObject(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")) {
@@ -106,7 +105,7 @@
 
 bool XPCServiceInitializerDelegate::hasEntitlement(const char* entitlement)
 {
-    auto value = adoptOS(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
+    auto value = adoptOSObject(xpc_connection_copy_entitlement_value(m_connection.get(), entitlement));
     if (!value)
         return false;
 

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


--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.Development.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -31,7 +31,7 @@
 #import <spawn.h> 
 #import <stdio.h>
 #import <stdlib.h>
-#import <wtf/RetainPtr.h>
+#import <wtf/OSObjectPtr.h>
 #import <xpc/xpc.h>
 
 namespace WebKit {
@@ -139,7 +139,7 @@
                     exit(EXIT_FAILURE);
                 }
 
-                auto reply = adoptOS(xpc_dictionary_create_reply(event));
+                auto reply = adoptOSObject(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 (174085 => 174086)


--- trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -26,7 +26,7 @@
 #import "config.h"
 
 #import <CoreFoundation/CoreFoundation.h>
-#import <wtf/RetainPtr.h>
+#import <wtf/OSObjectPtr.h>
 #import <xpc/xpc.h>
 
 namespace WebKit {
@@ -55,7 +55,7 @@
                     exit(EXIT_FAILURE);
                 }
 
-                auto reply = adoptOS(xpc_dictionary_create_reply(event));
+                auto reply = adoptOSObject(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 (174085 => 174086)


--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -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 = adoptOS(xpc_connection_create(serviceName(launchOptions, forDevelopment), 0));
+    auto connection = adoptOSObject(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 = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
+        auto initializationMessage = adoptOSObject(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 = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
+        auto preBootstrapMessage = adoptOSObject(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 = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
+    auto bootstrapMessage = adoptOSObject(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 = adoptOS(xpc_dictionary_create(nullptr, nullptr, 0));
+    auto extraInitializationData = adoptOSObject(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 RetainPtr for this connection as well, but we'd have to be careful
+    // FIXME: It would be nice if we could use OSObjectPtr 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 (174085 => 174086)


--- trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentServiceEntryPoint.mm	2014-09-29 21:26:06 UTC (rev 174086)
@@ -52,5 +52,5 @@
     InitWebCoreThreadSystemInterface();
 #endif // PLATFORM(IOS)
 
-    XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(adoptOS(connection), initializerMessage);
+    XPCServiceInitializer<WebProcess, XPCServiceInitializerDelegate>(adoptOSObject(connection), initializerMessage);
 }

Modified: trunk/Tools/ChangeLog (174085 => 174086)


--- trunk/Tools/ChangeLog	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Tools/ChangeLog	2014-09-29 21:26:06 UTC (rev 174086)
@@ -1,3 +1,17 @@
+2014-09-29  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r174045.
+        https://bugs.webkit.org/show_bug.cgi?id=137231
+
+        Introduced a crash during page loading tests on Mac (Requested
+        by rniwa on #webkit).
+
+        Reverted changeset:
+
+        "Replace OSObjectPtr with RetainPtr/adoptOS"
+        https://bugs.webkit.org/show_bug.cgi?id=137158
+        http://trac.webkit.org/changeset/174045
+
 2014-09-29  Tim Horton  <timothy_hor...@apple.com>
 
         Add Jake as a contributor.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (174085 => 174086)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2014-09-29 21:26:06 UTC (rev 174086)
@@ -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 /* RetainPtrOSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* RetainPtrOSObject.cpp */; };
+		7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBBA07619BB8A9100BBF025 /* OSObjectPtr.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 /* RetainPtrOSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RetainPtrOSObject.cpp; sourceTree = "<group>"; };
+		7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSObjectPtr.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 /* RetainPtrOSObject.cpp */,
+				7CBBA07619BB8A9100BBF025 /* OSObjectPtr.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 /* RetainPtrOSObject.cpp in Sources */,
+				7CBBA07819BB8A9100BBF025 /* OSObjectPtr.cpp in Sources */,
 				C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
 				CD5393CA1757BAC400C07123 /* SHA1.cpp in Sources */,
 				14F3B11315E45EAB00210069 /* SaturatedArithmeticOperations.cpp in Sources */,

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


--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/OSObjectPtr.cpp	2014-09-29 21:26:06 UTC (rev 174086)
@@ -0,0 +1,54 @@
+/*
+ * 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

Deleted: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp (174085 => 174086)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp	2014-09-29 20:54:02 UTC (rev 174085)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/RetainPtrOSObject.cpp	2014-09-29 21:26:06 UTC (rev 174086)
@@ -1,42 +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/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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to