Browse Source

LibWeb: Move StructuredSerializeOptions to its own header

This largely reduces the number of files needed to be compiled when we
change the MessagePort header.
Timothy Flynn 8 months ago
parent
commit
32a22c49e3

+ 1 - 0
Userland/Libraries/LibWeb/Forward.h

@@ -545,6 +545,7 @@ struct POSTResource;
 struct ScrollOptions;
 struct ScrollOptions;
 struct ScrollToOptions;
 struct ScrollToOptions;
 struct SerializedFormData;
 struct SerializedFormData;
+struct StructuredSerializeOptions;
 struct ToggleTaskTracker;
 struct ToggleTaskTracker;
 struct TransferDataHolder;
 struct TransferDataHolder;
 }
 }

+ 1 - 0
Userland/Libraries/LibWeb/HTML/DedicatedWorkerGlobalScope.cpp

@@ -11,6 +11,7 @@
 #include <LibWeb/HTML/EventHandler.h>
 #include <LibWeb/HTML/EventHandler.h>
 #include <LibWeb/HTML/EventNames.h>
 #include <LibWeb/HTML/EventNames.h>
 #include <LibWeb/HTML/MessageEvent.h>
 #include <LibWeb/HTML/MessageEvent.h>
+#include <LibWeb/HTML/MessagePort.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 1 - 0
Userland/Libraries/LibWeb/HTML/MessagePort.cpp

@@ -20,6 +20,7 @@
 #include <LibWeb/HTML/MessageEvent.h>
 #include <LibWeb/HTML/MessageEvent.h>
 #include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
 #include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
+#include <LibWeb/HTML/StructuredSerializeOptions.h>
 #include <LibWeb/HTML/WorkerGlobalScope.h>
 #include <LibWeb/HTML/WorkerGlobalScope.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {

+ 0 - 5
Userland/Libraries/LibWeb/HTML/MessagePort.h

