Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5edb8bb8be59ebb9f6b0447aab62c633fa0b22b9
      
https://github.com/WebKit/WebKit/commit/5edb8bb8be59ebb9f6b0447aab62c633fa0b22b9
  Author: Adrian Taylor <[email protected]>
  Date:   2025-12-01 (Mon, 01 Dec 2025)

  Changed paths:
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/Box.h
    M Source/WTF/wtf/CMakeLists.txt
    A Source/WTF/wtf/RefCountable.h

  Log Message:
  -----------
  Introduce WTF::RefCountable
https://bugs.webkit.org/show_bug.cgi?id=303175
rdar://165481024

Reviewed by Geoffrey Garen.

This introduces a new API, WTF::RefCountable, the purpose of which is to attach
a reference count to any type, potentially even move-only types.

This is needed for Swift/C++ interoperability because rdar://162361370
prevents us from passing move-only types from C++ to Swift. We'll need
to do that in the near future for WTF::Function and
WTF::CompletionHandler as we start to handle IPC message reception in
Swift code.

Fortunately, we already had such a type - as an implementation detail
of WTF::Box. Extract it from there to make it a standalone type.
Because this is the existing type, it retains the thread-safe
reference counting semantics.

Alternatives considered:
* Having a ref counted type for each thing we want to pass from C++
  to Swift, e.g. WTF::RefCounted::Function and
  WTF::RefCounted::CompletionHandler. Having a single RefCountable wrapper
  is obviously simpler.
* Naming this type SwiftCell, or similar. This has the advantage that
  it would be more obvious to remove such usages when
  rdar://162361370 is fixed, but it was determined that the
  semantics of this type are not Swift-specific, so it should be
  named something general.
* Naming the type 'Cell' or 'Ref::Cell' or somesuch. This has been
  proposed in various discussions, but the code review process has
  favored 'RefCountable' so that's where we've ended up.

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



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

Reply via email to