Make it possible to not include IPC Messages headers in other headers
https://bugs.webkit.org/show_bug.cgi?id=203074

Reviewed by Geoffrey Garen.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
* bindings/js/ExceptionDetails.h: Added.
* bindings/js/JSDOMExceptionHandling.h:
Split the ExceptionDetails struct out into its own file.

Source/WebKit:

Make the Messages generator generate a new -MessagesReplies.h file, which
only includes headers for and definitions of DelayedReply/AsyncReply types,
which need to be mentioned as arguments to message hander methods, and
thus must be available in various headers throughout the project.

In order to do this, we have to de-nest them from the primary message
class, but we then 'using' them back into place inside the message class
so that most of the code doesn't need to change.

This helps to wildly decrease the header load of WebPage.h and WebPageProxy.h,
especially, because the number of headers needed for types in their replies
is much smaller than the number needed for all message receivers.

Also, only invoke the Messages generator once per source file, and
only parse the source file once, generating all three output files
in one invocation.

And then clean up all the missing indirect includes that we lost by doing this.

All-in-all this is worth roughly 8% on the WebKit2 Build Time Benchmark.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources.make:
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
* NetworkProcess/NetworkResourceLoader.h:
* PluginProcess/PluginControllerProxy.cpp:
* PluginProcess/PluginControllerProxy.h:
* PluginProcess/WebProcessConnection.h:
* Scripts/Makefile:
* Scripts/generate-message-receiver.py:
(main):
* Scripts/generate-messages-header.py: Removed.
* Scripts/webkit/LegacyMessageReceiver-expected.cpp:
* Scripts/webkit/LegacyMessages-expected.h:
* Scripts/webkit/LegacyMessagesReplies-expected.h: Added.
* Scripts/webkit/MessageReceiver-expected.cpp:
* Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
* Scripts/webkit/Messages-expected.h:
* Scripts/webkit/MessagesReplies-expected.h: Added.
* Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h: Added.
* Scripts/webkit/MessagesSuperclass-expected.h:
* Scripts/webkit/messages.py:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/Downloads/DownloadProxy.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Plugins/PluginProcessManager.cpp:
* UIProcess/Plugins/PluginProcessManager.h:
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/ProvisionalPageProxy.h:
* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessProxy.h:
* UIProcess/ios/WKContentView.mm:
* UIProcess/ios/WKContentViewInteraction.mm:
* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
* WebProcess/cocoa/VideoFullscreenManager.h:
* WebProcess/cocoa/VideoFullscreenManager.mm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251445 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 3e713ce..4d75fec 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2019-10-22  Tim Horton  <timothy_horton@apple.com>
+
+        Make it possible to not include IPC Messages headers in other headers
+        https://bugs.webkit.org/show_bug.cgi?id=203074
+
+        Reviewed by Geoffrey Garen.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/ExceptionDetails.h: Added.
+        * bindings/js/JSDOMExceptionHandling.h:
+        Split the ExceptionDetails struct out into its own file.
+
 2019-10-22  Dirk Schulze  <krit@webkit.org>
 
         SVG2: Add bounding-box keyword to pointer-events
diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake
index b7ef1e1..e79d815 100644
--- a/Source/WebCore/Headers.cmake
+++ b/Source/WebCore/Headers.cmake
@@ -187,6 +187,7 @@
     bindings/js/CachedScriptFetcher.h
     bindings/js/CommonVM.h
     bindings/js/DOMWrapperWorld.h
+    bindings/js/ExceptionDetails.h
     bindings/js/GCController.h
     bindings/js/IDBBindingUtilities.h
     bindings/js/JSCSSRuleCustom.h
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 4381795..51256e08 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -720,6 +720,7 @@
 		2D0621521DA63AA200A7FB26 /* WebKitMediaKeyNeededEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D0621471DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.cpp */; };
 		2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D25396318CE7F6200270222 /* ImageControlsButtonElementMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */; };
+		2D29386B235F6B6900C7F3B2 /* ExceptionDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC4192ECC8300984B78 /* DisplayRefreshMonitorManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D29ECCA192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC9192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h */; };
@@ -6647,6 +6648,7 @@
 		2D1932181DA64E1900A54A08 /* WebKitMediaKeyError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitMediaKeyError.idl; sourceTree = "<group>"; };
 		2D25396018CE7F6200270222 /* ImageControlsButtonElementMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageControlsButtonElementMac.cpp; sourceTree = "<group>"; };
 		2D25396118CE7F6200270222 /* ImageControlsButtonElementMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageControlsButtonElementMac.h; sourceTree = "<group>"; };
+		2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionDetails.h; sourceTree = "<group>"; };
 		2D29ECC1192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorClient.cpp; sourceTree = "<group>"; };
 		2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorClient.h; sourceTree = "<group>"; };
 		2D29ECC3192ECC8300984B78 /* DisplayRefreshMonitorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorManager.cpp; sourceTree = "<group>"; };
@@ -25095,6 +25097,7 @@
 				7C516AD21F3525200034B6BF /* DOMPromiseProxy.h */,
 				BC53DA471143134D000D817E /* DOMWrapperWorld.cpp */,
 				BC53DA2D1143121E000D817E /* DOMWrapperWorld.h */,
+				2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */,
 				1432E8480C51493F00B1500F /* GCController.cpp */,
 				1432E8460C51493800B1500F /* GCController.h */,
 				C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */,
@@ -29507,6 +29510,7 @@
 				93D196331D6CAB8200FC7E47 /* Exception.h in Headers */,
 				935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */,
 				51F645621F45398F00B54DED /* ExceptionData.h in Headers */,
+				2D29386B235F6B6900C7F3B2 /* ExceptionDetails.h in Headers */,
 				93D196311D6CAB7600FC7E47 /* ExceptionOr.h in Headers */,
 				837FB3451F9EA06D00D0FC31 /* ExtendableMessageEvent.h in Headers */,
 				31DCDF441DA1C45400EA5B93 /* ExtendedColor.h in Headers */,
diff --git a/Source/WebCore/bindings/js/ExceptionDetails.h b/Source/WebCore/bindings/js/ExceptionDetails.h
new file mode 100644
index 0000000..7cfaa54
--- /dev/null
+++ b/Source/WebCore/bindings/js/ExceptionDetails.h
@@ -0,0 +1,39 @@
+/*
+* Copyright (C) 2019 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. ``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
+* 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.
+*/
+
+#pragma once
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+struct ExceptionDetails {
+    String message;
+    int lineNumber { 0 };
+    int columnNumber { 0 };
+    String sourceURL;
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSDOMExceptionHandling.h b/Source/WebCore/bindings/js/JSDOMExceptionHandling.h
index 622bd48..9b6087a 100644
--- a/Source/WebCore/bindings/js/JSDOMExceptionHandling.h
+++ b/Source/WebCore/bindings/js/JSDOMExceptionHandling.h
@@ -23,6 +23,7 @@
 
 #pragma once
 
+#include "ExceptionDetails.h"
 #include "ExceptionOr.h"
 #include <JavaScriptCore/ThrowScope.h>
 
@@ -36,13 +37,6 @@
 class DeferredPromise;
 class JSDOMGlobalObject;
 
-struct ExceptionDetails {
-    String message;
-    int lineNumber { 0 };
-    int columnNumber { 0 };
-    String sourceURL;
-};
-
 void throwAttributeTypeError(JSC::JSGlobalObject&, JSC::ThrowScope&, const char* interfaceName, const char* attributeName, const char* expectedType);
 WEBCORE_EXPORT bool throwSetterTypeError(JSC::JSGlobalObject&, JSC::ThrowScope&, const char* interfaceName, const char* attributeName);
 
diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt
index 1e06e62..efcc2e8 100644
--- a/Source/WebKit/CMakeLists.txt
+++ b/Source/WebKit/CMakeLists.txt
@@ -309,21 +309,20 @@
 WEBKIT_FRAMEWORK_DECLARE(WebKit)
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
 
-# Helper macro which wraps generate-message-receiver.py and generate-message-header.py scripts
+# Helper macro which wraps the generate-message-receiver.py script
 #   _output_source is a list name which will contain generated sources.(eg. WebKit_SOURCES)
 #   _input_files are messages.in files to generate.
 macro(GENERATE_MESSAGE_SOURCES _output_source _input_files)
     foreach (_file ${_input_files})
         get_filename_component(_name ${_file} NAME_WE)
         add_custom_command(
-            OUTPUT ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessageReceiver.cpp ${WebKit_DERIVED_SOURCES_DIR}/${_name}Messages.h
+            OUTPUT ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessageReceiver.cpp ${WebKit_DERIVED_SOURCES_DIR}/${_name}Messages.h ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessagesReplies.h
             MAIN_DEPENDENCY ${_file}
             DEPENDS ${WEBKIT_DIR}/Scripts/webkit/__init__.py
                     ${WEBKIT_DIR}/Scripts/webkit/messages.py
                     ${WEBKIT_DIR}/Scripts/webkit/model.py
                     ${WEBKIT_DIR}/Scripts/webkit/parser.py
-            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-message-receiver.py ${_file} > ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessageReceiver.cpp
-            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-messages-header.py ${_file} > ${WebKit_DERIVED_SOURCES_DIR}/${_name}Messages.h
+            COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT_DIR}/Scripts/generate-message-receiver.py ${_file} --implementation ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessageReceiver.cpp --header ${WebKit_DERIVED_SOURCES_DIR}/${_name}Messages.h --reply-header ${WebKit_DERIVED_SOURCES_DIR}/${_name}MessagesReplies.h
             WORKING_DIRECTORY ${WEBKIT_DIR}
             VERBATIM)
 
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index c22b5bf..08ef9b4 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,82 @@
+2019-10-22  Tim Horton  <timothy_horton@apple.com>
+
+        Make it possible to not include IPC Messages headers in other headers
+        https://bugs.webkit.org/show_bug.cgi?id=203074
+
+        Reviewed by Geoffrey Garen.
+
+        Make the Messages generator generate a new -MessagesReplies.h file, which
+        only includes headers for and definitions of DelayedReply/AsyncReply types,
+        which need to be mentioned as arguments to message hander methods, and
+        thus must be available in various headers throughout the project.
+
+        In order to do this, we have to de-nest them from the primary message
+        class, but we then 'using' them back into place inside the message class
+        so that most of the code doesn't need to change.
+
+        This helps to wildly decrease the header load of WebPage.h and WebPageProxy.h,
+        especially, because the number of headers needed for types in their replies
+        is much smaller than the number needed for all message receivers.
+
+        Also, only invoke the Messages generator once per source file, and
+        only parse the source file once, generating all three output files
+        in one invocation.
+
+        And then clean up all the missing indirect includes that we lost by doing this.
+
+        All-in-all this is worth roughly 8% on the WebKit2 Build Time Benchmark.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources.make:
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        * NetworkProcess/NetworkResourceLoader.h:
+        * PluginProcess/PluginControllerProxy.cpp:
+        * PluginProcess/PluginControllerProxy.h:
+        * PluginProcess/WebProcessConnection.h:
+        * Scripts/Makefile:
+        * Scripts/generate-message-receiver.py:
+        (main):
+        * Scripts/generate-messages-header.py: Removed.
+        * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
+        * Scripts/webkit/LegacyMessages-expected.h:
+        * Scripts/webkit/LegacyMessagesReplies-expected.h: Added.
+        * Scripts/webkit/MessageReceiver-expected.cpp:
+        * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
+        * Scripts/webkit/Messages-expected.h:
+        * Scripts/webkit/MessagesReplies-expected.h: Added.
+        * Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h: Added.
+        * Scripts/webkit/MessagesSuperclass-expected.h:
+        * Scripts/webkit/messages.py:
+        * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
+        * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
+        * UIProcess/Downloads/DownloadProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Plugins/PluginProcessManager.cpp:
+        * UIProcess/Plugins/PluginProcessManager.h:
+        * UIProcess/Plugins/PluginProcessProxy.h:
+        * UIProcess/ProvisionalPageProxy.h:
+        * UIProcess/SuspendedPageProxy.h:
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebProcessPool.cpp:
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/ios/WKContentView.mm:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        * WebProcess/Storage/WebSWContextManagerConnection.h:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        * WebProcess/cocoa/VideoFullscreenManager.h:
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+
 2019-10-22  Chris Dumez  <cdumez@apple.com>
 
         Simplify "Unexpectedly Resumed" assertion handling