@@ -21,11 +21,6 @@ namespace Web::HTML {
     E(onmessage, HTML::EventNames::message)      \
     E(onmessage, HTML::EventNames::message)      \
     E(onmessageerror, HTML::EventNames::messageerror)
     E(onmessageerror, HTML::EventNames::messageerror)
 
 
-// https://html.spec.whatwg.org/multipage/web-messaging.html#structuredserializeoptions
-struct StructuredSerializeOptions {
-    Vector<JS::Handle<JS::Object>> transfer;
-};
-
 // https://html.spec.whatwg.org/multipage/web-messaging.html#message-ports
 // https://html.spec.whatwg.org/multipage/web-messaging.html#message-ports
 class MessagePort final : public DOM::EventTarget
 class MessagePort final : public DOM::EventTarget
     , public Bindings::Transferable {
     , public Bindings::Transferable {

+ 0 - 1
Userland/Libraries/LibWeb/HTML/ServiceWorker.h

@@ -8,7 +8,6 @@
 
 
 #include <LibWeb/Bindings/ServiceWorkerPrototype.h>
 #include <LibWeb/Bindings/ServiceWorkerPrototype.h>
 #include <LibWeb/DOM/EventTarget.h>
 #include <LibWeb/DOM/EventTarget.h>
-#include <LibWeb/HTML/MessagePort.h>
 
 
 #define ENUMERATE_SERVICE_WORKER_EVENT_HANDLERS(E)  \
 #define ENUMERATE_SERVICE_WORKER_EVENT_HANDLERS(E)  \
     E(onstatechange, HTML::EventNames::statechange) \
     E(onstatechange, HTML::EventNames::statechange) \

+ 19 - 0
Userland/Libraries/LibWeb/HTML/StructuredSerializeOptions.h

@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Vector.h>
+#include <LibJS/Runtime/Object.h>
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/web-messaging.html#structuredserializeoptions
+struct StructuredSerializeOptions {
+    Vector<JS::Handle<JS::Object>> transfer;
+};
+
+}

+ 1 - 0
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -44,6 +44,7 @@
 #include <LibWeb/HTML/HTMLObjectElement.h>
 #include <LibWeb/HTML/HTMLObjectElement.h>
 #include <LibWeb/HTML/Location.h>
 #include <LibWeb/HTML/Location.h>
 #include <LibWeb/HTML/MessageEvent.h>
 #include <LibWeb/HTML/MessageEvent.h>
+#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/Navigation.h>
 #include <LibWeb/HTML/Navigation.h>
 #include <LibWeb/HTML/Navigator.h>
 #include <LibWeb/HTML/Navigator.h>
 #include <LibWeb/HTML/PageTransitionEvent.h>
 #include <LibWeb/HTML/PageTransitionEvent.h>

+ 1 - 0
Userland/Libraries/LibWeb/HTML/Window.h

@@ -24,6 +24,7 @@
 #include <LibWeb/HTML/Plugin.h>
 #include <LibWeb/HTML/Plugin.h>
 #include <LibWeb/HTML/Scripting/ImportMap.h>
 #include <LibWeb/HTML/Scripting/ImportMap.h>
 #include <LibWeb/HTML/ScrollOptions.h>
 #include <LibWeb/HTML/ScrollOptions.h>
+#include <LibWeb/HTML/StructuredSerializeOptions.h>
 #include <LibWeb/HTML/WindowEventHandlers.h>
 #include <LibWeb/HTML/WindowEventHandlers.h>
 #include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
 #include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
 #include <LibWeb/RequestIdleCallback/IdleRequest.h>
 #include <LibWeb/RequestIdleCallback/IdleRequest.h>

+ 1 - 0
Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp

@@ -27,6 +27,7 @@
 #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
 #include <LibWeb/HTML/Scripting/ExceptionReporter.h>
 #include <LibWeb/HTML/Scripting/Fetching.h>
 #include <LibWeb/HTML/Scripting/Fetching.h>
 #include <LibWeb/HTML/StructuredSerialize.h>
 #include <LibWeb/HTML/StructuredSerialize.h>
+#include <LibWeb/HTML/StructuredSerializeOptions.h>
 #include <LibWeb/HTML/Timer.h>
 #include <LibWeb/HTML/Timer.h>
 #include <LibWeb/HTML/Window.h>
 #include <LibWeb/HTML/Window.h>
 #include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
 #include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>

+ 0 - 1
Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h

@@ -16,7 +16,6 @@
 #include <LibWeb/Fetch/Request.h>
 #include <LibWeb/Fetch/Request.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/HTML/ImageBitmap.h>
 #include <LibWeb/HTML/ImageBitmap.h>
-#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/PerformanceTimeline/PerformanceEntry.h>
 #include <LibWeb/PerformanceTimeline/PerformanceEntry.h>
 #include <LibWeb/PerformanceTimeline/PerformanceEntryTuple.h>
 #include <LibWeb/PerformanceTimeline/PerformanceEntryTuple.h>
 
 

+ 2 - 4
Userland/Libraries/LibWeb/HTML/Worker.cpp

@@ -5,14 +5,12 @@
  */
  */
 
 
 #include <AK/Debug.h>
 #include <AK/Debug.h>
-#include <LibJS/Runtime/ConsoleObject.h>
 #include <LibJS/Runtime/Realm.h>
 #include <LibJS/Runtime/Realm.h>
-#include <LibWeb/Bindings/MainThreadVM.h>
 #include <LibWeb/Bindings/WorkerPrototype.h>
 #include <LibWeb/Bindings/WorkerPrototype.h>
+#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/Scripting/Environments.h>
 #include <LibWeb/HTML/Scripting/Environments.h>
-#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
+#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
 #include <LibWeb/HTML/Worker.h>
 #include <LibWeb/HTML/Worker.h>
-#include <LibWeb/WebIDL/ExceptionOr.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 1 - 10
Userland/Libraries/LibWeb/HTML/Worker.h

@@ -6,20 +6,11 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AK/RefCounted.h>
-#include <LibURL/Parser.h>
-#include <LibWeb/Bindings/MainThreadVM.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/HTML/AbstractWorker.h>
 #include <LibWeb/HTML/AbstractWorker.h>
-#include <LibWeb/HTML/MessageEvent.h>
-#include <LibWeb/HTML/MessagePort.h>
-#include <LibWeb/HTML/Scripting/ClassicScript.h>
-#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
-#include <LibWeb/HTML/Scripting/WorkerEnvironmentSettingsObject.h>
 #include <LibWeb/HTML/Window.h>
 #include <LibWeb/HTML/Window.h>
 #include <LibWeb/HTML/WorkerAgent.h>
 #include <LibWeb/HTML/WorkerAgent.h>
-#include <LibWeb/HTML/WorkerDebugConsoleClient.h>
-#include <LibWeb/Loader/ResourceLoader.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
 
 
 #define ENUMERATE_WORKER_EVENT_HANDLERS(E)  \
 #define ENUMERATE_WORKER_EVENT_HANDLERS(E)  \
     E(onmessage, HTML::EventNames::message) \
     E(onmessage, HTML::EventNames::message) \

+ 1 - 0
Userland/Libraries/LibWeb/HTML/WorkerAgent.cpp

@@ -5,6 +5,7 @@
  */
  */
 
 
 #include <LibWeb/Bindings/HostDefined.h>
 #include <LibWeb/Bindings/HostDefined.h>
+#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/WorkerAgent.h>
 #include <LibWeb/HTML/WorkerAgent.h>
 #include <LibWeb/Page/Page.h>
 #include <LibWeb/Page/Page.h>
 #include <LibWeb/Worker/WebWorkerClient.h>
 #include <LibWeb/Worker/WebWorkerClient.h>

+ 0 - 1
Userland/Libraries/LibWeb/HTML/WorkerAgent.h

@@ -9,7 +9,6 @@
 #include <LibWeb/Bindings/RequestPrototype.h>
 #include <LibWeb/Bindings/RequestPrototype.h>
 #include <LibWeb/Bindings/WorkerPrototype.h>
 #include <LibWeb/Bindings/WorkerPrototype.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/Forward.h>
-#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/Worker/WebWorkerClient.h>
 #include <LibWeb/Worker/WebWorkerClient.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {

+ 1 - 0
Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp

@@ -11,6 +11,7 @@
 #include <LibWeb/HTML/EventHandler.h>
 #include <LibWeb/HTML/EventHandler.h>
 #include <LibWeb/HTML/EventNames.h>
 #include <LibWeb/HTML/EventNames.h>
 #include <LibWeb/HTML/MessageEvent.h>
 #include <LibWeb/HTML/MessageEvent.h>
+#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/Scripting/ClassicScript.h>
 #include <LibWeb/HTML/Scripting/ClassicScript.h>
 #include <LibWeb/HTML/StructuredSerialize.h>
 #include <LibWeb/HTML/StructuredSerialize.h>
 #include <LibWeb/HTML/WorkerGlobalScope.h>
 #include <LibWeb/HTML/WorkerGlobalScope.h>

+ 1 - 0
Userland/Services/WebWorker/DedicatedWorkerHost.cpp

@@ -9,6 +9,7 @@
 #include <LibWeb/Fetch/Fetching/Fetching.h>
 #include <LibWeb/Fetch/Fetching/Fetching.h>
 #include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
 #include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
 #include <LibWeb/HTML/DedicatedWorkerGlobalScope.h>
 #include <LibWeb/HTML/DedicatedWorkerGlobalScope.h>
+#include <LibWeb/HTML/MessagePort.h>
 #include <LibWeb/HTML/Scripting/ClassicScript.h>
 #include <LibWeb/HTML/Scripting/ClassicScript.h>
 #include <LibWeb/HTML/Scripting/EnvironmentSettingsSnapshot.h>
 #include <LibWeb/HTML/Scripting/EnvironmentSettingsSnapshot.h>
 #include <LibWeb/HTML/Scripting/Fetching.h>
 #include <LibWeb/HTML/Scripting/Fetching.h>