# Copyright (C) 2022 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1.  Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
# 2.  Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

webkit_platform_headers: "StreamConnectionEncoder.h"

[WebKitPlatform, AdditionalEncoder=StreamConnectionEncoder] class WTF::URL {
    String string()
}

header: <wtf/text/CString.h>
[CustomHeader, WebKitPlatform, AdditionalEncoder=StreamConnectionEncoder] class WTF::CString {
   std::span<const char> span()
}

[AdditionalEncoder=StreamConnectionEncoder] class WTF::MediaTime {
    int64_t timeValue()
    uint32_t timeScale()
    uint8_t timeFlags()
}

[AdditionalEncoder=StreamConnectionEncoder] class WTF::Seconds {
    double value()
}

[CreateUsing=fromRawSeconds] class WTF::MonotonicTime {
    double secondsSinceEpoch().seconds()
}

[CreateUsing=fromRawSeconds] class WTF::WallTime {
    double secondsSinceEpoch().seconds()
}

header: <wtf/text/AtomString.h>
[CustomHeader, AdditionalEncoder=StreamConnectionEncoder] class WTF::AtomString {
    String string()
}

[WebKitPlatform] class WTF::UUID {
    uint64_t high();
    [Validator='WTF::UUID::isValid(*high, *low)'] uint64_t low();
}

header: <wtf/JSONValues.h>
[RefCounted, CustomHeader, CreateUsing=optionalParseJSON] class WTF::JSONImpl::Value {
    String toJSONString();
}