diff --git a/Source/WebKit/DerivedSources-input.xcfilelist b/Source/WebKit/DerivedSources-input.xcfilelist
index f1adad6..c8454bb 100644
--- a/Source/WebKit/DerivedSources-input.xcfilelist
+++ b/Source/WebKit/DerivedSources-input.xcfilelist
@@ -46,7 +46,6 @@
 $(PROJECT_DIR)/Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb
 $(PROJECT_DIR)/Scripts/generate-https-upgrade-database.sh
 $(PROJECT_DIR)/Scripts/generate-message-receiver.py
-$(PROJECT_DIR)/Scripts/generate-messages-header.py
 $(PROJECT_DIR)/Scripts/webkit/__init__.py
 $(PROJECT_DIR)/Scripts/webkit/messages.py
 $(PROJECT_DIR)/Scripts/webkit/model.py
diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make
index c39c297..42cc054 100644
--- a/Source/WebKit/DerivedSources.make
+++ b/Source/WebKit/DerivedSources.make
@@ -189,7 +189,6 @@
 
 SCRIPTS = \
     $(WebKit2)/Scripts/generate-message-receiver.py \
-    $(WebKit2)/Scripts/generate-messages-header.py \
     $(WebKit2)/Scripts/webkit/__init__.py \
     $(WebKit2)/Scripts/webkit/messages.py \
     $(WebKit2)/Scripts/webkit/model.py \
@@ -206,15 +205,12 @@
 all : \
     $(MESSAGE_RECEIVERS:%=%MessageReceiver.cpp) \
     $(MESSAGE_RECEIVERS:%=%Messages.h) \
+    $(MESSAGE_RECEIVERS:%=%MessagesReplies.h) \
 #
 
-%MessageReceiver.cpp : %.messages.in $(SCRIPTS)
+%MessageReceiver.cpp %Messages.h %MessagesReplies.h : %.messages.in $(SCRIPTS)
 	@echo Generating message receiver for $*...
-	@python $(WebKit2)/Scripts/generate-message-receiver.py $< > $@
-
-%Messages.h : %.messages.in $(SCRIPTS)
-	@echo Generating messages header for $*...
-	@python $(WebKit2)/Scripts/generate-messages-header.py $< > $@
+	@python $(WebKit2)/Scripts/generate-message-receiver.py $< --implementation $*MessageReceiver.cpp --header $*Messages.h --reply-header $*MessagesReplies.h
 
 TEXT_PREPROCESSOR_FLAGS=-E -P -w
 
diff --git a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
index 1db4ec2..e9d08ee 100644
--- a/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
+++ b/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
@@ -31,6 +31,7 @@
 #include "APIDictionary.h"
 #include "Logging.h"
 #include "NetworkProcess.h"
+#include "NetworkProcessProxyMessages.h"
 #include "NetworkSession.h"
 #include "ResourceLoadStatisticsDatabaseStore.h"
 #include "ResourceLoadStatisticsMemoryStore.h"
diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
index c357aa6..b8d3f99 100644
--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
@@ -31,6 +31,7 @@
 #include "DataReference.h"
 #include "Logging.h"
 #include "NetworkCache.h"
+#include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkMDNSRegisterMessages.h"
 #include "NetworkProcess.h"
 #include "NetworkProcessConnectionMessages.h"
diff --git a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
index a02a1c3..97b2744 100644
--- a/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
+++ b/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
@@ -29,10 +29,12 @@
 #include "Connection.h"
 #include "DownloadID.h"
 #include "NetworkActivityTracker.h"
-#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkConnectionToWebProcessMessagesReplies.h"
 #include "NetworkMDNSRegister.h"
 #include "NetworkRTCProvider.h"
 #include "NetworkResourceLoadMap.h"
+#include "SandboxExtension.h"
+#include "WebPageProxyIdentifier.h"
 #include "WebPaymentCoordinatorProxy.h"
 #include "WebResourceLoadObserver.h"
 #include <WebCore/FrameIdentifier.h>
@@ -50,6 +52,7 @@
 
 namespace WebCore {
 class BlobDataFileReference;
+class BlobPart;
 class BlobRegistryImpl;
 class ResourceError;
 class ResourceRequest;
@@ -64,6 +67,7 @@
 
 class NetworkProcess;
 class NetworkResourceLoader;
+class NetworkResourceLoadParameters;
 class NetworkSession;
 class NetworkSocketChannel;
 class NetworkSocketStream;
@@ -177,8 +181,8 @@
     void didReceiveSyncNetworkConnectionToWebProcessMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
 
     void scheduleResourceLoad(NetworkResourceLoadParameters&&);
-    void performSynchronousLoad(NetworkResourceLoadParameters&&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply&&);
-    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebPageProxyIdentifier, Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::DelayedReply&&);
+    void performSynchronousLoad(NetworkResourceLoadParameters&&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoadDelayedReply&&);
+    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebPageProxyIdentifier, Messages::NetworkConnectionToWebProcess::TestProcessIncomingSyncMessagesWhenWaitingForSyncReplyDelayedReply&&);
     void loadPing(NetworkResourceLoadParameters&&);
     void prefetchDNS(const String&);
     void preconnectTo(uint64_t preconnectionIdentifier, NetworkResourceLoadParameters&&);
diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
index 4e3c01e..fffe5d0 100644
--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
@@ -31,6 +31,7 @@
 #include "Logging.h"
 #include "NetworkCache.h"
 #include "NetworkConnectionToWebProcess.h"
+#include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkLoad.h"
 #include "NetworkLoadChecker.h"
 #include "NetworkProcess.h"
diff --git a/Source/WebKit/NetworkProcess/NetworkResourceLoader.h b/Source/WebKit/NetworkProcess/NetworkResourceLoader.h
index 8d179e3..66b2560 100644
--- a/Source/WebKit/NetworkProcess/NetworkResourceLoader.h
+++ b/Source/WebKit/NetworkProcess/NetworkResourceLoader.h
@@ -29,7 +29,7 @@
 #include "MessageSender.h"
 #include "NetworkCache.h"
 #include "NetworkConnectionToWebProcess.h"
-#include "NetworkConnectionToWebProcessMessages.h"
+#include "NetworkConnectionToWebProcessMessagesReplies.h"
 #include "NetworkLoadClient.h"
 #include "NetworkResourceLoadParameters.h"
 #include <WebCore/AdClickAttribution.h>
