Title: [275619] trunk/Source
Revision
275619
Author
[email protected]
Date
2021-04-07 12:16:47 -0700 (Wed, 07 Apr 2021)

Log Message

Use os_transaction_create instead of deprecated xpc_transaction_begin/end
https://bugs.webkit.org/show_bug.cgi?id=224288

Patch by Alex Christensen <[email protected]> on 2021-04-07
Reviewed by Tim Horton.

Source/WebKit:

xpc_transaction_begin/end are deprecated with os_transaction_t being the replacement.
The transaction object makes it easier to associate a transaction's begin and end with each other,
and it adds a name, which makes system level debugging of what transactions are happening in which
processes much nicer.

* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
(WebKit::XPCServiceInitializer):
* Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::osTransaction):
(WebKit::XPCServiceExit):

Source/WTF:

* wtf/spi/darwin/XPCSPI.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (275618 => 275619)


--- trunk/Source/WTF/ChangeLog	2021-04-07 19:13:48 UTC (rev 275618)
+++ trunk/Source/WTF/ChangeLog	2021-04-07 19:16:47 UTC (rev 275619)
@@ -1,3 +1,12 @@
+2021-04-07  Alex Christensen  <[email protected]>
+
+        Use os_transaction_create instead of deprecated xpc_transaction_begin/end
+        https://bugs.webkit.org/show_bug.cgi?id=224288
+
+        Reviewed by Tim Horton.
+
+        * wtf/spi/darwin/XPCSPI.h:
+
 2021-04-06  Yusuke Suzuki  <[email protected]>
 
         [JSC] WasmMemory caging should care nullptr

Modified: trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h (275618 => 275619)


--- trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-04-07 19:13:48 UTC (rev 275618)
+++ trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h	2021-04-07 19:16:47 UTC (rev 275619)
@@ -87,12 +87,20 @@
 #endif // PLATFORM(MAC) || USE(APPLE_INTERNAL_SDK)
 
 #if USE(APPLE_INTERNAL_SDK)
+#include <os/transaction_private.h>
 #include <xpc/private.h>
 #else
+
+#if OS_OBJECT_USE_OBJC
+OS_OBJECT_DECL(os_transaction);
+#else
+typedef struct os_transaction_s *os_transaction_t;
+#endif
+
 enum {
     DISPATCH_MACH_SEND_POSSIBLE = 0x8,
 };
-#endif
+#endif // USE(APPLE_INTERNAL_SDK)
 
 #if !defined(XPC_NOESCAPE)
 #define XPC_NOESCAPE
@@ -148,8 +156,7 @@
 xpc_type_t xpc_get_type(xpc_object_t);
 void xpc_main(xpc_connection_handler_t);
 const char* xpc_string_get_string_ptr(xpc_object_t);
-void xpc_transaction_begin(void);
-void xpc_transaction_end(void);
+os_transaction_t os_transaction_create(const char *description);
 void xpc_transaction_exit_clean(void);
 void xpc_track_activity(void);
 

Modified: trunk/Source/WebKit/ChangeLog (275618 => 275619)


--- trunk/Source/WebKit/ChangeLog	2021-04-07 19:13:48 UTC (rev 275618)
+++ trunk/Source/WebKit/ChangeLog	2021-04-07 19:16:47 UTC (rev 275619)
@@ -1,3 +1,21 @@
+2021-04-07  Alex Christensen  <[email protected]>
+
+        Use os_transaction_create instead of deprecated xpc_transaction_begin/end
+        https://bugs.webkit.org/show_bug.cgi?id=224288
+
+        Reviewed by Tim Horton.
+
+        xpc_transaction_begin/end are deprecated with os_transaction_t being the replacement.
+        The transaction object makes it easier to associate a transaction's begin and end with each other,
+        and it adds a name, which makes system level debugging of what transactions are happening in which
+        processes much nicer.
+
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
+        (WebKit::XPCServiceInitializer):
+        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
+        (WebKit::osTransaction):
+        (WebKit::XPCServiceExit):
+
 2021-04-07  Jer Noble  <[email protected]>
 
         [Cocoa] Add WebKitAdditions sources to project

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h (275618 => 275619)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h	2021-04-07 19:13:48 UTC (rev 275618)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h	2021-04-07 19:16:47 UTC (rev 275619)
@@ -80,6 +80,10 @@
     XPCServiceType::singleton().initialize(WTFMove(parameters));
 }
 
+#if PLATFORM(MAC)
+OSObjectPtr<os_transaction_t>& osTransaction();
+#endif
+
 template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
 void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
 {
@@ -96,9 +100,7 @@
     // so ensure that we have an outstanding transaction here. This is not needed on iOS because
     // the UIProcess takes process assertions on behalf of its child processes.
 #if PLATFORM(MAC)
-ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    xpc_transaction_begin();
-ALLOW_DEPRECATED_DECLARATIONS_END
+    osTransaction() = adoptOSObject(os_transaction_create("WebKit XPC Service"));
 #endif
 
     InitializeWebKit2();

Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm (275618 => 275619)


--- trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2021-04-07 19:13:48 UTC (rev 275618)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm	2021-04-07 19:16:47 UTC (rev 275619)
@@ -156,16 +156,21 @@
     return connectedProcessIsSandboxed(m_connection.get());
 }
 
+#if PLATFORM(MAC)
+OSObjectPtr<os_transaction_t>& osTransaction()
+{
+    static NeverDestroyed<OSObjectPtr<os_transaction_t>> transaction;
+    return transaction.get();
+}
+#endif
+
 void XPCServiceExit(OSObjectPtr<xpc_object_t>&& priorityBoostMessage)
 {
     // Make sure to destroy the priority boost message to avoid leaking a transaction.
     priorityBoostMessage = nullptr;
 
-    // Balances the xpc_transaction_begin() in XPCServiceInitializer.
 #if PLATFORM(MAC)
-ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    xpc_transaction_end();
-ALLOW_DEPRECATED_DECLARATIONS_END
+    osTransaction() = nullptr;
 #endif
 
     xpc_transaction_exit_clean();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to