From 7fad8c333d14d84e7fba1c2ae4de40baa6875a04 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Thu, 17 Jul 2025 13:40:50 -0400 Subject: [PATCH] LibWeb: Use forward-declarations of structured serialized types This reduces the rebuilt targets when touching StructuredSerialize.h from ~1200 to ~400. The remaining are due to generated IPC headers. --- Libraries/LibWeb/Bindings/Transferable.h | 1 - Libraries/LibWeb/DOM/Document.cpp | 1 + Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp | 1 + Libraries/LibWeb/Fetch/Infrastructure/FetchController.h | 2 +- Libraries/LibWeb/Forward.h | 2 ++ Libraries/LibWeb/HTML/BroadcastChannel.cpp | 1 + Libraries/LibWeb/HTML/MessagePort.cpp | 5 +++-- Libraries/LibWeb/HTML/MessagePort.h | 2 +- Libraries/LibWeb/HTML/Navigable.h | 2 +- Libraries/LibWeb/HTML/Navigation.cpp | 1 + Libraries/LibWeb/HTML/Navigation.h | 2 +- Libraries/LibWeb/HTML/NavigationDestination.cpp | 1 + Libraries/LibWeb/HTML/NavigationDestination.h | 2 +- Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp | 1 + Libraries/LibWeb/HTML/SessionHistoryEntry.cpp | 1 + Libraries/LibWeb/HTML/SessionHistoryEntry.h | 2 +- Libraries/LibWeb/HTML/TraversableNavigable.cpp | 1 + Libraries/LibWeb/HTML/Window.cpp | 1 + Libraries/LibWeb/Streams/ReadableStream.cpp | 1 + Libraries/LibWeb/Streams/TransformStream.cpp | 1 + Libraries/LibWeb/Streams/WritableStream.cpp | 1 + 21 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Libraries/LibWeb/Bindings/Transferable.h b/Libraries/LibWeb/Bindings/Transferable.h index 08ad1a8e651..8fb2e61362f 100644 --- a/Libraries/LibWeb/Bindings/Transferable.h +++ b/Libraries/LibWeb/Bindings/Transferable.h @@ -8,7 +8,6 @@ #include #include -#include #include namespace Web::Bindings { diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 9da36824388..1a7524d1d4a 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -138,6 +138,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp index 5b3622ce9fb..21ea68043d5 100644 --- a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp +++ b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace Web::Fetch::Infrastructure { diff --git a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h index 20e39ba80eb..80680098965 100644 --- a/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h +++ b/Libraries/LibWeb/Fetch/Infrastructure/FetchController.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include namespace Web::Fetch::Infrastructure { diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index ca33f5d6b5e..dee807f9d03 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -694,6 +694,7 @@ enum class MediaSeekMode; enum class SandboxingFlagSet; struct Agent; +struct DeserializedTransferRecord; struct EmbedderPolicy; struct Environment; struct EnvironmentSettingsObject; @@ -706,6 +707,7 @@ struct ScrollOptions; struct ScrollToOptions; struct SerializedFormData; struct SerializedPolicyContainer; +struct SerializedTransferRecord; struct StructuredSerializeOptions; struct SyntheticRealmSettings; struct ToggleTaskTracker; diff --git a/Libraries/LibWeb/HTML/BroadcastChannel.cpp b/Libraries/LibWeb/HTML/BroadcastChannel.cpp index ba8edca4b8f..3f79492ceaf 100644 --- a/Libraries/LibWeb/HTML/BroadcastChannel.cpp +++ b/Libraries/LibWeb/HTML/BroadcastChannel.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/HTML/MessagePort.cpp b/Libraries/LibWeb/HTML/MessagePort.cpp index cce0cc7e0ed..59a5ea7769d 100644 --- a/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Libraries/LibWeb/HTML/MessagePort.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -273,7 +274,7 @@ WebIDL::ExceptionOr MessagePort::message_port_post_message_steps(GC::Ptr MessagePort::send_message_on_transport(SerializedTransferRecord co return {}; } -void MessagePort::post_port_message(SerializedTransferRecord serialize_with_transfer_result) +void MessagePort::post_port_message(SerializedTransferRecord const& serialize_with_transfer_result) { if (!m_transport || !m_transport->is_open()) return; diff --git a/Libraries/LibWeb/HTML/MessagePort.h b/Libraries/LibWeb/HTML/MessagePort.h index 321da8a1551..7e903dd3f30 100644 --- a/Libraries/LibWeb/HTML/MessagePort.h +++ b/Libraries/LibWeb/HTML/MessagePort.h @@ -77,7 +77,7 @@ private: bool is_entangled() const; void post_message_task_steps(SerializedTransferRecord&); - void post_port_message(SerializedTransferRecord); + void post_port_message(SerializedTransferRecord const&); ErrorOr send_message_on_transport(SerializedTransferRecord const&); void read_from_transport(); diff --git a/Libraries/LibWeb/HTML/Navigable.h b/Libraries/LibWeb/HTML/Navigable.h index 0df05a0e809..af9ec3893f6 100644 --- a/Libraries/LibWeb/HTML/Navigable.h +++ b/Libraries/LibWeb/HTML/Navigable.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cpp index edeee71e9e2..f10814dbb00 100644 --- a/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Libraries/LibWeb/HTML/Navigation.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/HTML/Navigation.h b/Libraries/LibWeb/HTML/Navigation.h index b60eb93b1bf..19aaf20f691 100644 --- a/Libraries/LibWeb/HTML/Navigation.h +++ b/Libraries/LibWeb/HTML/Navigation.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/NavigationDestination.cpp b/Libraries/LibWeb/HTML/NavigationDestination.cpp index 80d0a534e74..fb16a57b215 100644 --- a/Libraries/LibWeb/HTML/NavigationDestination.cpp +++ b/Libraries/LibWeb/HTML/NavigationDestination.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/NavigationDestination.h b/Libraries/LibWeb/HTML/NavigationDestination.h index ce6104facc9..08e45f92f19 100644 --- a/Libraries/LibWeb/HTML/NavigationDestination.h +++ b/Libraries/LibWeb/HTML/NavigationDestination.h @@ -8,7 +8,7 @@ #include #include -#include +#include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp b/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp index 257e520c4ba..a80e12dbda5 100644 --- a/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp +++ b/Libraries/LibWeb/HTML/NavigationHistoryEntry.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/SessionHistoryEntry.cpp b/Libraries/LibWeb/HTML/SessionHistoryEntry.cpp index 1c298bd3757..5fba7b02df3 100644 --- a/Libraries/LibWeb/HTML/SessionHistoryEntry.cpp +++ b/Libraries/LibWeb/HTML/SessionHistoryEntry.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/SessionHistoryEntry.h b/Libraries/LibWeb/HTML/SessionHistoryEntry.h index b9ade2328f8..5f1d07ea194 100644 --- a/Libraries/LibWeb/HTML/SessionHistoryEntry.h +++ b/Libraries/LibWeb/HTML/SessionHistoryEntry.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace Web::HTML { diff --git a/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Libraries/LibWeb/HTML/TraversableNavigable.cpp index 590910c8f16..399a4879717 100644 --- a/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/HTML/Window.cpp b/Libraries/LibWeb/HTML/Window.cpp index 84eb671edf6..d21ddcaae4b 100644 --- a/Libraries/LibWeb/HTML/Window.cpp +++ b/Libraries/LibWeb/HTML/Window.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Streams/ReadableStream.cpp b/Libraries/LibWeb/Streams/ReadableStream.cpp index 285c3a4319a..ed857db5d0b 100644 --- a/Libraries/LibWeb/Streams/ReadableStream.cpp +++ b/Libraries/LibWeb/Streams/ReadableStream.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Streams/TransformStream.cpp b/Libraries/LibWeb/Streams/TransformStream.cpp index 00d272ad3a9..2e2db0a1188 100644 --- a/Libraries/LibWeb/Streams/TransformStream.cpp +++ b/Libraries/LibWeb/Streams/TransformStream.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include diff --git a/Libraries/LibWeb/Streams/WritableStream.cpp b/Libraries/LibWeb/Streams/WritableStream.cpp index 6cb0bb3480e..407576cdce6 100644 --- a/Libraries/LibWeb/Streams/WritableStream.cpp +++ b/Libraries/LibWeb/Streams/WritableStream.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include