@@ -65,7 +65,7 @@
     , public WebCore::ContentSecurityPolicyClient
     , public CanMakeWeakPtr<NetworkResourceLoader> {
 public:
-    static Ref<NetworkResourceLoader> create(NetworkResourceLoadParameters&& parameters, NetworkConnectionToWebProcess& connection, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply&& reply = nullptr)
+    static Ref<NetworkResourceLoader> create(NetworkResourceLoadParameters&& parameters, NetworkConnectionToWebProcess& connection, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoadDelayedReply&& reply = nullptr)
     {
         return adoptRef(*new NetworkResourceLoader(WTFMove(parameters), connection, WTFMove(reply)));
     }
@@ -131,7 +131,7 @@
 #endif
 
 private:
-    NetworkResourceLoader(NetworkResourceLoadParameters&&, NetworkConnectionToWebProcess&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply&&);
+    NetworkResourceLoader(NetworkResourceLoadParameters&&, NetworkConnectionToWebProcess&, Messages::NetworkConnectionToWebProcess::PerformSynchronousLoadDelayedReply&&);
 
     // IPC::MessageSender
     IPC::Connection* messageSenderConnection() const override;
diff --git a/Source/WebKit/PluginProcess/PluginControllerProxy.cpp b/Source/WebKit/PluginProcess/PluginControllerProxy.cpp
index b642144b..ea711d3 100644
--- a/Source/WebKit/PluginProcess/PluginControllerProxy.cpp
+++ b/Source/WebKit/PluginProcess/PluginControllerProxy.cpp
@@ -40,6 +40,7 @@
 #include "ShareableBitmap.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebProcessConnection.h"
+#include "WebProcessConnectionMessages.h"
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/HTTPHeaderMap.h>
 #include <WebCore/IdentifierRep.h>
diff --git a/Source/WebKit/PluginProcess/PluginControllerProxy.h b/Source/WebKit/PluginProcess/PluginControllerProxy.h
index b98ca94..ad4fcd9 100644
--- a/Source/WebKit/PluginProcess/PluginControllerProxy.h
+++ b/Source/WebKit/PluginProcess/PluginControllerProxy.h
@@ -30,9 +30,8 @@
 #include "Connection.h"
 #include "Plugin.h"
 #include "PluginController.h"
-#include "PluginControllerProxyMessages.h"
 #include "ShareableBitmap.h"
-#include "WebProcessConnectionMessages.h"
+#include "WebProcessConnectionMessagesReplies.h"
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/UserActivity.h>
 #include <wtf/Noncopyable.h>
@@ -75,8 +74,8 @@
 
     bool isInitializing() const { return m_isInitializing; }
     
-    void setInitializationReply(Messages::WebProcessConnection::CreatePlugin::DelayedReply&&);
-    Messages::WebProcessConnection::CreatePlugin::DelayedReply takeInitializationReply();
+    void setInitializationReply(Messages::WebProcessConnection::CreatePluginDelayedReply&&);
+    Messages::WebProcessConnection::CreatePluginDelayedReply takeInitializationReply();
 
 private:
     void startPaintTimer();
@@ -184,7 +183,7 @@
     bool m_isVisible;
     bool m_isWindowVisible;
 
-    Messages::WebProcessConnection::CreatePlugin::DelayedReply m_initializationReply;
+    Messages::WebProcessConnection::CreatePluginDelayedReply m_initializationReply;
 
     RefPtr<Plugin> m_plugin;
 
diff --git a/Source/WebKit/PluginProcess/WebProcessConnection.h b/Source/WebKit/PluginProcess/WebProcessConnection.h
index 3a0a7a8..ef24210 100644
--- a/Source/WebKit/PluginProcess/WebProcessConnection.h
+++ b/Source/WebKit/PluginProcess/WebProcessConnection.h
@@ -29,7 +29,7 @@
 
 #include "Connection.h"
 #include "Plugin.h"
-#include "WebProcessConnectionMessages.h"
+#include "WebProcessConnectionMessagesReplies.h"
 #include <wtf/HashSet.h>
 #include <wtf/RefCounted.h>
 
@@ -69,9 +69,9 @@
     // Message handlers.
     void didReceiveWebProcessConnectionMessage(IPC::Connection&, IPC::Decoder&);
     void didReceiveSyncWebProcessConnectionMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
-    void createPlugin(const PluginCreationParameters&, Messages::WebProcessConnection::CreatePlugin::DelayedReply&&);
+    void createPlugin(const PluginCreationParameters&, Messages::WebProcessConnection::CreatePluginDelayedReply&&);
     void createPluginAsynchronously(const PluginCreationParameters&);
-    void destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, Messages::WebProcessConnection::DestroyPlugin::DelayedReply&&);
+    void destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete, Messages::WebProcessConnection::DestroyPluginDelayedReply&&);
     
     void createPluginInternal(const PluginCreationParameters&, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID);
 
diff --git a/Source/WebKit/Scripts/Makefile b/Source/WebKit/Scripts/Makefile
index 65820f2..5432c82 100644
--- a/Source/WebKit/Scripts/Makefile
+++ b/Source/WebKit/Scripts/Makefile
@@ -1,8 +1,5 @@
 all:
-	python ./generate-messages-header.py webkit/test-superclass-messages.in > webkit/MessagesSuperclass-expected.h
-	python ./generate-messages-header.py webkit/test-legacy-messages.in > webkit/LegacyMessages-expected.h
-	python ./generate-messages-header.py webkit/test-messages.in > webkit/Messages-expected.h
-	python ./generate-message-receiver.py webkit/test-superclass-messages.in > webkit/MessageReceiverSuperclass-expected.cpp
-	python ./generate-message-receiver.py webkit/test-legacy-messages.in > webkit/LegacyMessageReceiver-expected.cpp
-	python ./generate-message-receiver.py webkit/test-messages.in > webkit/MessageReceiver-expected.cpp
+	python ./generate-message-receiver.py webkit/test-superclass-messages.in --implementation webkit/MessageReceiverSuperclass-expected.cpp --header webkit/MessagesSuperclass-expected.h --reply-header webkit/MessagesRepliesSuperclassReplies-expected.h
+	python ./generate-message-receiver.py webkit/test-legacy-messages.in --implementation webkit/LegacyMessageReceiver-expected.cpp --header webkit/LegacyMessages-expected.h --reply-header webkit/LegacyMessagesReplies-expected.h
+	python ./generate-message-receiver.py webkit/test-messages.in --implementation webkit/MessageReceiver-expected.cpp --header webkit/Messages-expected.h --reply-header webkit/MessagesReplies-expected.h
 
diff --git a/Source/WebKit/Scripts/generate-message-receiver.py b/Source/WebKit/Scripts/generate-message-receiver.py
index 6413a8b..35e4058 100644
--- a/Source/WebKit/Scripts/generate-message-receiver.py
+++ b/Source/WebKit/Scripts/generate-message-receiver.py
@@ -23,18 +23,34 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from __future__ import with_statement
+import argparse
 import sys
 
 import webkit.messages
+import webkit.parser
 
 
 def main(argv=None):
-    if not argv:
-        argv = sys.argv
-    input_path = argv[1]
-    with open(input_path) as input_file:
-        # Python 3, change to:  print(webkit.messages.generate_message_handler(input_file), end='')
-        sys.stdout.write(webkit.messages.generate_message_handler(input_file))
+    parser = argparse.ArgumentParser()
+    parser.add_argument('source')
+    parser.add_argument('--implementation', required=True)
+    parser.add_argument('--header', required=True)
+    parser.add_argument('--reply-header', required=True)
+
+    args = parser.parse_args()
+
+    with open(args.source) as source_file:
+        receiver = webkit.parser.parse(source_file)
+
+    with open(args.implementation, "w+") as implementation_output:
+        implementation_output.write(webkit.messages.generate_message_handler(receiver))
+
+    with open(args.header, "w+") as header_output:
+        header_output.write(webkit.messages.generate_messages_header(receiver))
+
+    with open(args.reply_header, "w+") as reply_header_output:
+        reply_header_output.write(webkit.messages.generate_messages_reply_header(receiver))
+
     return 0
 
 if __name__ == '__main__':
diff --git a/Source/WebKit/Scripts/generate-messages-header.py b/Source/WebKit/Scripts/generate-messages-header.py
deleted file mode 100644
index ad73a52..0000000
--- a/Source/WebKit/Scripts/generate-messages-header.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2010 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.
-
-from __future__ import with_statement
-import sys
-
-import webkit.messages
-
-
-def main(argv=None):
-    if not argv:
-        argv = sys.argv
-    input_path = argv[1]
-    with open(input_path) as input_file:
-        # Python 3, change to:  print(webkit.messages.generate_messages_header(input_file), end='')
-        sys.stdout.write(webkit.messages.generate_messages_header(input_file))
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(main(sys.argv))
diff --git a/Source/WebKit/Scripts/webkit/LegacyMessageReceiver-expected.cpp b/Source/WebKit/Scripts/webkit/LegacyMessageReceiver-expected.cpp
index fea8536..d0b865f 100644
--- a/Source/WebKit/Scripts/webkit/LegacyMessageReceiver-expected.cpp
+++ b/Source/WebKit/Scripts/webkit/LegacyMessageReceiver-expected.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h b/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h
index ffd13d3..aece122 100644
--- a/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h
+++ b/Source/WebKit/Scripts/webkit/LegacyMessages-expected.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
 #include "ArgumentCoders.h"
 #include "Connection.h"
 #include "Plugin.h"
+#include "WebPageMessagesReplies.h"
 #include <WebCore/GraphicsLayer.h>
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/PluginData.h>
@@ -360,7 +361,7 @@
     static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
+    using DelayedReply = GetPluginProcessConnectionDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const IPC::Connection::Handle& connectionHandle);
     using Reply = std::tuple<IPC::Connection::Handle&>;
     using ReplyArguments = std::tuple<IPC::Connection::Handle>;
@@ -386,7 +387,7 @@
     static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void()>;
+    using DelayedReply = TestMultipleAttributesDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
     using Reply = std::tuple<>;
     using ReplyArguments = std::tuple<>;
diff --git a/Source/WebKit/Scripts/webkit/LegacyMessagesReplies-expected.h b/Source/WebKit/Scripts/webkit/LegacyMessagesReplies-expected.h
new file mode 100644
index 0000000..f70ceaf
--- /dev/null
+++ b/Source/WebKit/Scripts/webkit/LegacyMessagesReplies-expected.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010-2019 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.
+ */
+
+#pragma once
+
+#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
+
+#include "Connection.h"
+#include <wtf/Forward.h>
+
+
+namespace Messages {
+namespace WebPage {
+
+using GetPluginProcessConnectionDelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
+
+using TestMultipleAttributesDelayedReply = CompletionHandler<void()>;
+
+} // namespace WebPage
+} // namespace Messages
+
+#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
diff --git a/Source/WebKit/Scripts/webkit/MessageReceiver-expected.cpp b/Source/WebKit/Scripts/webkit/MessageReceiver-expected.cpp
index b5cce1b..a25a912 100644
--- a/Source/WebKit/Scripts/webkit/MessageReceiver-expected.cpp
+++ b/Source/WebKit/Scripts/webkit/MessageReceiver-expected.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp b/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp
index 14212d5..b611b25 100644
--- a/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp
+++ b/Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
diff --git a/Source/WebKit/Scripts/webkit/Messages-expected.h b/Source/WebKit/Scripts/webkit/Messages-expected.h
index ffd13d3..aece122 100644
--- a/Source/WebKit/Scripts/webkit/Messages-expected.h
+++ b/Source/WebKit/Scripts/webkit/Messages-expected.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,6 +29,7 @@
 #include "ArgumentCoders.h"
 #include "Connection.h"
 #include "Plugin.h"
