[webkit-changes] [WebKit/WebKit] e88f01: Introducing C++ Swift Interop

Commit Queue noreply at github.com
Mon Mar 25 14:08:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e88f01ab1a57ebb1b114ee93abd0867a6ec0cac8
      https://github.com/WebKit/WebKit/commit/e88f01ab1a57ebb1b114ee93abd0867a6ec0cac8
  Author: nmahendru <nitinmahendru at apple.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WTF/wtf/spi/darwin/AbortWithReasonSPI.h
    M Source/WebCore/PAL/Configurations/PAL.xcconfig
    M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
    A Source/WebCore/PAL/pal/PALSwift.h
    M Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift
    A Source/WebCore/PAL/pal/PALSwift/UnsafeOverlays.swift
    A Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
    R Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.mm
    A Source/WebCore/PAL/pal/module.modulemap
    M Source/WebCore/SourcesCocoa.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.cpp
    R Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm
    A Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.cpp
    R Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm
    M Source/WebCore/crypto/cocoa/CryptoUtilitiesCocoa.cpp
    M Tools/Scripts/swift/.swift-format

  Log Message:
  -----------
  Introducing C++ Swift Interop
https://bugs.webkit.org/show_bug.cgi?id=271263
rdar://123331949

Reviewed by Alex Christensen, Geoffrey Garen and Elliott Williams.

This is an examplar of the C++ Swift interop feature.
We have randomly chosen the Digest Implementation to be the first one to adopt this.
The Compiler feature is only available for newer platforms to code has been guarded
with ifdefs.

The changes in AbortWithReasonSPI.h are to allow the Swift Generator to work.
It, at the moment cannot handle headers included inside `extern C` blocks.

Input parameteres to Swift have been intentionally chosen as spans as
swift, at the moment my make copies of inputs for safety guarantees.
Copying a span is cheap so that is Okie.
On the return path, Swift calls the WTF::Vector move constructor(confirmed in debugger).

* Source/WTF/wtf/PlatformHave.h:
* Source/WTF/wtf/spi/darwin/AbortWithReasonSPI.h:
* Source/WebCore/Configurations/WebCore.xcconfig:
* Source/WebCore/PAL/Configurations/PAL.xcconfig:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift:
(AesGcm.test(_:)):
(AesKwRV.errCode):
(AesKwRV.outputSize):
(HashFunction.update(_:)):
(Digest.sha1(_:)):
(Digest.sha256(_:)):
(Digest.sha384(_:)):
(Digest.sha512(_:)):
(AesKwReturnValue.errCode): Deleted.
(AesKwReturnValue.outputSize): Deleted.
* Source/WebCore/PAL/pal/PALSwift/UnsafeOverlays.swift: Added.
(HashFunction.update(_:)):
* Source/WebCore/PAL/pal/PALSwiftModule.h: Copied from Source/WTF/wtf/spi/darwin/AbortWithReasonSPI.h.
* Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp: Renamed from Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.mm.
(PAL::CryptoDigest::computeHash):
* Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:
(PAL::createCryptoDigest):
(PAL::CryptoDigest::computeHash):
* Source/WebCore/PAL/pal/module.modulemap: Added.
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::dispatchDigest):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.cpp: Renamed from Source/WebCore/crypto/cocoa/CryptoAlgorithmAESGCMMac.mm.
(WebCore::encryptCryptoKitAESGCM):
(WebCore::CryptoAlgorithmAESGCM::platformEncrypt):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.cpp: Renamed from Source/WebCore/crypto/cocoa/CryptoAlgorithmAESKWMac.mm.
(WebCore::wrapKeyAESKWCryptoKit):
(WebCore::unwrapKeyAESKWCryptoKit):
* Source/WebCore/crypto/cocoa/CryptoUtilitiesCocoa.cpp:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list