header: <wtf/ObjectIdentifier.h>
template: class WebKit::WebURLSchemeHandler
template: enum class WebCore::AXIDType
template: struct WebCore::BackgroundFetchRecordIdentifierType
template: struct WebCore::NodeIdentifierType
template: struct WebCore::JSHandleIdentifierType
template: struct WebCore::FetchIdentifierType
template: struct WebCore::ImageDecoderIdentifierType
template: enum class WebCore::ImageOverlayDataDetectionResultIdentifierType
template: enum class WebCore::InbandGenericCueIdentifierType
template: struct WebCore::LayerHostingContextIdentifierType
template: enum class WebCore::MediaSessionGroupIdentifierType
template: enum class WebCore::MediaUniqueIdentifierType
template: struct WebCore::RealtimeMediaSourceIdentifierType
template: enum class WebCore::SWServerToContextConnectionIdentifierType
template: struct WebCore::SharedWorkerIdentifierType
template: struct WebCore::SpeechRecognitionConnectionClientIdentifierType
template: enum class WebCore::TextCheckingRequestIdentifierType
template: enum class WebCore::TextManipulationItemIdentifierType
template: enum class WebCore::TextManipulationTokenIdentifierType
template: struct WebCore::WindowIdentifierType
template: enum class WebCore::WorkletGlobalScopeIdentifierType
template: struct WebKit::AudioMediaStreamTrackRendererInternalUnitIdentifierType
template: struct WebKit::ContentWorldIdentifierType
template: enum class WebKit::ImageAnalysisRequestIdentifierType
template: enum class WebKit::MediaDevicePermissionRequestIdentifierType
template: enum class WebKit::RemoteAudioSessionIdentifierType
template: struct WebKit::RemoteAudioVideoRendererIdentifierType
template: struct WebKit::RemoteCDMIdentifierType
template: struct WebKit::RemoteCDMInstanceIdentifierType
template: struct WebKit::RemoteCDMInstanceSessionIdentifierType
template: struct WebKit::RemoteLegacyCDMIdentifierType
template: struct WebKit::RemoteLegacyCDMSessionIdentifierType
template: enum class WebKit::RemoteMediaSourceIdentifierType
template: enum class WebKit::RemoteSourceBufferIdentifierType
template: struct WebKit::RetrieveRecordResponseBodyCallbackIdentifierType
template: struct WebKit::ShapeDetectionIdentifierType
template: struct WebKit::StorageAreaImplIdentifierType
template: struct WebKit::StorageAreaMapIdentifierType
template: struct WebKit::StorageNamespaceIdentifierType
template: struct WebKit::UserScriptIdentifierType
template: struct WebKit::UserStyleSheetIdentifierType
template: enum class WebKit::VisitedLinkTableIdentifierType
template: enum class WebKit::WCLayerTreeHostIdentifierType
template: enum class WebKit::WebExtensionControllerIdentifierType
template: enum class WebKit::XRDeviceIdentifierType
template: struct WebCore::AttributedStringTextListIDType
#if PLATFORM(COCOA)
template: struct WebCore::AttributedStringTextTableBlockIDType
template: struct WebCore::AttributedStringTextTableIDType
#endif
template: struct WebCore::BackForwardFrameItemIdentifierType
template: struct WebCore::BackForwardItemIdentifierType
template: struct WebCore::DictationContextType
template: struct WebCore::FrameIdentifierType
template: struct WebCore::HTMLMediaElementType
template: struct WebCore::MediaKeySystemRequestIdentifierType
template: struct WebCore::MediaPlayerIdentifierType
template: struct WebCore::MediaPlayerClientIdentifierType
template: struct WebCore::MediaSessionIdentifierType
template: struct WebCore::ModelPlayerIdentifierType
template: struct WebCore::NavigationIdentifierType
template: struct WebCore::PageIdentifierType
template: struct WebCore::PlatformLayerIdentifierType
template: struct WebCore::PlaybackTargetClientContextIdentifierType
template: struct WebCore::PushSubscriptionIdentifierType
template: struct WebCore::ProcessIdentifierType
template: struct WebCore::ScrollingNodeIDType
template: struct WebCore::SharedWorkerObjectIdentifierType
template: struct WebCore::SleepDisablerIdentifierType
#if ENABLE(THREADED_ANIMATIONS)
template: struct WebCore::TimelineIdentifierType
#endif
template: struct WebCore::UserGestureTokenIdentifierType
template: struct WebCore::UserMediaRequestIdentifierType
template: struct WebCore::WebTransportStreamIdentifierType
template: struct WebCore::WebTransportSendGroupIdentifierType
template: struct WebKit::AuthenticationChallengeIdentifierType
template: struct WebKit::DataTaskIdentifierType
template: struct WebKit::DisplayLinkObserverIDType
template: struct WebKit::DrawingAreaIdentifierType
template: struct WebKit::DownloadIDType
template: struct WebKit::GeolocationIdentifierType
template: struct WebKit::ImageBufferSetIdentifierType
template: struct WebKit::IPCConnectionTesterIdentifierType
template: struct WebKit::IPCStreamTesterIdentifierType
template: struct WebKit::JSObjectIDType
template: struct WebKit::MarkSurfacesAsVolatileRequestIdentifierType
template: struct WebKit::MessageBatchIdentifierType
template: struct WebKit::NetworkResourceLoadIdentifierType
template: struct WebKit::PDFPluginIdentifierType
template: struct WebKit::PageGroupIdentifierType
template: struct WebKit::RemoteAudioDestinationIdentifierType
template: struct WebKit::RemoteAudioHardwareListenerIdentifierType
template: struct WebKit::RemoteMediaResourceIdentifierType
template: struct WebKit::RemoteRemoteCommandListenerIdentifierType
template: struct WebKit::RiceBackendIdentifierType
template: struct WebKit::SampleBufferDisplayLayerIdentifierType
template: struct WebKit::ScriptMessageHandlerIdentifierType
template: struct WebKit::TapIdentifierType
template: struct WebKit::TextCheckerRequestType
template: struct WebKit::TransactionIDType
template: struct WebKit::UserContentControllerIdentifierType
template: struct WebKit::WebExtensionContextIdentifierType
template: struct WebKit::WebExtensionFrameIdentifierType
template: struct WebKit::WebExtensionPortChannelIdentifierType
template: struct WebKit::WebExtensionTabIdentifierType
template: struct WebKit::WebExtensionWindowIdentifierType
template: struct WebKit::WebPageProxyIdentifierType
template: struct WebKit::WebURLSchemeHandlerIdentifierType
template: struct WebKit::WebUndoStepIDType
[WebKitPlatform, AdditionalEncoder=StreamConnectionEncoder] class WTF::ObjectIdentifier {
    [Validator='WTF::ObjectIdentifierGenericBase<uint64_t>::isValidIdentifier(*toUInt64)'] uint64_t toUInt64()
}