+#include "WebPageMessagesReplies.h"
 #include <WebCore/GraphicsLayer.h>
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/PluginData.h>
@@ -360,7 +361,7 @@
     static IPC::StringReference name() { return IPC::StringReference("GetPluginProcessConnection"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
+    using DelayedReply = GetPluginProcessConnectionDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const IPC::Connection::Handle& connectionHandle);
     using Reply = std::tuple<IPC::Connection::Handle&>;
     using ReplyArguments = std::tuple<IPC::Connection::Handle>;
@@ -386,7 +387,7 @@
     static IPC::StringReference name() { return IPC::StringReference("TestMultipleAttributes"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void()>;
+    using DelayedReply = TestMultipleAttributesDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
     using Reply = std::tuple<>;
     using ReplyArguments = std::tuple<>;
diff --git a/Source/WebKit/Scripts/webkit/MessagesReplies-expected.h b/Source/WebKit/Scripts/webkit/MessagesReplies-expected.h
new file mode 100644
index 0000000..f70ceaf
--- /dev/null
+++ b/Source/WebKit/Scripts/webkit/MessagesReplies-expected.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010-2019 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.
+ */
+
+#pragma once
+
+#if (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
+
+#include "Connection.h"
+#include <wtf/Forward.h>
+
+
+namespace Messages {
+namespace WebPage {
+
+using GetPluginProcessConnectionDelayedReply = CompletionHandler<void(const IPC::Connection::Handle& connectionHandle)>;
+
+using TestMultipleAttributesDelayedReply = CompletionHandler<void()>;
+
+} // namespace WebPage
+} // namespace Messages
+
+#endif // (ENABLE(WEBKIT2) && (NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND))
diff --git a/Source/WebKit/Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h b/Source/WebKit/Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h
new file mode 100644
index 0000000..3fa63f3
--- /dev/null
+++ b/Source/WebKit/Scripts/webkit/MessagesRepliesSuperclassReplies-expected.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010-2019 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.
+ */
+
+#pragma once
+
+#include "TestClassName.h"
+#include <wtf/Forward.h>
+#include <wtf/Optional.h>
+
+
+namespace Messages {
+namespace WebPage {
+
+#if ENABLE(TEST_FEATURE)
+using TestAsyncMessageAsyncReply = CompletionHandler<void(uint64_t result)>;
+#endif
+
+#if ENABLE(TEST_FEATURE)
+using TestAsyncMessageWithNoArgumentsAsyncReply = CompletionHandler<void()>;
+#endif
+
+#if ENABLE(TEST_FEATURE)
+using TestAsyncMessageWithMultipleArgumentsAsyncReply = CompletionHandler<void(bool flag, uint64_t value)>;
+#endif
+
+using TestSyncMessageDelayedReply = CompletionHandler<void(uint8_t reply)>;
+
+using TestSynchronousMessageDelayedReply = CompletionHandler<void(const Optional<WebKit::TestClassName>& optionalReply)>;
+
+} // namespace WebPage
+} // namespace Messages
diff --git a/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h b/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h
index 0f6fcc2..ee8071f 100644
--- a/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h
+++ b/Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +27,7 @@
 #include "ArgumentCoders.h"
 #include "Connection.h"
 #include "TestClassName.h"
+#include "WebPageMessagesReplies.h"
 #include <wtf/Forward.h>
 #include <wtf/Optional.h>
 #include <wtf/ThreadSafeRefCounted.h>
@@ -78,7 +79,7 @@
     static void callReply(IPC::Decoder&, CompletionHandler<void(uint64_t&&)>&&);
     static void cancelReply(CompletionHandler<void(uint64_t&&)>&&);
     static IPC::StringReference asyncMessageReplyName() { return { "TestAsyncMessageReply" }; }
-    using AsyncReply = CompletionHandler<void(uint64_t result)>;
+    using AsyncReply = TestAsyncMessageAsyncReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint64_t result);
     using Reply = std::tuple<uint64_t&>;
     using ReplyArguments = std::tuple<uint64_t>;
@@ -109,7 +110,7 @@
     static void callReply(IPC::Decoder&, CompletionHandler<void()>&&);
     static void cancelReply(CompletionHandler<void()>&&);
     static IPC::StringReference asyncMessageReplyName() { return { "TestAsyncMessageWithNoArgumentsReply" }; }
-    using AsyncReply = CompletionHandler<void()>;
+    using AsyncReply = TestAsyncMessageWithNoArgumentsAsyncReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&);
     using Reply = std::tuple<>;
     using ReplyArguments = std::tuple<>;
@@ -135,7 +136,7 @@
     static void callReply(IPC::Decoder&, CompletionHandler<void(bool&&, uint64_t&&)>&&);
     static void cancelReply(CompletionHandler<void(bool&&, uint64_t&&)>&&);
     static IPC::StringReference asyncMessageReplyName() { return { "TestAsyncMessageWithMultipleArgumentsReply" }; }
-    using AsyncReply = CompletionHandler<void(bool flag, uint64_t value)>;
+    using AsyncReply = TestAsyncMessageWithMultipleArgumentsAsyncReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, bool flag, uint64_t value);
     using Reply = std::tuple<bool&, uint64_t&>;
     using ReplyArguments = std::tuple<bool, uint64_t>;
@@ -157,7 +158,7 @@
     static IPC::StringReference name() { return IPC::StringReference("TestSyncMessage"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void(uint8_t reply)>;
+    using DelayedReply = TestSyncMessageDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, uint8_t reply);
     using Reply = std::tuple<uint8_t&>;
     using ReplyArguments = std::tuple<uint8_t>;
@@ -183,7 +184,7 @@
     static IPC::StringReference name() { return IPC::StringReference("TestSynchronousMessage"); }
     static const bool isSync = true;
 
-    using DelayedReply = CompletionHandler<void(const Optional<WebKit::TestClassName>& optionalReply)>;
+    using DelayedReply = TestSynchronousMessageDelayedReply;
     static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&, const Optional<WebKit::TestClassName>& optionalReply);
     using Reply = std::tuple<Optional<WebKit::TestClassName>&>;
     using ReplyArguments = std::tuple<Optional<WebKit::TestClassName>>;
