Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dd8bdc771fa0fdf8eb174f8cfc886309cd0cf863
      
https://github.com/WebKit/WebKit/commit/dd8bdc771fa0fdf8eb174f8cfc886309cd0cf863
  Author: Adrian Taylor <[email protected]>
  Date:   2026-01-13 (Tue, 13 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
https://bugs.webkit.org/show_bug.cgi?id=304930
rdar://167541410

Reviewed by Richard Robinson.

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.

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



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

Reply via email to