[webkit-changes] [WebKit/WebKit] 29b333: Introducing Swift C++ Interop in WebKit

Commit Queue noreply at github.com
Wed Mar 27 20:20:27 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 29b3336cfd7aa527604d5e5087331bfc7d4306e5
      https://github.com/WebKit/WebKit/commit/29b3336cfd7aa527604d5e5087331bfc7d4306e5
  Author: Nitin Mahendru <nitinmahendru at apple.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WTF/wtf/spi/darwin/AbortWithReasonSPI.h
    M Source/WebCore/Configurations/WebCore.xcconfig
    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 Swift C++ Interop in WebKit
https://bugs.webkit.org/show_bug.cgi?id=271263
rdar://123331949

Reviewed by Elliott Williams.

This fixes the build failures introduced by 276651 at main.
(That commit was reverted in 276659 at main.)

The CryptoKit Changes are still hidden behind a feature flag
`CryptoKitEnabled`.

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:

Originally-landed-as: 276651 at main (e88f01ab1a57). rdar://123331949
Canonical link: https://commits.webkit.org/276767@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