diff --git a/Source/WebKit/Scripts/webkit/messages.py b/Source/WebKit/Scripts/webkit/messages.py
index 356134b..21de685 100644
--- a/Source/WebKit/Scripts/webkit/messages.py
+++ b/Source/WebKit/Scripts/webkit/messages.py
@@ -32,7 +32,7 @@
 ASYNC_ATTRIBUTE = 'Async'
 
 _license_header = """/*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -113,9 +113,29 @@
     return 'std::tuple<%s>' % (', '.join(parameter.type for parameter in message.reply_parameters))
 
 
+def message_to_reply_forward_declaration(message):
+    result = []
+
+    if message.reply_parameters != None and (message.has_attribute(SYNCHRONOUS_ATTRIBUTE) or message.has_attribute(ASYNC_ATTRIBUTE)):
+        send_parameters = [(function_parameter_type(x.type, x.kind), x.name) for x in message.reply_parameters]
+        completion_handler_parameters = '%s' % ', '.join([' '.join(x) for x in send_parameters])
+
+        if message.has_attribute(ASYNC_ATTRIBUTE):
+            result.append('using %sAsyncReply' % message.name)
+        else:
+            result.append('using %sDelayedReply' % message.name)
+        result.append(' = CompletionHandler<void(%s)>;\n' % completion_handler_parameters)
+
+    if not result:
+        return None
+
+    return surround_in_condition(''.join(result), message.condition)
+
+
 def message_to_struct_declaration(message):
     result = []
     function_parameters = [(function_parameter_type(x.type, x.kind), x.name) for x in message.parameters]
+
     result.append('class %s {\n' % message.name)
     result.append('public:\n')
     result.append('    typedef %s Arguments;\n' % arguments_type(message))
@@ -132,11 +152,10 @@
             result.append('    static void callReply(IPC::Decoder&, CompletionHandler<void(%s)>&&);\n' % move_parameters)
             result.append('    static void cancelReply(CompletionHandler<void(%s)>&&);\n' % move_parameters)
             result.append('    static IPC::StringReference asyncMessageReplyName() { return { "%sReply" }; }\n' % message.name)
-            result.append('    using AsyncReply')
+            result.append('    using AsyncReply = %sAsyncReply;\n' % message.name)
         elif message.has_attribute(SYNCHRONOUS_ATTRIBUTE):
-            result.append('    using DelayedReply')
+            result.append('    using DelayedReply = %sDelayedReply;\n' % message.name)
         if message.has_attribute(SYNCHRONOUS_ATTRIBUTE) or message.has_attribute(ASYNC_ATTRIBUTE):
-            result.append(' = CompletionHandler<void(%s)>;\n' % completion_handler_parameters)
             result.append('    static void send(std::unique_ptr<IPC::Encoder>&&, IPC::Connection&')
             if len(send_parameters):
                 result.append(', %s' % completion_handler_parameters)
@@ -180,27 +199,8 @@
     return ''.join(result)
 
 
-def forward_declarations_and_headers(receiver):
-    types_by_namespace = collections.defaultdict(set)
-
-    headers = set([
-        '"ArgumentCoders.h"',
-        '<wtf/Forward.h>',
-    ])
-
-    header_conditions = {
-        '"LayerHostingContext.h"': ["PLATFORM(COCOA)", ],
-    }
-
-    non_template_wtf_types = frozenset([
-        'MachSendRight',
-        'String',
-    ])
-
-    headers.add('"Connection.h"')
-    headers.add('<wtf/ThreadSafeRefCounted.h>')
-
-    no_forward_declaration_types = frozenset([
+def types_that_cannot_be_forward_declared():
+    return frozenset([
         'MachSendRight',
         'String',
         'WebCore::DocumentIdentifier',
@@ -226,6 +226,33 @@
         'WebKit::WebPageProxyIdentifier',
     ])
 
+
+def conditions_for_header(header):
+    conditions = {
+        '"LayerHostingContext.h"': ["PLATFORM(COCOA)", ],
+    }
+    if not header in conditions:
+        return None
+    return conditions[header]
+
+
+def forward_declarations_and_headers(receiver):
+    types_by_namespace = collections.defaultdict(set)
+
+    headers = set([
+        '"ArgumentCoders.h"',
+        '<wtf/Forward.h>',
+        '"Connection.h"',
+        '<wtf/ThreadSafeRefCounted.h>',
+        '"%sMessagesReplies.h"' % receiver.name,
+    ])
+
+    non_template_wtf_types = frozenset([
+        'MachSendRight',
+        'String',
+    ])
+
+    no_forward_declaration_types = types_that_cannot_be_forward_declared()
     for parameter in receiver.iterparameters():
         kind = parameter.kind
         type = parameter.type
@@ -254,8 +281,9 @@
 
     header_includes = []
     for header in sorted(headers):
-        if header in header_conditions and not None in header_conditions[header]:
-            header_include = '#if %s\n' % ' || '.join(set(header_conditions[header]))
+        conditions = conditions_for_header(header)
+        if conditions and not None in conditions:
+            header_include = '#if %s\n' % ' || '.join(set(conditions))
             header_include += '#include %s\n' % header
             header_include += '#endif\n'
             header_includes.append(header_include)
@@ -265,9 +293,95 @@
     return (forward_declarations, header_includes)
 
 
-def generate_messages_header(file):
-    receiver = parser.parse(file)
+def forward_declarations_and_headers_for_replies(receiver):
+    types_by_namespace = collections.defaultdict(set)
 
+    headers = set([
+        '<wtf/Forward.h>',
+    ])
+
+    non_template_wtf_types = frozenset([
+        'MachSendRight',
+        'String',
+    ])
+
+    no_forward_declaration_types = types_that_cannot_be_forward_declared()
+    for message in receiver.messages:
+        if message.reply_parameters == None or not (message.has_attribute(SYNCHRONOUS_ATTRIBUTE) or message.has_attribute(ASYNC_ATTRIBUTE)):
+            continue
+
+        for parameter in message.reply_parameters:
+            kind = parameter.kind
+            type = parameter.type
+
+            if type.find('<') != -1 or type in no_forward_declaration_types:
+                # Don't forward declare class templates.
+                headers.update(headers_for_type(type))
+                continue
+
+            split = type.split('::')
+
+            # Handle WTF types even if the WTF:: prefix is not given
+            if split[0] in non_template_wtf_types:
+                split.insert(0, 'WTF')
+
+            if len(split) == 2:
+                namespace = split[0]
+                inner_type = split[1]
+                types_by_namespace[namespace].add((kind, inner_type))
+            elif len(split) > 2:
+                # We probably have a nested struct, which means we can't forward declare it.
+                # Include its header instead.
+                headers.update(headers_for_type(type))
+
+    forward_declarations = '\n'.join([forward_declarations_for_namespace(namespace, types) for (namespace, types) in sorted(types_by_namespace.items())])
+
+    header_includes = []
+    for header in sorted(headers):
+        conditions = conditions_for_header(header)
+        if conditions and not None in conditions:
+            header_include = '#if %s\n' % ' || '.join(set(conditions))
+            header_include += '#include %s\n' % header
+            header_include += '#endif\n'
+            header_includes.append(header_include)
+        else:
+            header_includes.append('#include %s\n' % header)
+
+    return (forward_declarations, header_includes)
+
+
+def generate_messages_reply_header(receiver):
+    result = []
+
+    result.append(_license_header)
+
+    result.append('#pragma once\n')
+    result.append('\n')
+
+    if receiver.condition:
+        result.append('#if %s\n\n' % receiver.condition)
+
+    forward_declarations, headers = forward_declarations_and_headers_for_replies(receiver)
+
+    result += headers
+    result.append('\n')
+
+    result.append(forward_declarations)
+    result.append('\n')
+
+    result.append('namespace Messages {\nnamespace %s {\n' % receiver.name)
+    result.append('\n')
+    result.append('\n'.join(filter(None, [message_to_reply_forward_declaration(x) for x in receiver.messages])))
+    result.append('\n')
+    result.append('} // namespace %s\n} // namespace Messages\n' % receiver.name)
+
+    if receiver.condition:
+        result.append('\n#endif // %s\n' % receiver.condition)
+
+    return ''.join(result)
+
+
+def generate_messages_header(receiver):
     result = []
 
     result.append(_license_header)
@@ -515,8 +629,7 @@
     return headers
 
 
-def generate_message_handler(file):
-    receiver = parser.parse(file)
+def generate_message_handler(receiver):
     header_conditions = {
         '"%s"' % messages_header_filename(receiver): [None],
         '"HandleMessage.h"': [None],
diff --git a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
index 91cf948..e5177d0 100644
--- a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
+++ b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
@@ -30,6 +30,7 @@
 
 #include "SharedRingBufferStorage.h"
 #include "UserMediaCaptureManagerMessages.h"
+#include "UserMediaCaptureManagerProxyMessages.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebProcessProxy.h"
 #include <WebCore/CARingBuffer.h>
diff --git a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
index 9bddb99..44460d4 100644
--- a/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
+++ b/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
@@ -30,7 +30,6 @@
 #include "Connection.h"
 #include "MessageReceiver.h"
 #include "UserMediaCaptureManager.h"
-#include "UserMediaCaptureManagerProxyMessages.h"
 #include <WebCore/RealtimeMediaSource.h>
 
 namespace WebKit {
diff --git a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
index 63b0f85..cd0b00e 100644
--- a/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
+++ b/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
@@ -28,7 +28,6 @@
 #include "APIObject.h"
 #include "Connection.h"
 #include "DownloadID.h"
-#include "DownloadProxyMessages.h"
 #include "SandboxExtension.h"
 #include <WebCore/ResourceRequest.h>
 #include <wtf/Forward.h>
diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
index 6c190529..125347b 100644
--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
@@ -39,6 +39,7 @@
 #include "NetworkProcessConnectionInfo.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
+#include "NetworkProcessProxyMessages.h"
 #include "SandboxExtension.h"
 #if HAVE(SEC_KEY_PROXY)
 #include "SecKeyProxyStore.h"
@@ -51,6 +52,7 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPool.h"
 #include "WebProcessProxy.h"
+#include "WebProcessProxyMessages.h"
 #include "WebResourceLoadStatisticsStore.h"
 #include "WebUserContentControllerProxy.h"
 #include "WebsiteData.h"
diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
index da4bed2..35e043e 100644
--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
@@ -26,21 +26,23 @@
 #pragma once
 
 #include "AuxiliaryProcessProxy.h"
-#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
-#include "LegacyCustomProtocolManagerProxy.h"
-#endif
-#include "NetworkProcessProxyMessages.h"
+#include "NetworkProcessProxyMessagesReplies.h"
 #include "ProcessLauncher.h"
 #include "ProcessThrottler.h"
 #include "ProcessThrottlerClient.h"
 #include "UserContentControllerIdentifier.h"
-#include "WebProcessProxyMessages.h"
+#include "WebProcessProxyMessagesReplies.h"
 #include "WebsiteDataStore.h"
 #include <WebCore/CrossSiteNavigationDataTransfer.h>
+#include <WebCore/FrameIdentifier.h>
 #include <WebCore/RegistrableDomain.h>
 #include <memory>
 #include <wtf/Deque.h>
 
+#if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
+#include "LegacyCustomProtocolManagerProxy.h"
+#endif
+
 namespace PAL {
 class SessionID;
 }
@@ -87,7 +89,7 @@
     explicit NetworkProcessProxy(WebProcessPool&);
     ~NetworkProcessProxy();
 
-    void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&);
+    void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnectionDelayedReply&&);
 
     DownloadProxy& createDownloadProxy(WebsiteDataStore&, const WebCore::ResourceRequest&);
 
@@ -169,7 +171,7 @@
     void syncAllCookies();
     void didSyncAllCookies();
 
-    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebPageProxyIdentifier, Messages::NetworkProcessProxy::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::DelayedReply&&);
+    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(WebPageProxyIdentifier, Messages::NetworkProcessProxy::TestProcessIncomingSyncMessagesWhenWaitingForSyncReplyDelayedReply&&);
 
     ProcessThrottler& throttler() { return m_throttler; }
     WebProcessPool& processPool() { return m_processPool; }
@@ -242,7 +244,7 @@
 #endif
 
 #if ENABLE(SANDBOX_EXTENSIONS)
-    void getSandboxExtensionsForBlobFiles(const Vector<String>& paths, Messages::NetworkProcessProxy::GetSandboxExtensionsForBlobFiles::AsyncReply&&);
+    void getSandboxExtensionsForBlobFiles(const Vector<String>& paths, Messages::NetworkProcessProxy::GetSandboxExtensionsForBlobFilesAsyncReply&&);
 #endif
 
 #if ENABLE(SERVICE_WORKER)
@@ -265,7 +267,7 @@
 
     struct ConnectionRequest {
         WeakPtr<WebProcessProxy> webProcess;
-        Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply reply;
+        Messages::WebProcessProxy::GetNetworkProcessConnectionDelayedReply reply;
     };
     uint64_t m_connectionRequestIdentifier { 0 };
     HashMap<uint64_t, ConnectionRequest> m_connectionRequests;
diff --git a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp
index 3782c84..e53af2f 100644
--- a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp
+++ b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp
@@ -29,6 +29,7 @@
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
 #include "PluginProcessProxy.h"
+#include "WebProcessProxyMessages.h"
 #include "WebsiteDataFetchOption.h"
 #include <wtf/CryptographicallyRandomNumber.h>
 #include <wtf/NeverDestroyed.h>
diff --git a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h
index 965cb22..930f0a1 100644
--- a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h
+++ b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.h
@@ -31,7 +31,7 @@
 #include "PluginProcess.h"
 #include "PluginProcessAttributes.h"
 #include "ProcessThrottler.h"
-#include "WebProcessProxyMessages.h"
+#include "WebProcessProxyMessagesReplies.h"
 #include <wtf/Forward.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
@@ -57,7 +57,7 @@
 
     uint64_t pluginProcessToken(const PluginModuleInfo&, PluginProcessType, PluginProcessSandboxPolicy);
 
-    void getPluginProcessConnection(uint64_t pluginProcessToken, Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply&&);
+    void getPluginProcessConnection(uint64_t pluginProcessToken, Messages::WebProcessProxy::GetPluginProcessConnectionDelayedReply&&);
     void removePluginProcessProxy(PluginProcessProxy*);
 
     void fetchWebsiteData(const PluginModuleInfo&, OptionSet<WebsiteDataFetchOption>, WTF::Function<void (Vector<String>)>&& completionHandler);
diff --git a/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h b/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
index 87b3f50..7219921 100644
--- a/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
+++ b/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
@@ -33,7 +33,7 @@
 #include "PluginProcess.h"
 #include "PluginProcessAttributes.h"
 #include "ProcessLauncher.h"
-#include "WebProcessProxyMessages.h"
+#include "WebProcessProxyMessagesReplies.h"
 #include <wtf/Deque.h>
 
 #if PLATFORM(COCOA)
@@ -71,7 +71,7 @@
 
     // Asks the plug-in process to create a new connection to a web process. The connection identifier will be
     // encoded in the given argument encoder and sent back to the connection of the given web process.
-    void getPluginProcessConnection(Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply&&);
+    void getPluginProcessConnection(Messages::WebProcessProxy::GetPluginProcessConnectionDelayedReply&&);
 
     void fetchWebsiteData(CompletionHandler<void (Vector<String>)>&&);
     void deleteWebsiteData(WallTime modifiedSince, CompletionHandler<void ()>&&);
@@ -143,7 +143,7 @@
     // The connection to the plug-in host process.
     RefPtr<IPC::Connection> m_connection;
 
-    Deque<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> m_pendingConnectionReplies;
+    Deque<Messages::WebProcessProxy::GetPluginProcessConnectionDelayedReply> m_pendingConnectionReplies;
 
     Vector<uint64_t> m_pendingFetchWebsiteDataRequests;
     HashMap<uint64_t, CompletionHandler<void (Vector<String>)>> m_pendingFetchWebsiteDataCallbacks;
diff --git a/Source/WebKit/UIProcess/ProvisionalPageProxy.h b/Source/WebKit/UIProcess/ProvisionalPageProxy.h
index d352513..6d9379c 100644
--- a/Source/WebKit/UIProcess/ProvisionalPageProxy.h
+++ b/Source/WebKit/UIProcess/ProvisionalPageProxy.h
@@ -28,7 +28,7 @@
 #include "MessageReceiver.h"
 #include "SandboxExtension.h"
 #include "WebFramePolicyListenerProxy.h"
-#include "WebPageProxyMessages.h"
+#include "WebPageProxyMessagesReplies.h"
 #include "WebsitePoliciesData.h"
 #include <WebCore/ResourceRequest.h>
 #include <wtf/WeakPtr.h>
@@ -112,7 +112,7 @@
     void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(SandboxExtension::Handle&&)>&&);
     void decidePolicyForNavigationActionSync(WebCore::FrameIdentifier, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&,
         FrameInfoData&&, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
-        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&);
 #if USE(QUICK_LOOK)
     void didRequestPasswordForQuickLookDocumentInMainFrame(const String& fileName);
 #endif
diff --git a/Source/WebKit/UIProcess/SuspendedPageProxy.h b/Source/WebKit/UIProcess/SuspendedPageProxy.h
index 764bedc..ee2c6a3 100644
--- a/Source/WebKit/UIProcess/SuspendedPageProxy.h
+++ b/Source/WebKit/UIProcess/SuspendedPageProxy.h
@@ -28,11 +28,15 @@
 #include "Connection.h"
 #include "ProcessThrottler.h"
 #include "WebBackForwardListItem.h"
-#include "WebPageProxyMessages.h"
+#include "WebPageProxyMessagesReplies.h"
 #include <WebCore/FrameIdentifier.h>
 #include <wtf/RefCounted.h>
 #include <wtf/WeakPtr.h>
 
+namespace WebCore {
+class RegistrableDomain;
+}
+
 namespace WebKit {
 
 class WebBackForwardCache;
diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index f9c7763..35f49ff 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -144,14 +144,13 @@
 #include <WebCore/DragData.h>
 #include <WebCore/ElementContext.h>
 #include <WebCore/EventNames.h>
+#include <WebCore/ExceptionDetails.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FocusDirection.h>
 #include <WebCore/FontAttributeChanges.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/GlobalFrameIdentifier.h>
 #include <WebCore/GlobalWindowIdentifier.h>
-#include <WebCore/JSDOMBinding.h>
-#include <WebCore/JSDOMExceptionHandling.h>
 #include <WebCore/LengthBox.h>
 #include <WebCore/MIMETypeRegistry.h>
 #include <WebCore/MediaStreamRequest.h>
diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h
index 84e755e..45817d7 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.h
+++ b/Source/WebKit/UIProcess/WebPageProxy.h
@@ -62,9 +62,9 @@
 #include "WebPageDiagnosticLoggingClient.h"
 #include "WebPageInjectedBundleClient.h"
 #include "WebPageProxyIdentifier.h"
+#include "WebPageProxyMessagesReplies.h"
 #include "WebPaymentCoordinatorProxy.h"
 #include "WebPreferences.h"
-#include "WebPageProxyMessages.h"
 #include "WebPopupMenuProxy.h"
 #include "WebUndoStepID.h"
 #include "WebsitePoliciesData.h"
@@ -173,8 +173,13 @@
 class URLRequest;
 }
 
+namespace Inspector {
+enum class InspectorTargetType : uint8_t;
+}
+
 namespace IPC {
 class Decoder;
+class FormDataReference;
 }
 
 namespace WebCore {
@@ -200,6 +205,7 @@
 enum class LockBackForwardList : bool;
 enum class HasInsecureContent : bool;
 enum class NotificationDirection : uint8_t;
+enum class RouteSharingPolicy : uint8_t;
 enum class ShouldSample : bool;
 enum class ShouldTreatAsContinuingLoad : bool;
 enum class WritingDirection : uint8_t;
@@ -209,9 +215,11 @@
 struct ContentRuleListResults;
 struct DataListSuggestionInformation;
 struct DictionaryPopupInfo;
+struct DragItem;
 struct ExceptionDetails;
 struct FileChooserSettings;
 struct GlobalWindowIdentifier;
+struct LinkIcon;
 struct MediaStreamRequest;
 struct MockWebAuthenticationConfiguration;
 struct PrewarmInformation;
@@ -290,19 +298,28 @@
 
 struct AttributedString;
 struct ColorSpaceData;
+struct DataDetectionResult;
 struct DocumentEditingContext;
 struct DocumentEditingContextRequest;
 struct EditingRange;
 struct EditorState;
+struct FocusedElementInformation;
 struct FontInfo;
 struct FrameInfoData;
 struct InsertTextOptions;
+struct InteractionInformationAtPosition;
 struct InteractionInformationRequest;
 struct LoadParameters;
+struct NavigationActionData;
 struct PlatformPopupMenuData;
 struct PrintInfo;
+struct PDFContextMenu;
 struct WebAutocorrectionData;
+struct WebHitTestResultData;
+struct WebNavigationDataStore;
 struct WebPopupItem;
+struct WebSelectionData;
+struct WebSpeechSynthesisVoice;
 struct URLSchemeTaskParameters;
 struct UserMessage;
 
@@ -1430,7 +1447,7 @@
 
     void setFocus(bool focused);
     void setWindowFrame(const WebCore::FloatRect&);
-    void getWindowFrame(Messages::WebPageProxy::GetWindowFrame::DelayedReply&&);
+    void getWindowFrame(Messages::WebPageProxy::GetWindowFrameDelayedReply&&);
     void getWindowFrameWithCallback(Function<void(WebCore::FloatRect)>&&);
 
     WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection();
@@ -1538,7 +1555,7 @@
     void backForwardGoToItemShared(Ref<WebProcessProxy>&&, const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(SandboxExtension::Handle&&)>&&);
     void decidePolicyForNavigationActionSyncShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&,
         FrameInfoData&&, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
-        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&);
 #if USE(QUICK_LOOK)
     void didRequestPasswordForQuickLookDocumentInMainFrameShared(Ref<WebProcessProxy>&&, const String& fileName);
 #endif
@@ -1679,7 +1696,7 @@
         WebCore::ResourceResponse&& redirectResponse, const UserData&, uint64_t listenerID);
     void decidePolicyForNavigationActionSync(WebCore::FrameIdentifier, bool isMainFrame, WebCore::SecurityOriginData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&,
         FrameInfoData&&, Optional<WebPageProxyIdentifier> originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&&, IPC::FormDataReference&& requestBody,
-        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&&);
+        WebCore::ResourceResponse&& redirectResponse, const UserData&, Messages::WebPageProxy::DecidePolicyForNavigationActionSyncDelayedReply&&);
     void decidePolicyForNewWindowAction(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, WebCore::PolicyCheckIdentifier, NavigationActionData&&,
         WebCore::ResourceRequest&&, const String& frameName, uint64_t listenerID, const UserData&);
     void decidePolicyForResponse(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, WebCore::PolicyCheckIdentifier, uint64_t navigationID,
@@ -1700,11 +1717,11 @@
     void didUpdateHistoryTitle(const String& title, const String& url, WebCore::FrameIdentifier);
 
     // UI client
-    void createNewPage(const FrameInfoData&, Optional<WebPageProxyIdentifier> originatingPageID, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, Messages::WebPageProxy::CreateNewPage::DelayedReply&&);
+    void createNewPage(const FrameInfoData&, Optional<WebPageProxyIdentifier> originatingPageID, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, Messages::WebPageProxy::CreateNewPageDelayedReply&&);
     void showPage();
-    void runJavaScriptAlert(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply&&);
-    void runJavaScriptConfirm(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply&&);
-    void runJavaScriptPrompt(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, const String&, Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply&&);
+    void runJavaScriptAlert(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptAlertDelayedReply&&);
+    void runJavaScriptConfirm(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, Messages::WebPageProxy::RunJavaScriptConfirmDelayedReply&&);
+    void runJavaScriptPrompt(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String&, const String&, Messages::WebPageProxy::RunJavaScriptPromptDelayedReply&&);
     void setStatusText(const String&);
     void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&);
 
@@ -1712,29 +1729,29 @@
     void unavailablePluginButtonClicked(uint32_t opaquePluginUnavailabilityReason, const String& mimeType, const String& pluginURLString, const String& pluginsPageURLString, const String& frameURLString, const String& pageURLString);
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(WEBGL)
-    void webGLPolicyForURL(URL&&, Messages::WebPageProxy::WebGLPolicyForURL::DelayedReply&&);
-    void resolveWebGLPolicyForURL(URL&&, Messages::WebPageProxy::ResolveWebGLPolicyForURL::DelayedReply&&);
+    void webGLPolicyForURL(URL&&, Messages::WebPageProxy::WebGLPolicyForURLDelayedReply&&);
+    void resolveWebGLPolicyForURL(URL&&, Messages::WebPageProxy::ResolveWebGLPolicyForURLDelayedReply&&);
 #endif // ENABLE(WEBGL)
     void setToolbarsAreVisible(bool toolbarsAreVisible);
-    void getToolbarsAreVisible(Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply&&);
+    void getToolbarsAreVisible(Messages::WebPageProxy::GetToolbarsAreVisibleDelayedReply&&);
     void setMenuBarIsVisible(bool menuBarIsVisible);
-    void getMenuBarIsVisible(Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply&&);
+    void getMenuBarIsVisible(Messages::WebPageProxy::GetMenuBarIsVisibleDelayedReply&&);
     void setStatusBarIsVisible(bool statusBarIsVisible);
-    void getStatusBarIsVisible(Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply&&);
+    void getStatusBarIsVisible(Messages::WebPageProxy::GetStatusBarIsVisibleDelayedReply&&);
     void getIsViewVisible(bool&);
     void setIsResizable(bool isResizable);
-    void screenToRootView(const WebCore::IntPoint& screenPoint, Messages::WebPageProxy::ScreenToRootView::DelayedReply&&);
-    void rootViewToScreen(const WebCore::IntRect& viewRect, Messages::WebPageProxy::RootViewToScreen::DelayedReply&&);
+    void screenToRootView(const WebCore::IntPoint& screenPoint, Messages::WebPageProxy::ScreenToRootViewDelayedReply&&);
+    void rootViewToScreen(const WebCore::IntRect& viewRect, Messages::WebPageProxy::RootViewToScreenDelayedReply&&);
     void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, CompletionHandler<void(WebCore::IntPoint)>&&);
     void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, CompletionHandler<void(WebCore::IntRect)>&&);
-    void runBeforeUnloadConfirmPanel(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String& message, Messages::WebPageProxy::RunBeforeUnloadConfirmPanel::DelayedReply&&);
+    void runBeforeUnloadConfirmPanel(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const String& message, Messages::WebPageProxy::RunBeforeUnloadConfirmPanelDelayedReply&&);
     void didChangeViewportProperties(const WebCore::ViewportAttributes&);
     void pageDidScroll();
     void runOpenPanel(WebCore::FrameIdentifier, const WebCore::SecurityOriginData&, const WebCore::FileChooserSettings&);
     void showShareSheet(const WebCore::ShareDataWithParsedURL&, ShareSheetCallbackID);
     void printFrame(WebCore::FrameIdentifier, CompletionHandler<void()>&&);
-    void exceededDatabaseQuota(WebCore::FrameIdentifier, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply&&);
-    void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply&&);
+    void exceededDatabaseQuota(WebCore::FrameIdentifier, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, Messages::WebPageProxy::ExceededDatabaseQuotaDelayedReply&&);
+    void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, Messages::WebPageProxy::ReachedApplicationCacheOriginQuotaDelayedReply&&);
     void requestGeolocationPermissionForFrame(uint64_t geolocationID, WebCore::FrameIdentifier, String originIdentifier);
 
 #if PLATFORM(GTK) || PLATFORM(WPE)
@@ -2021,7 +2038,7 @@
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, Messages::WebPageProxy::FindPlugin::DelayedReply&&);
+    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, Messages::WebPageProxy::FindPluginDelayedReply&&);
 #endif
 
 #if USE(QUICK_LOOK)
@@ -2058,7 +2075,7 @@
 
     void startURLSchemeTask(URLSchemeTaskParameters&&);
     void stopURLSchemeTask(uint64_t handlerIdentifier, uint64_t taskIdentifier);
-    void loadSynchronousURLSchemeTask(URLSchemeTaskParameters&&, Messages::WebPageProxy::LoadSynchronousURLSchemeTask::DelayedReply&&);
+    void loadSynchronousURLSchemeTask(URLSchemeTaskParameters&&, Messages::WebPageProxy::LoadSynchronousURLSchemeTaskDelayedReply&&);
 
     bool checkURLReceivedFromCurrentOrPreviousWebProcess(WebProcessProxy&, const String&);
     bool checkURLReceivedFromCurrentOrPreviousWebProcess(WebProcessProxy&, const URL&);
diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp
index 57d7c07..65481a4 100644
--- a/Source/WebKit/UIProcess/WebProcessPool.cpp
+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp
@@ -77,6 +77,7 @@
 #include "WebProcessMessages.h"
 #include "WebProcessPoolMessages.h"
 #include "WebProcessProxy.h"
+#include "WebProcessProxyMessages.h"
 #include "WebsiteDataStore.h"
 #include "WebsiteDataStoreParameters.h"
 #include <JavaScriptCore/JSCInlines.h>
diff --git a/Source/WebKit/UIProcess/WebProcessPool.h b/Source/WebKit/UIProcess/WebProcessPool.h
index c783044..04ccc96 100644
--- a/Source/WebKit/UIProcess/WebProcessPool.h
+++ b/Source/WebKit/UIProcess/WebProcessPool.h
@@ -381,9 +381,9 @@
     // Network Process Management
     NetworkProcessProxy& ensureNetworkProcess(WebsiteDataStore* withWebsiteDataStore = nullptr);
     NetworkProcessProxy* networkProcess() { return m_networkProcess.get(); }
-    void networkProcessCrashed(NetworkProcessProxy&, Vector<std::pair<RefPtr<WebProcessProxy>, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>>&&);
+    void networkProcessCrashed(NetworkProcessProxy&, Vector<std::pair<RefPtr<WebProcessProxy>, Messages::WebProcessProxy::GetNetworkProcessConnectionDelayedReply>>&&);
 
-    void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&);
+    void getNetworkProcessConnection(WebProcessProxy&, Messages::WebProcessProxy::GetNetworkProcessConnectionDelayedReply&&);
 
     bool isServiceWorkerPageID(WebPageProxyIdentifier) const;
 #if ENABLE(SERVICE_WORKER)
diff --git a/Source/WebKit/UIProcess/WebProcessProxy.h b/Source/WebKit/UIProcess/WebProcessProxy.h
index 967cdb7..befe1bd 100644
--- a/Source/WebKit/UIProcess/WebProcessProxy.h
+++ b/Source/WebKit/UIProcess/WebProcessProxy.h
@@ -38,7 +38,7 @@
 #include "VisibleWebPageCounter.h"
 #include "WebConnectionToWebProcess.h"
 #include "WebPageProxyIdentifier.h"
-#include "WebProcessProxyMessages.h"
+#include "WebProcessProxyMessagesReplies.h"
 #include <WebCore/FrameIdentifier.h>
 #include <WebCore/PageIdentifier.h>
 #include <WebCore/ProcessIdentifier.h>
@@ -61,6 +61,7 @@
 class DeferrableOneShotTimer;
 class ResourceRequest;
 struct PluginInfo;
+struct PrewarmInformation;
 struct SecurityOriginData;
 }
 
@@ -80,6 +81,7 @@
 class WebUserContentControllerProxy;
 class WebsiteDataStore;
 enum class WebsiteDataType;
+struct BackForwardListItemState;
 struct UserMessage;
 struct WebNavigationDataStore;
 struct WebPageCreationParameters;
@@ -380,12 +382,12 @@
     void getPlugins(bool refresh, CompletionHandler<void(Vector<WebCore::PluginInfo>&& plugins, Vector<WebCore::PluginInfo>&& applicationPlugins, Optional<Vector<WebCore::SupportedPluginIdentifier>>&&)>&&);
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void getPluginProcessConnection(uint64_t pluginProcessToken, Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply&&);
+    void getPluginProcessConnection(uint64_t pluginProcessToken, Messages::WebProcessProxy::GetPluginProcessConnectionDelayedReply&&);
 #endif
     void addPlugInAutoStartOriginHash(String&& pageOrigin, uint32_t hash);
     void plugInDidReceiveUserInteraction(uint32_t hash);
     
-    void getNetworkProcessConnection(Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply&&);
+    void getNetworkProcessConnection(Messages::WebProcessProxy::GetNetworkProcessConnectionDelayedReply&&);
 
     bool platformIsBeingDebugged() const;
     bool shouldAllowNonValidInjectedCode() const;
diff --git a/Source/WebKit/UIProcess/ios/WKContentView.mm b/Source/WebKit/UIProcess/ios/WKContentView.mm
index 621ea93..95eae5c 100644
--- a/Source/WebKit/UIProcess/ios/WKContentView.mm
+++ b/Source/WebKit/UIProcess/ios/WKContentView.mm
@@ -49,6 +49,7 @@
 #import "WebFrameProxy.h"
 #import "WebKit2Initialize.h"
 #import "WebPageGroup.h"
+#import "WebPageProxyMessages.h"
 #import "WebProcessPool.h"
 #import "_WKFrameHandleInternal.h"
 #import "_WKWebViewPrintFormatterInternal.h"
diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
index 22a34eb..47f8425 100644
--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
@@ -76,6 +76,7 @@
 #import "WebEvent.h"
 #import "WebIOSEventFactory.h"
 #import "WebPageMessages.h"
+#import "WebPageProxyMessages.h"
 #import "WebProcessProxy.h"
 #import "_WKActivatedElementInfoInternal.h"
 #import "_WKElementAction.h"
diff --git a/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm b/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
index ca7b6c5..118e580 100644
--- a/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
+++ b/Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
@@ -33,6 +33,7 @@
 #import "DrawingAreaProxyMessages.h"
 #import "LayerTreeContext.h"
 #import "WebPageProxy.h"
+#import "WebPageProxyMessages.h"
 #import "WebProcessProxy.h"
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <wtf/BlockPtr.h>
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
index d557c17..d424fc1 100644
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -4547,7 +4547,6 @@
 		C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandleMessage.h; sourceTree = "<group>"; };
 		C0CE72DB1247E8F700BC0EC4 /* DerivedSources.make */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DerivedSources.make; sourceTree = "<group>"; };
 		C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-message-receiver.py"; sourceTree = "<group>"; };
-		C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-messages-header.py"; sourceTree = "<group>"; };
 		C0E3AA441209E2BA00A49D01 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Module.h; sourceTree = "<group>"; };
 		C0E3AA451209E2BA00A49D01 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Module.cpp; sourceTree = "<group>"; };
 		C0E3AA481209E45000A49D01 /* ModuleCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleCF.cpp; sourceTree = "<group>"; };
@@ -9012,7 +9011,6 @@
 				0FC0856E187CE0A900780D86 /* __init__.py */,
 				4157853021276B6F00DD3800 /* copy-webcontent-resources-to-private-headers.sh */,
 				C0CE73361247F70E00BC0EC4 /* generate-message-receiver.py */,
-				C0CE73371247F70E00BC0EC4 /* generate-messages-header.py */,
 				7CDE73A11F9DA41400390312 /* GeneratePreferences.rb */,
 				0FC0856F187CE0A900780D86 /* messages.py */,
 				0FC08570187CE0A900780D86 /* model.py */,
diff --git a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
index 6222808..4b4e2ee 100644
--- a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
+++ b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
@@ -43,6 +43,7 @@
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include "WebProcessPoolMessages.h"
+#include "WebSWContextManagerConnectionMessages.h"
 #include "WebSWServerToContextConnectionMessages.h"
 #include "WebServiceWorkerFetchTaskClient.h"
 #include "WebSocketProvider.h"
diff --git a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
index 247625e..bf8b47fbf 100644
--- a/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
+++ b/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
@@ -30,7 +30,7 @@
 #include "Connection.h"
 #include "MessageReceiver.h"
 #include "WebPageProxyIdentifier.h"
-#include "WebSWContextManagerConnectionMessages.h"
+#include "WebSWContextManagerConnectionMessagesReplies.h"
 #include <WebCore/EmptyFrameLoaderClient.h>
 #include <WebCore/SWContextManager.h>
 #include <WebCore/ServiceWorkerClientData.h>
@@ -89,7 +89,7 @@
     void fireActivateEvent(WebCore::ServiceWorkerIdentifier);
     void softUpdate(WebCore::ServiceWorkerIdentifier);
     void terminateWorker(WebCore::ServiceWorkerIdentifier);
-    void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Messages::WebSWContextManagerConnection::SyncTerminateWorker::DelayedReply&&);
+    void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Messages::WebSWContextManagerConnection::SyncTerminateWorkerDelayedReply&&);
     void findClientByIdentifierCompleted(uint64_t requestIdentifier, Optional<WebCore::ServiceWorkerClientData>&&, bool hasSecurityError);
     void matchAllCompleted(uint64_t matchAllRequestIdentifier, Vector<WebCore::ServiceWorkerClientData>&&);
     void claimCompleted(uint64_t claimRequestIdentifier);
diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h
index a6224f0..9468d31 100644
--- a/Source/WebKit/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h
@@ -48,9 +48,10 @@
 #include "ShareSheetCallbackID.h"
 #include "SharedMemory.h"
 #include "StorageNamespaceIdentifier.h"
+#include "TransactionID.h"
 #include "UserData.h"
 #include "WebBackForwardListProxy.h"
-#include "WebPageMessages.h"
+#include "WebPageMessagesReplies.h"
 #include "WebURLSchemeHandler.h"
 #include "WebUndoStepID.h"
 #include "WebUserContentController.h"
@@ -100,7 +101,6 @@
 
 #if PLATFORM(IOS_FAMILY)
 #include "GestureTypes.h"
-#include "WebPageMessages.h"
 #include <WebCore/IntPointHash.h>
 #include <WebCore/ViewportConfiguration.h>
 #include <WebCore/WKContentObservation.h>
@@ -175,7 +175,6 @@
 class SelectionRect;
 class SharedBuffer;
 class SubstituteData;
-class SyntheticEditingCommandType;
 class TextCheckingRequest;
 class VisiblePosition;
 
@@ -258,10 +257,13 @@
 
 enum FindOptions : uint16_t;
 enum class DragControllerAction : uint8_t;
+enum class SyntheticEditingCommandType : uint8_t;
 
 struct AttributedString;
 struct BackForwardListItemState;
 struct DataDetectionResult;
+struct DocumentEditingContext;
+struct DocumentEditingContextRequest;
 struct EditorState;
 struct FontInfo;
 struct InsertTextOptions;
@@ -879,7 +881,7 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
-    void computePagesForPrintingAndDrawToPDF(WebCore::FrameIdentifier, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply&&);
+    void computePagesForPrintingAndDrawToPDF(WebCore::FrameIdentifier, const PrintInfo&, CallbackID, Messages::WebPage::ComputePagesForPrintingAndDrawToPDFDelayedReply&&);
 #endif
 
     void drawToPDF(WebCore::FrameIdentifier, const Optional<WebCore::FloatRect>&, CallbackID);
@@ -1307,7 +1309,7 @@
     bool executeKeypressCommandsInternal(const Vector<WebCore::KeypressCommand>&, WebCore::KeyboardEvent*);
 #endif
 
-    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReply::DelayedReply&&);
+    void testProcessIncomingSyncMessagesWhenWaitingForSyncReply(Messages::WebPage::TestProcessIncomingSyncMessagesWhenWaitingForSyncReplyDelayedReply&&);
 
     void updateDrawingAreaLayerTreeFreezeState();
     bool markLayersVolatileImmediatelyIfPossible();
diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
index 6626c24..6673d63 100644
--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
@@ -55,6 +55,7 @@
 #import "WebCoreArgumentCoders.h"
 #import "WebFrame.h"
 #import "WebImage.h"
+#import "WebPageMessages.h"
 #import "WebPageProxyMessages.h"
 #import "WebPreviewLoaderClient.h"
 #import "WebProcess.h"
diff --git a/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp b/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp
index c2b5265..124de94 100644
--- a/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp
+++ b/Source/WebKit/WebProcess/WebPage/wpe/WebPageWPE.cpp
@@ -28,6 +28,7 @@
 
 #include "WebKitWebPageAccessibilityObject.h"
 #include "WebPageProxy.h"
+#include "WebPageProxyMessages.h"
 #include "WebPreferencesKeys.h"
 #include "WebPreferencesStore.h"
 #include <WebCore/NotImplemented.h>
diff --git a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
index cbbbacd..d040161 100644
--- a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
+++ b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
@@ -29,7 +29,7 @@
 
 #include "Connection.h"
 #include "MessageReceiver.h"
-#include "VideoFullscreenManagerMessages.h"
+#include "VideoFullscreenManagerMessagesReplies.h"
 #include <WebCore/EventListener.h>
 #include <WebCore/HTMLMediaElementEnums.h>
 #include <WebCore/PlatformCALayer.h>
@@ -154,7 +154,7 @@
     void setVideoLayerGravityEnum(uint64_t contextId, unsigned gravity);
     void fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
     void fullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible);
-    void requestRouteSharingPolicyAndContextUID(uint64_t contextId, Messages::VideoFullscreenManager::RequestRouteSharingPolicyAndContextUID::AsyncReply&&);
+    void requestRouteSharingPolicyAndContextUID(uint64_t contextId, Messages::VideoFullscreenManager::RequestRouteSharingPolicyAndContextUIDAsyncReply&&);
 
     WebPage* m_page;
     Ref<PlaybackSessionManager> m_playbackSessionManager;
diff --git a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
index 5300073..ac4032a 100644
--- a/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
+++ b/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
@@ -31,6 +31,7 @@
 #import "LayerHostingContext.h"
 #import "Logging.h"
 #import "PlaybackSessionManager.h"
+#import "VideoFullscreenManagerMessages.h"
 #import "VideoFullscreenManagerProxyMessages.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebPage.h"