Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b1d62e3436dc0522b3d148bbc41a69314ed7026
      
https://github.com/WebKit/WebKit/commit/5b1d62e3436dc0522b3d148bbc41a69314ed7026
  Author: Adrian Taylor <[email protected]>
  Date:   2026-01-14 (Wed, 14 Jan 2026)

  Changed paths:
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources-output.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Modules/Internal/WebKitInternalCxx.h
    M Source/WebKit/Scripts/generate-message-receiver.py
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Scripts/webkit/messages_unittest.py
    M Source/WebKit/Scripts/webkit/model.py
    M Source/WebKit/Scripts/webkit/parser.py
    M Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp
    M Source/WebKit/Scripts/webkit/tests/MessageNames.cpp
    M Source/WebKit/Scripts/webkit/tests/MessageNames.h
    A Source/WebKit/Scripts/webkit/tests/TestWithSwiftConditionally.messages.in
    A 
Source/WebKit/Scripts/webkit/tests/TestWithSwiftConditionallyMessageReceiver.cpp
    A 
Source/WebKit/Scripts/webkit/tests/TestWithSwiftConditionallyMessageReceiver.swift
    A Source/WebKit/Scripts/webkit/tests/TestWithSwiftConditionallyMessages.h
    M Source/WebKit/Scripts/webkit/tests/TestWithSwiftMessageReceiver.cpp
    M Source/WebKit/Shared/IPCTester.cpp
    M Source/WebKit/Shared/IPCTesterReceiver.cpp
    M Source/WebKit/Shared/IPCTesterReceiver.h
    M Source/WebKit/Shared/IPCTesterReceiver.messages.in
    A Source/WebKit/Shared/IPCTesterReceiver.swift
    R Source/WebKit/Shared/IPCTesterReceiverSwift.messages.in
    R Source/WebKit/Shared/IPCTesterReceiverSwift.swift
    M Source/WebKit/Shared/WebKit-Swift.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp

  Log Message:
  -----------
  Add SwiftReceiverBuildEnabledBy (reland)
https://bugs.webkit.org/show_bug.cgi?id=304930
rdar://167541410

Reviewed by Anne van Kesteren.

Until now, our autogenerated CoreIPC code has been able to call into either C++
or Swift message handlers, chosen using an attribute in the messages.in file
called 'SwiftReceiver'. (The calling conventions are slightly different due to
limitations in Swift/C++ interop and the general nature of the Swift language).

However, for upcoming features such as the Swift BackForwardList, we intend
temporarily to have both C++ and Swift implementations in-tree, chosen using
a build-time option. The 'SwiftReceiver' attribute in the messages.in file
therefore needs to be conditional.

However, the code which interprets the messages.in file does not really use
the preprocessor (it just looks like it). It's not currently possible to
apply an #ifdef around an attribute in the messages.in file.

This PR adds an alternative attribute, 'SwiftReceiverBuildEnabledBy', which
allows what we want. Everywhere that there's a difference between Swift
and C++ calling conventions, these will now be guarded by an
ifdef / else / endif section within the generated C++ code.

The functional part of this PR is really just in messages.py, model.py
and parser.py. All the rest is test code. Specifically, this fits in
with the existing split in the way the IPC message handling is tested:

* We add a new TestWithSwiftConditionally.messages.in test, and include
  the expected output of the code generator. This generated code is not
  compiled, but tests confirm that the output is as expected.
* We modify the existing (actually compiled) IPCTesterReceiver code.
  This previously included two separate IPC message handlers - one for
  Swift, one for C++. We now can remove all the extra code which
  was added for the Swift message handler, and just selectively use
  Swift or C++. This is therefore a simplification in the test code.

This is s reland with no changes. The commit was reverted because it
was assumed to be responsible for a build failure rdar://168117540,
but actually that was entirely caused by

https://github.com/WebKit/WebKit/pull/55647
Canonical link: https://commits.webkit.org/305567@main



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

Reply via email to