header: <wtf/ObjectIdentifier.h>
template: class WebCore::ResourceLoader
template: class WebCore::WebSocketChannel
template: enum class IPC::SyncRequestIDType
template: enum class JSC::MicrotaskIdentifierType
template: enum class TestWebKitAPI::TestedObjectIdentifierType
template: enum class WebCore::DOMCacheIdentifierType
template: enum class WebCore::BroadcastChannelIdentifierType
template: struct WebCore::FileSystemWritableFileStreamIdentifierType
template: struct WebCore::IDBDatabaseConnectionIdentifierType
template: struct WebCore::IDBIndexIdentifierType
template: struct WebCore::IDBObjectStoreIdentifierType
template: enum class WebCore::IDBResourceObjectIdentifierType
template: struct WebCore::LibWebRTCSocketIdentifierType
template: enum class WebCore::MainThreadPermissionObserverIdentifierType
template: enum class WebCore::OpaqueOriginIdentifierType
template: enum class WebCore::PortIdentifierType
template: enum class WebCore::RTCDataChannelLocalIdentifierType
template: enum class WebCore::RTCEncodedStreamProducerIdentifierType
template: struct WebCore::RenderingResourceIdentifierType
template: struct WebCore::ResourceLoaderIdentifierType
template: struct WebCore::SamplesRendererTrackIdentifierType
template: struct WebCore::ServiceWorkerIdentifierType
template: struct WebCore::ServiceWorkerJobIdentifierType
template: struct WebCore::ServiceWorkerRegistrationIdentifierType
template: struct WebCore::SnapshotIdentifierType
template: enum class WebCore::WebLockIdentifierType
template: enum class WebCore::WorkerFileSystemStorageConnectionCallbackIdentifierType
template: struct WebKit::GPUProcessConnectionIdentifierType
template: enum class WebKit::LegacyCustomProtocolIDType
template: struct WebKit::LibWebRTCResolverIdentifierType
template: struct WebKit::LogStreamIdentifierType
template: struct WebKit::RemoteGradientIdentifierType
template: struct WebKit::RemoteGraphicsContextIdentifierType
template: struct WebKit::RemoteDisplayListIdentifierType
template: struct WebKit::RemoteDisplayListRecorderIdentifierType
template: struct WebKit::RemoteGraphicsContextGLIdentifierType
template: struct WebKit::RemoteRenderingBackendIdentifierType
template: struct WebKit::RemoteSerializedImageBufferIdentifierType
template: struct WebKit::RemoteSnapshotIdentifierType
template: struct WebKit::RemoteSnapshotRecorderIdentifierType
template: struct WebKit::RemoteVideoFrameIdentifierType
template: struct WebKit::VideoDecoderIdentifierType
template: struct WebKit::VideoEncoderIdentifierType
template: enum class WebKit::WCContentBufferIdentifierType
template: struct IPC::AsyncReplyIDType
template: struct WebCore::FileSystemHandleIdentifierType
template: struct WebCore::FileSystemSyncAccessHandleIdentifierType
template: struct WebCore::WebSocketIdentifierType
template: struct WebKit::DDModelIdentifierType
template: struct WebKit::QuotaIncreaseRequestIdentifierType
template: struct WebKit::StorageAreaIdentifierType
template: struct WebKit::WebGPUIdentifierType
template: struct WebKit::WebTransportSessionIdentifierType
[WebKitPlatform, CustomHeader, AdditionalEncoder=StreamConnectionEncoder] class WTF::AtomicObjectIdentifier {
    [Validator='WTF::ObjectIdentifierGenericBase<uint64_t>::isValidIdentifier(*toUInt64)'] uint64_t toUInt64()
}

#if OS(WINDOWS)
using WTF::ProcessID = int;
#else
using WTF::ProcessID = pid_t;
#endif

header: <wtf/MemoryPressureHandler.h>
[CustomHeader] struct WTF::MemoryPressureHandlerConfiguration {
    uint64_t baseThreshold;
    double conservativeThresholdFraction;
    double strictThresholdFraction;
    std::optional<double> killThresholdFraction;
    Seconds pollInterval;
}

header: <wtf/MemoryPressureHandler.h>
[CustomHeader] enum class WTF::SystemMemoryPressureStatus : uint8_t {
    Normal,
    Warning,
    Critical,
}

header: <wtf/Variant.h>
[AdditionalEncoder=StreamConnectionEncoder, Nested] struct std::monostate {
}

enum class WTFLogLevel : uint8_t {
    Always,
    Error,
    Warning,
    Info,
    Debug
};

using FileSystem::Salt = std::array<uint8_t, 8>;

#if PLATFORM(COCOA)
[CustomEncoder] struct WTF::MachSendRightAnnotated {
    MachSendRight sendRight;
    FixedVector<uint8_t> data;
}
#endif
