Skip to content

Commit

Permalink
Expose more serialized type metadata to IPC test API
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271422

Reviewed by Sihui Liu.

* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in:
* Source/WebKit/Scripts/webkit/messages.py:
(serialized_identifiers):
(headers_for_type):
* Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp:
(IPC::serializedIdentifiers):
* Source/WebKit/Shared/Cocoa/CoreIPCNSValue.serialization.in:
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.serialization.in:
* Source/WebKit/Shared/ProcessQualified.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemoteProperties.serialization.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm:

Canonical link: https://commits.webkit.org/276639@main
  • Loading branch information
achristensen07 committed Mar 25, 2024
1 parent 0720154 commit a065988
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Source/WebCore/platform/graphics/GraphicsContextGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ enum class GraphicsContextGLSurfaceBuffer : bool {
DisplayBuffer
};

enum class GraphicsContextGLFlipY : bool { No, Yes };

// Base class for graphics context for implementing WebGL rendering model.
class GraphicsContextGL : public RefCounted<GraphicsContextGL> {
public:
Expand Down Expand Up @@ -1045,7 +1047,7 @@ class GraphicsContextGL : public RefCounted<GraphicsContextGL> {
DOMSourceNone,
};

enum class FlipY : bool { No, Yes };
using FlipY = GraphicsContextGLFlipY;

virtual RefPtr<GraphicsLayerContentsDisplayDelegate> layerContentsDisplayDelegate() = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ messages -> RemoteGraphicsContextGL NotRefCounted Stream {
#endif
void EnsureExtensionEnabled(String extension)
void GetErrors() -> (GCGLErrorCodeSet returnValue) Synchronous
void DrawSurfaceBufferToImageBuffer(WebCore::GraphicsContextGL::SurfaceBuffer buffer, WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
void DrawSurfaceBufferToImageBuffer(enum:bool WebCore::GraphicsContextGLSurfaceBuffer buffer, WebCore::RenderingResourceIdentifier imageBuffer) -> () Synchronous
#if ENABLE(MEDIA_STREAM) || ENABLE(WEB_CODECS)
void SurfaceBufferToVideoFrame(WebCore::GraphicsContextGL::SurfaceBuffer buffer) -> (std::optional<WebKit::RemoteVideoFrameProxyProperties> properties) Synchronous
void SurfaceBufferToVideoFrame(enum:bool WebCore::GraphicsContextGLSurfaceBuffer buffer) -> (std::optional<WebKit::RemoteVideoFrameProxyProperties> properties) Synchronous
#endif
#if ENABLE(VIDEO) && PLATFORM(COCOA)
void CopyTextureFromVideoFrame(struct WebKit::SharedVideoFrame frame, uint32_t texture, uint32_t target, int32_t level, uint32_t internalFormat, uint32_t format, uint32_t type, bool premultiplyAlpha, bool flipY) -> (bool success) Synchronous NotStreamEncodable
Expand Down Expand Up @@ -327,7 +327,7 @@ messages -> RemoteGraphicsContextGL NotRefCounted Stream {
void BlitFramebufferANGLE(int32_t srcX0, int32_t srcY0, int32_t srcX1, int32_t srcY1, int32_t dstX0, int32_t dstY0, int32_t dstX1, int32_t dstY1, uint32_t mask, uint32_t filter)
void GetInternalformativ(uint32_t target, uint32_t internalformat, uint32_t pname, size_t paramsSize) -> (std::span<const int32_t> params) Synchronous
void SetDrawingBufferColorSpace(WebCore::DestinationColorSpace arg0)
void DrawingBufferToPixelBuffer(WebCore::GraphicsContextGL::FlipY arg0) -> (RefPtr<WebCore::PixelBuffer> returnValue) Synchronous
void DrawingBufferToPixelBuffer(enum:bool WebCore::GraphicsContextGLFlipY arg0) -> (RefPtr<WebCore::PixelBuffer> returnValue) Synchronous
void DestroyEGLSync(uint64_t arg0)
void ClientWaitEGLSyncWithFlush(uint64_t arg0, uint64_t timeout)
void EnableRequiredWebXRExtensions() -> (bool returnValue) Synchronous
Expand Down
7 changes: 7 additions & 0 deletions Source/WebKit/Scripts/webkit/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def forward_declarations_for_namespace(namespace, kind_and_types):
def serialized_identifiers():
return [
'IPC::AsyncReplyID',
'WebCore::AttributedStringTextListID',
'WebCore::AttributedStringTextTableBlockID',
'WebCore::AttributedStringTextTableID',
'WebCore::BackgroundFetchRecordIdentifier',
Expand All @@ -320,6 +321,7 @@ def serialized_identifiers():
'WebCore::MediaPlayerIdentifier',
'WebCore::MediaSessionIdentifier',
'WebCore::ModelPlayerIdentifier',
'WebCore::MediaUniqueIdentifier',
'WebCore::OpaqueOriginIdentifier',
'WebCore::PageIdentifier',
'WebCore::PlaybackTargetClientContextIdentifier',
Expand All @@ -343,6 +345,7 @@ def serialized_identifiers():
'WebCore::IDBDatabaseConnectionIdentifier',
'WebCore::UserMediaRequestIdentifier',
'WebCore::WebSocketIdentifier',
'WebCore::WindowIdentifier',
'WebKit::AudioMediaStreamTrackRendererInternalUnitIdentifier',
'WebKit::AuthenticationChallengeIdentifier',
'WebKit::ContentWorldIdentifier',
Expand Down Expand Up @@ -786,6 +789,7 @@ def headers_for_type(type):
'WebCore::AlternativeTextType': ['<WebCore/AlternativeTextClient.h>'],
'WebCore::ApplyTrackingPrevention': ['<WebCore/NetworkStorageSession.h>'],
'WebCore::AttachmentAssociatedElementType': ['<WebCore/AttachmentAssociatedElement.h>'],
'WebCore::AttributedStringTextListID': ['<WebCore/AttributedString.h>'],
'WebCore::AttributedStringTextTableID': ['<WebCore/AttributedString.h>'],
'WebCore::AttributedStringTextTableBlockID': ['<WebCore/AttributedString.h>'],
'WebCore::AutocorrectionResponse': ['<WebCore/AlternativeTextClient.h>'],
Expand Down Expand Up @@ -828,6 +832,8 @@ def headers_for_type(type):
'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
'WebCore::GraphicsContextGL::EGLImageSource': ['<WebCore/GraphicsContextGL.h>'],
'WebCore::GraphicsContextGLActiveInfo': ['<WebCore/GraphicsContextGL.h>'],
'WebCore::GraphicsContextGLFlipY': ['<WebCore/GraphicsContextGL.h>'],
'WebCore::GraphicsContextGLSurfaceBuffer': ['<WebCore/GraphicsContextGL.h>'],
'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'],
'WebCore::HighlightRequestOriginatedInApp': ['<WebCore/AppHighlight.h>'],
'WebCore::HighlightVisibility': ['<WebCore/HighlightVisibility.h>'],
Expand Down Expand Up @@ -945,6 +951,7 @@ def headers_for_type(type):
'WebCore::VideoPlaybackQualityMetrics': ['<WebCore/VideoPlaybackQualityMetrics.h>'],
'WebCore::VideoPresetData': ['<WebCore/VideoPreset.h>'],
'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
'WebCore::WindowIdentifier': ['<WebCore/GlobalWindowIdentifier.h>'],
'WebCore::WebGPU::AddressMode': ['<WebCore/WebGPUAddressMode.h>'],
'WebCore::WebGPU::BlendFactor': ['<WebCore/WebGPUBlendFactor.h>'],
'WebCore::WebGPU::BlendOperation': ['<WebCore/WebGPUBlendOperation.h>'],
Expand Down
12 changes: 12 additions & 0 deletions Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
#include <WebCore/FetchIdentifier.h>
#include <WebCore/FileSystemHandleIdentifier.h>
#include <WebCore/FileSystemSyncAccessHandleIdentifier.h>
#include <WebCore/GlobalWindowIdentifier.h>
#include <WebCore/IDBDatabaseConnectionIdentifier.h>
#include <WebCore/ImageDecoderIdentifier.h>
#include <WebCore/InbandGenericCueIdentifier.h>
Expand All @@ -120,6 +121,7 @@
#include <WebCore/MediaKeySystemRequestIdentifier.h>
#include <WebCore/MediaPlayerIdentifier.h>
#include <WebCore/MediaSessionIdentifier.h>
#include <WebCore/MediaUniqueIdentifier.h>
#include <WebCore/ModelPlayerIdentifier.h>
#include <WebCore/PageIdentifier.h>
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Expand Down Expand Up @@ -456,6 +458,9 @@ std::optional<JSC::JSValue> jsValueForReplyArguments(JSC::JSGlobalObject* global
Vector<ASCIILiteral> serializedIdentifiers()
{
static_assert(sizeof(uint64_t) == sizeof(IPC::AsyncReplyID));
#if PLATFORM(COCOA)
static_assert(sizeof(uint64_t) == sizeof(WebCore::AttributedStringTextListID));
#endif
#if PLATFORM(COCOA)
static_assert(sizeof(uint64_t) == sizeof(WebCore::AttributedStringTextTableBlockID));
#endif
Expand All @@ -477,6 +482,7 @@ Vector<ASCIILiteral> serializedIdentifiers()
static_assert(sizeof(uint64_t) == sizeof(WebCore::MediaPlayerIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::MediaSessionIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::ModelPlayerIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::MediaUniqueIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::OpaqueOriginIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::PageIdentifier));
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Expand All @@ -502,6 +508,7 @@ Vector<ASCIILiteral> serializedIdentifiers()
static_assert(sizeof(uint64_t) == sizeof(WebCore::IDBDatabaseConnectionIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::UserMediaRequestIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::WebSocketIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebCore::WindowIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebKit::AudioMediaStreamTrackRendererInternalUnitIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebKit::AuthenticationChallengeIdentifier));
static_assert(sizeof(uint64_t) == sizeof(WebKit::ContentWorldIdentifier));
Expand Down Expand Up @@ -581,6 +588,9 @@ Vector<ASCIILiteral> serializedIdentifiers()
static_assert(sizeof(uint64_t) == sizeof(WebKit::WebURLSchemeHandlerIdentifier));
return {
"IPC::AsyncReplyID"_s,
#if PLATFORM(COCOA)
"WebCore::AttributedStringTextListID"_s,
#endif
#if PLATFORM(COCOA)
"WebCore::AttributedStringTextTableBlockID"_s,
#endif
Expand All @@ -602,6 +612,7 @@ Vector<ASCIILiteral> serializedIdentifiers()
"WebCore::MediaPlayerIdentifier"_s,
"WebCore::MediaSessionIdentifier"_s,
"WebCore::ModelPlayerIdentifier"_s,
"WebCore::MediaUniqueIdentifier"_s,
"WebCore::OpaqueOriginIdentifier"_s,
"WebCore::PageIdentifier"_s,
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Expand All @@ -627,6 +638,7 @@ Vector<ASCIILiteral> serializedIdentifiers()
"WebCore::IDBDatabaseConnectionIdentifier"_s,
"WebCore::UserMediaRequestIdentifier"_s,
"WebCore::WebSocketIdentifier"_s,
"WebCore::WindowIdentifier"_s,
"WebKit::AudioMediaStreamTrackRendererInternalUnitIdentifier"_s,
"WebKit::AuthenticationChallengeIdentifier"_s,
"WebKit::ContentWorldIdentifier"_s,
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/Shared/Cocoa/CoreIPCNSValue.serialization.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ webkit_platform_headers: "CoreIPCNSValue.h" <Foundation/NSRange.h>
NSUInteger location;
NSUInteger length;
}
using NSRange = _NSRange

[WebKitPlatform] class WebKit::CoreIPCNSValue {
WebKit::CoreIPCNSValue::Value m_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ header: <WebCore/ResourceRequest.h>
[Nested] struct WebCore::AttributedString::ParagraphStyleWithTableAndListIDs {
RetainPtr<NSParagraphStyle> style
Vector<std::optional<WebCore::AttributedString::TableBlockAndTableIDPair>> tableBlockAndTableIDs
Vector<WebCore::AttributedString::TextListID> listIDs
Vector<WebCore::AttributedStringTextListID> listIDs
}
using WebCore::AttributedString::TableBlockAndTableIDPair = std::pair<WebCore::AttributedStringTextTableBlockID, WebCore::AttributedStringTextTableID>

Expand Down Expand Up @@ -357,3 +357,14 @@ NSNumber wrapped by CoreIPCNumber
NSString wrapped by CoreIPCString
NSDictionary wrapped by CoreIPCDictionary
NSPresentationIntent wrapped by CoreIPCPresentationIntent

#if PLATFORM(MAC)
using NSColor = PlatformColor
using CGDirectDisplayID = uint32_t
#endif

using CFTimeInterval = double
using CGGlyph = uint16_t
using NSRect = CGRect

using OSStatus = int32_t
9 changes: 8 additions & 1 deletion Source/WebKit/Shared/ProcessQualified.serialization.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ additional_forward_declaration: namespace WebCore { using ScrollingNodeIdentifie
additional_forward_declaration: namespace WebCore { using SharedWorkerObjectIdentifierID = ObjectIdentifier<SharedWorkerObjectIdentifierType>; }
additional_forward_declaration: namespace WebCore { using WebLockIdentifierID = AtomicObjectIdentifier<WebLockIdentifierType>; }


using WebCore::BackForwardItemIdentifierID = ObjectIdentifier<WebCore::BackForwardItemIdentifierType>
using WebCore::DOMCacheIdentifierID = AtomicObjectIdentifier<WebCore::DOMCacheIdentifierType>
using WebCore::FrameIdentifierID = ObjectIdentifier<WebCore::FrameIdentifierType>
using WebCore::OpaqueOriginIdentifier = AtomicObjectIdentifier<WebCore::OpaqueOriginIdentifierType>
using WebCore::PlatformLayerIdentifierID = ObjectIdentifier<WebCore::PlatformLayerIdentifierType>
using WebCore::ScrollingNodeIdentifier = ObjectIdentifier<WebCore::ScrollingNodeIDType>
using WebCore::SharedWorkerObjectIdentifierID = ObjectIdentifier<WebCore::SharedWorkerObjectIdentifierType>
using WebCore::WebLockIdentifierID = AtomicObjectIdentifier<WebCore::WebLockIdentifierType>

header: <WebCore/ProcessQualified.h>
[Alias=class ProcessQualified<BackForwardItemIdentifierID>, AdditionalEncoder=StreamConnectionEncoder, CustomHeader] alias WebCore::BackForwardItemIdentifier {
Expand Down
25 changes: 23 additions & 2 deletions Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,9 @@ enum class WebCore::DiagnosticLoggingDomain : uint8_t {
Media
};

#if !USE(CG)
#if USE(CG)
using WebCore::PlatformColorSpace = RetainPtr<CGColorSpaceRef>;
#else
[Nested] enum class WebCore::PlatformColorSpace::Name : uint8_t {
SRGB
, LinearSRGB
Expand Down Expand Up @@ -2886,6 +2888,8 @@ struct WebCore::GraphicsContextGLAttributes {
WebCore::GraphicsContextGLSimulatedCreationFailure failContextCreationForTesting;
};

enum class WebCore::GraphicsContextGLFlipY : bool

enum class WebCore::GraphicsContextGLSimulatedEventForTesting : uint8_t {
GPUStatusFailure,
Timeout,
Expand Down Expand Up @@ -5688,7 +5692,7 @@ struct WebCore::MediaControlsContextMenuItem {

struct WebCore::WorkerOptions {
WebCore::WorkerType type;
WebCore::FetchRequestCredentials credentials;
WebCore::FetchOptionsCredentials credentials;
String name;
};

Expand Down Expand Up @@ -7964,6 +7968,23 @@ using WebCore::GraphicsContextGL::EGLImageSource = int
#endif

using WebCore::DOMCacheEngine::CacheInfosOrError = Expected<WebCore::DOMCacheEngine::CacheInfos, WebCore::DOMCacheEngine::Error>;
using WebCore::DOMCacheEngine::CacheIdentifierOrError = Expected<WebCore::DOMCacheEngine::CacheIdentifierOperationResult, WebCore::DOMCacheEngine::Error>
using WebCore::DOMCacheEngine::RecordIdentifiersOrError = Expected<Vector<uint64_t>, WebCore::DOMCacheEngine::Error>
using WebCore::DOMCacheEngine::CrossThreadRecordsOrError = Expected<Vector<WebCore::DOMCacheEngine::CrossThreadRecord>, WebCore::DOMCacheEngine::Error>
using WebCore::DOMCacheEngine::RemoveCacheIdentifierOrError = Expected<bool, WebCore::DOMCacheEngine::Error>

using WebCore::MediaPlayerEnums::VideoFullscreenMode = uint32_t
using WebCore::SVGFilterExpression = Vector<WebCore::SVGFilterExpressionTerm>;
using WebCore::SandboxFlags = int
using WebCore::TrackID = uint64_t
using WebCore::EpochTimeStamp = uint64_t
using WebCore::SharedMemory::Handle = WebCore::SharedMemoryHandle
using WebCore::ServiceWorkerOrClientIdentifier = std::variant<WebCore::ServiceWorkerIdentifier, WebCore::ScriptExecutionContextIdentifier>

enum class WebCore::HighlightVisibility : bool

#if OS(WINDOWS)
using ProcessID = int;
#else
using ProcessID = pid_t;
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

struct WebKit::PlatformCAAnimationRemoteProperties {
String keyPath;
WebCore::PlatformCAAnimation::AnimationType animationType;
WebCore::PlatformCAAnimationType animationType;

CFTimeInterval beginTime;
double duration;
Expand Down
2 changes: 1 addition & 1 deletion Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ - (BOOL)sayHelloWasCalled

[typesNeedingDescriptions minusSet:typesHavingDescriptions];
[typesNeedingDescriptions minusSet:fundamentalTypes];
EXPECT_LT(typesNeedingDescriptions.count, 100u); // FIXME: This should eventually be 0.
EXPECT_LT(typesNeedingDescriptions.count, 80u); // FIXME: This should eventually be 0.

for (NSString *type in typesNeedingDescriptions) {
// These are the last two types in the WebKit namespace with non-generated serializers.
Expand Down

0 comments on commit a065988

Please sign in to comment.