[webkit-changes] [WebKit/WebKit] 749c58: MachSendRight calls to kernel redundantly when cre...

Kimmo Kinnunen noreply at github.com
Mon Nov 13 01:49:36 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 749c5825ae30264ca8d772a5f7c48af273b53227
      https://github.com/WebKit/WebKit/commit/749c5825ae30264ca8d772a5f7c48af273b53227
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-11-13 (Mon, 13 Nov 2023)

  Changed paths:
    M Source/WTF/wtf/MachSendRight.h
    M Source/WTF/wtf/cocoa/MachSendRight.cpp
    M Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
    M Source/WebKit/Platform/IPC/darwin/IPCEventDarwin.cpp
    M Tools/TestWebKitAPI/Tests/WTF/darwin/MachSendRight.cpp

  Log Message:
  -----------
  MachSendRight calls to kernel redundantly when creating a send right and destroying moved-from instance
https://bugs.webkit.org/show_bug.cgi?id=264486
rdar://118177694

Reviewed by Matt Woodrow.

Avoid mach_port_get_refs in case the send right is created from a
receive right, as the succeeding MAKE_SEND guarantees the send right
existing.

Avoid mach_port_destroy in case the port is MACH_PORT_NULL, e.g.
mostly when the send right has been moved from.

* Source/WTF/wtf/MachSendRight.h:
* Source/WTF/wtf/cocoa/MachSendRight.cpp:
(WTF::deallocateSendRightSafely):
(WTF::MachSendRight::create):
(WTF::MachSendRight::createFromReceiveRight):
(WTF::MachSendRight::~MachSendRight):
(WTF::MachSendRight::operator=):
(WTF::releaseSendRight): Deleted.
* Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::platformOpen):
(IPC::Connection::createConnectionIdentifierPair):
* Source/WebKit/Platform/IPC/darwin/IPCEventDarwin.cpp:
(IPC::createEventSignalPair):

Canonical link: https://commits.webkit.org/270628@main




More information about the webkit-changes mailing list