Changeset 275619 in webkit


Ignore:
Timestamp:
Apr 7, 2021 12:16:47 PM (3 years ago)
Author:
commit-queue@webkit.org
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 <achristensen@webkit.org> 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:
Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r275597 r275619  
     12021-04-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Use os_transaction_create instead of deprecated xpc_transaction_begin/end
     4        https://bugs.webkit.org/show_bug.cgi?id=224288
     5
     6        Reviewed by Tim Horton.
     7
     8        * wtf/spi/darwin/XPCSPI.h:
     9
    1102021-04-06  Yusuke Suzuki  <ysuzuki@apple.com>
    211
  • trunk/Source/WTF/wtf/spi/darwin/XPCSPI.h

    r275172 r275619  
    8888
    8989#if USE(APPLE_INTERNAL_SDK)
     90#include <os/transaction_private.h>
    9091#include <xpc/private.h>
    9192#else
     93
     94#if OS_OBJECT_USE_OBJC
     95OS_OBJECT_DECL(os_transaction);
     96#else
     97typedef struct os_transaction_s *os_transaction_t;
     98#endif
     99
    92100enum {
    93101    DISPATCH_MACH_SEND_POSSIBLE = 0x8,
    94102};
    95 #endif
     103#endif // USE(APPLE_INTERNAL_SDK)
    96104
    97105#if !defined(XPC_NOESCAPE)
     
    149157void xpc_main(xpc_connection_handler_t);
    150158const char* xpc_string_get_string_ptr(xpc_object_t);
    151 void xpc_transaction_begin(void);
    152 void xpc_transaction_end(void);
     159os_transaction_t os_transaction_create(const char *description);
    153160void xpc_transaction_exit_clean(void);
    154161void xpc_track_activity(void);
  • trunk/Source/WebKit/ChangeLog

    r275614 r275619  
     12021-04-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        Use os_transaction_create instead of deprecated xpc_transaction_begin/end
     4        https://bugs.webkit.org/show_bug.cgi?id=224288
     5
     6        Reviewed by Tim Horton.
     7
     8        xpc_transaction_begin/end are deprecated with os_transaction_t being the replacement.
     9        The transaction object makes it easier to associate a transaction's begin and end with each other,
     10        and it adds a name, which makes system level debugging of what transactions are happening in which
     11        processes much nicer.
     12
     13        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
     14        (WebKit::XPCServiceInitializer):
     15        * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
     16        (WebKit::osTransaction):
     17        (WebKit::XPCServiceExit):
     18
    1192021-04-07  Jer Noble  <jer.noble@apple.com>
    220
  • trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h

    r275013 r275619  
    8181}
    8282
     83#if PLATFORM(MAC)
     84OSObjectPtr<os_transaction_t>& osTransaction();
     85#endif
     86
    8387template<typename XPCServiceType, typename XPCServiceInitializerDelegateType>
    8488void XPCServiceInitializer(OSObjectPtr<xpc_connection_t> connection, xpc_object_t initializerMessage, xpc_object_t priorityBoostMessage)
     
    97101    // the UIProcess takes process assertions on behalf of its child processes.
    98102#if PLATFORM(MAC)
    99 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    100     xpc_transaction_begin();
    101 ALLOW_DEPRECATED_DECLARATIONS_END
     103    osTransaction() = adoptOSObject(os_transaction_create("WebKit XPC Service"));
    102104#endif
    103105
  • trunk/Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm

    r275268 r275619  
    157157}
    158158
     159#if PLATFORM(MAC)
     160OSObjectPtr<os_transaction_t>& osTransaction()
     161{
     162    static NeverDestroyed<OSObjectPtr<os_transaction_t>> transaction;
     163    return transaction.get();
     164}
     165#endif
     166
    159167void XPCServiceExit(OSObjectPtr<xpc_object_t>&& priorityBoostMessage)
    160168{
     
    162170    priorityBoostMessage = nullptr;
    163171
    164     // Balances the xpc_transaction_begin() in XPCServiceInitializer.
    165172#if PLATFORM(MAC)
    166 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    167     xpc_transaction_end();
    168 ALLOW_DEPRECATED_DECLARATIONS_END
     173    osTransaction() = nullptr;
    169174#endif
    170175
Note: See TracChangeset for help on using the changeset viewer.