Title: [288972] trunk/Source
Revision
288972
Author
[email protected]
Date
2022-02-02 11:13:21 -0800 (Wed, 02 Feb 2022)

Log Message

Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider
https://bugs.webkit.org/show_bug.cgi?id=236016

Reviewed by Youenn Fablet.

Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider so that they can be reused by Shared Workers.

Source/WebCore:

* loader/FrameLoaderClient.h:

Source/WebKit:

* Platform/Logging.h:
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
* WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp: Added.
(WebKit::RemoteWorkerFrameLoaderClient::RemoteWorkerFrameLoaderClient):
(WebKit::RemoteWorkerFrameLoaderClient::createDocumentLoader):
* WebProcess/Storage/RemoteWorkerFrameLoaderClient.h: Added.
(isType):
* WebProcess/Storage/RemoteWorkerLibWebRTCProvider.h: Added.
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::installServiceWorker):
(WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
(): Deleted.
(WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient): Deleted.
(WebKit::ServiceWorkerFrameLoaderClient::createDocumentLoader): Deleted.
* WebProcess/Storage/WebSWContextManagerConnection.h:
(isType): Deleted.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288971 => 288972)


--- trunk/Source/WebCore/ChangeLog	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebCore/ChangeLog	2022-02-02 19:13:21 UTC (rev 288972)
@@ -1,3 +1,14 @@
+2022-02-02  Chris Dumez  <[email protected]>
+
+        Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider
+        https://bugs.webkit.org/show_bug.cgi?id=236016
+
+        Reviewed by Youenn Fablet.
+
+        Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider so that they can be reused by Shared Workers.
+
+        * loader/FrameLoaderClient.h:
+
 2022-02-02  Philippe Normand  <[email protected]>
 
         [GStreamer] Generate webrtc encoder src pad template based on supported platform encoders

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (288971 => 288972)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2022-02-02 19:13:21 UTC (rev 288972)
@@ -351,7 +351,7 @@
 
     // FIXME (bug 116233): We need to get rid of EmptyFrameLoaderClient completely, then this will no longer be needed.
     virtual bool isEmptyFrameLoaderClient() const { return false; }
-    virtual bool isServiceWorkerFrameLoaderClient() const { return false; }
+    virtual bool isRemoteWorkerFrameLoaderClient() const { return false; }
 
 #if USE(QUICK_LOOK)
     virtual RefPtr<LegacyPreviewLoaderClient> createPreviewLoaderClient(const String&, const String&) = 0;

Modified: trunk/Source/WebKit/ChangeLog (288971 => 288972)


--- trunk/Source/WebKit/ChangeLog	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/ChangeLog	2022-02-02 19:13:21 UTC (rev 288972)
@@ -1,3 +1,32 @@
+2022-02-02  Chris Dumez  <[email protected]>
+
+        Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider
+        https://bugs.webkit.org/show_bug.cgi?id=236016
+
+        Reviewed by Youenn Fablet.
+
+        Move and rename ServiceWorkerFrameLoaderClient & ServiceWorkerLibWebRTCProvider so that they can be reused by Shared Workers.
+
+        * Platform/Logging.h:
+        * Sources.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Network/WebLoaderStrategy.cpp:
+        (WebKit::WebLoaderStrategy::scheduleLoad):
+        * WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp: Added.
+        (WebKit::RemoteWorkerFrameLoaderClient::RemoteWorkerFrameLoaderClient):
+        (WebKit::RemoteWorkerFrameLoaderClient::createDocumentLoader):
+        * WebProcess/Storage/RemoteWorkerFrameLoaderClient.h: Added.
+        (isType):
+        * WebProcess/Storage/RemoteWorkerLibWebRTCProvider.h: Added.
+        * WebProcess/Storage/WebSWContextManagerConnection.cpp:
+        (WebKit::WebSWContextManagerConnection::installServiceWorker):
+        (WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
+        (): Deleted.
+        (WebKit::ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient): Deleted.
+        (WebKit::ServiceWorkerFrameLoaderClient::createDocumentLoader): Deleted.
+        * WebProcess/Storage/WebSWContextManagerConnection.h:
+        (isType): Deleted.
+
 2022-02-02  Wenson Hsieh  <[email protected]>
 
         Unreviewed, fix the macOS build after r288956

Modified: trunk/Source/WebKit/Platform/Logging.h (288971 => 288972)


--- trunk/Source/WebKit/Platform/Logging.h	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/Platform/Logging.h	2022-02-02 19:13:21 UTC (rev 288972)
@@ -111,6 +111,7 @@
     M(WebGL) \
     M(WebRTC) \
     M(WheelEvents) \
+    M(Worker) \
     M(XR) \
 
 WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL)

Modified: trunk/Source/WebKit/Sources.txt (288971 => 288972)


--- trunk/Source/WebKit/Sources.txt	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/Sources.txt	2022-02-02 19:13:21 UTC (rev 288972)
@@ -777,6 +777,7 @@
 
 WebProcess/Speech/SpeechRecognitionRealtimeMediaSourceManager.cpp
 
+WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp
 WebProcess/Storage/WebSWClientConnection.cpp
 WebProcess/Storage/WebSWContextManagerConnection.cpp
 WebProcess/Storage/WebSWOriginTable.cpp

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (288971 => 288972)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-02 19:13:21 UTC (rev 288972)
@@ -897,6 +897,8 @@
 		46BEB6DF22FBB16B00269867 /* SessionStorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BEB6DD22FBB16B00269867 /* SessionStorageNamespace.h */; };
 		46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 46BEB6E122FBB21A00269867 /* TransientLocalStorageNamespace.h */; };
 		46C392292316EC4D008EED9B /* WebPageProxyIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */; };
+		46C5B7CE27AADDD3000C5B47 /* RemoteWorkerFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C5B7CD27AADDBE000C5B47 /* RemoteWorkerFrameLoaderClient.h */; };
+		46C5B7CF27AADDD6000C5B47 /* RemoteWorkerLibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C5B7CB27AADDBE000C5B47 /* RemoteWorkerLibWebRTCProvider.h */; };
 		46CE3B1123D8C8490016A96A /* WebBackForwardListCounts.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CE3B1023D8C83D0016A96A /* WebBackForwardListCounts.h */; };
 		46DF063C1F3905F8001980BB /* NetworkCORSPreflightChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */; };
 		46EE2849269E04AC00DD48AB /* WebBroadcastChannelRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EE2848269E049B00DD48AB /* WebBroadcastChannelRegistry.h */; };
@@ -4264,6 +4266,9 @@
 		46BEB6E122FBB21A00269867 /* TransientLocalStorageNamespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TransientLocalStorageNamespace.h; sourceTree = "<group>"; };
 		46BEB6E222FBB21A00269867 /* TransientLocalStorageNamespace.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TransientLocalStorageNamespace.cpp; sourceTree = "<group>"; };
 		46C392282316EC4D008EED9B /* WebPageProxyIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebPageProxyIdentifier.h; sourceTree = "<group>"; };
+		46C5B7CB27AADDBE000C5B47 /* RemoteWorkerLibWebRTCProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteWorkerLibWebRTCProvider.h; sourceTree = "<group>"; };
+		46C5B7CC27AADDBE000C5B47 /* RemoteWorkerFrameLoaderClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteWorkerFrameLoaderClient.cpp; sourceTree = "<group>"; };
+		46C5B7CD27AADDBE000C5B47 /* RemoteWorkerFrameLoaderClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteWorkerFrameLoaderClient.h; sourceTree = "<group>"; };
 		46CE3B1023D8C83D0016A96A /* WebBackForwardListCounts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListCounts.h; sourceTree = "<group>"; };
 		46DF06391F3905E5001980BB /* NetworkCORSPreflightChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkCORSPreflightChecker.cpp; sourceTree = "<group>"; };
 		46DF063A1F3905E5001980BB /* NetworkCORSPreflightChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkCORSPreflightChecker.h; sourceTree = "<group>"; };
@@ -7216,6 +7221,7 @@
 				7AFBD36E21E546E3005DBACB /* PersistencyUtils.cpp */,
 				7AFBD36D21E546E3005DBACB /* PersistencyUtils.h */,
 				BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */,
+				BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */,
 				49ECA41B23FCA4860023358D /* PolicyDecision.h */,
 				E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */,
 				E1CC1B8E12D7EADF00625838 /* PrintInfo.h */,
@@ -7235,7 +7241,6 @@
 				2D65D196274B8E84009C4101 /* ScrollingAccelerationCurve.cpp */,
 				2D65D195274B8E84009C4101 /* ScrollingAccelerationCurve.h */,
 				5C80B3DD23690F100086E6DE /* ServiceWorkerInitializationData.cpp */,
-				BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */,
 				5C80B3DB23690D8D0086E6DE /* ServiceWorkerInitializationData.h */,
 				1AFDE6571954A42B00C48FFA /* SessionState.cpp */,
 				1AFDE6581954A42B00C48FFA /* SessionState.h */,
@@ -9440,6 +9445,9 @@
 		5118E9981F295259003EF9F5 /* Storage */ = {
 			isa = PBXGroup;
 			children = (
+				46C5B7CC27AADDBE000C5B47 /* RemoteWorkerFrameLoaderClient.cpp */,
+				46C5B7CD27AADDBE000C5B47 /* RemoteWorkerFrameLoaderClient.h */,
+				46C5B7CB27AADDBE000C5B47 /* RemoteWorkerLibWebRTCProvider.h */,
 				4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */,
 				419ACF9B1F981D26009F1A83 /* WebServiceWorkerFetchTaskClient.h */,
 				51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */,
@@ -13291,6 +13299,8 @@
 				A55BA8171BA23E12007CD33D /* RemoteWebInspectorUI.h in Headers */,
 				A55BA81F1BA25B27007CD33D /* RemoteWebInspectorUIProxy.h in Headers */,
 				A55BA8251BA25CFB007CD33D /* RemoteWebInspectorUIProxyMessages.h in Headers */,
+				46C5B7CE27AADDD3000C5B47 /* RemoteWorkerFrameLoaderClient.h in Headers */,
+				46C5B7CF27AADDD6000C5B47 /* RemoteWorkerLibWebRTCProvider.h in Headers */,
 				5CB7AFE723C6820700E49CF3 /* ResourceLoadInfo.h in Headers */,
 				6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */,
 				6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (288971 => 288972)


--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp	2022-02-02 19:13:21 UTC (rev 288972)
@@ -31,6 +31,7 @@
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcessConnection.h"
 #include "NetworkResourceLoadParameters.h"
+#include "RemoteWorkerFrameLoaderClient.h"
 #include "WebCompiledContentRuleList.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebDocumentLoader.h"
@@ -179,10 +180,8 @@
     WebResourceLoader::TrackingParameters trackingParameters;
     if (auto* webFrameLoaderClient = toWebFrameLoaderClient(frameLoaderClient))
         trackingParameters.webPageProxyID = valueOrDefault(webFrameLoaderClient->webPageProxyID());
-#if ENABLE(SERVICE_WORKER)
-    else if (is<ServiceWorkerFrameLoaderClient>(frameLoaderClient))
-        trackingParameters.webPageProxyID = downcast<ServiceWorkerFrameLoaderClient>(frameLoaderClient).webPageProxyID();
-#endif
+    else if (is<RemoteWorkerFrameLoaderClient>(frameLoaderClient))
+        trackingParameters.webPageProxyID = downcast<RemoteWorkerFrameLoaderClient>(frameLoaderClient).webPageProxyID();
     trackingParameters.pageID = valueOrDefault(frameLoaderClient.pageID());
     trackingParameters.frameID = valueOrDefault(frameLoaderClient.frameID());
     trackingParameters.resourceID = identifier;

Added: trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp (0 => 288972)


--- trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.cpp	2022-02-02 19:13:21 UTC (rev 288972)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 20217-2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteWorkerFrameLoaderClient.h"
+
+#include "Logging.h"
+#include "WebDocumentLoader.h"
+
+namespace WebKit {
+
+RemoteWorkerFrameLoaderClient::RemoteWorkerFrameLoaderClient(WebPageProxyIdentifier webPageProxyID, WebCore::PageIdentifier pageID, WebCore::FrameIdentifier frameID, const String& userAgent)
+    : m_webPageProxyID(webPageProxyID)
+    , m_pageID(pageID)
+    , m_frameID(frameID)
+    , m_userAgent(userAgent)
+{
+    RELEASE_LOG(Worker, "RemoteWorkerFrameLoaderClient::RemoteWorkerFrameLoaderClient webPageProxyID %" PRIu64 ", pageID %" PRIu64 ", frameID  %" PRIu64, webPageProxyID.toUInt64(), pageID.toUInt64(), frameID.toUInt64());
+}
+
+Ref<WebCore::DocumentLoader> RemoteWorkerFrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const WebCore::SubstituteData& substituteData)
+{
+    return WebDocumentLoader::create(request, substituteData);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.h (0 => 288972)


--- trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerFrameLoaderClient.h	2022-02-02 19:13:21 UTC (rev 288972)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "WebPageProxyIdentifier.h"
+#include <WebCore/EmptyFrameLoaderClient.h>
+
+namespace WebKit {
+
+class RemoteWorkerFrameLoaderClient final : public WebCore::EmptyFrameLoaderClient {
+public:
+    RemoteWorkerFrameLoaderClient(WebPageProxyIdentifier, WebCore::PageIdentifier, WebCore::FrameIdentifier, const String& userAgent);
+
+    WebPageProxyIdentifier webPageProxyID() const { return m_webPageProxyID; }
+
+    void setUserAgent(String&& userAgent) { m_userAgent = WTFMove(userAgent); }
+
+private:
+    Ref<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&) final;
+
+    std::optional<WebCore::PageIdentifier> pageID() const final { return m_pageID; }
+    std::optional<WebCore::FrameIdentifier> frameID() const final { return m_frameID; }
+
+    bool shouldUseCredentialStorage(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier) final { return true; }
+    bool isRemoteWorkerFrameLoaderClient() const final { return true; }
+
+    String userAgent(const URL&) const final { return m_userAgent; }
+
+    WebPageProxyIdentifier m_webPageProxyID;
+    WebCore::PageIdentifier m_pageID;
+    WebCore::FrameIdentifier m_frameID;
+    String m_userAgent;
+};
+
+} // namespace WebKit
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::RemoteWorkerFrameLoaderClient)
+    static bool isType(const WebCore::FrameLoaderClient& frameLoaderClient) { return frameLoaderClient.isRemoteWorkerFrameLoaderClient(); }
+SPECIALIZE_TYPE_TRAITS_END()

Added: trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerLibWebRTCProvider.h (0 => 288972)


--- trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerLibWebRTCProvider.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/RemoteWorkerLibWebRTCProvider.h	2022-02-02 19:13:21 UTC (rev 288972)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017-2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "RTCDataChannelRemoteManager.h"
+#include <WebCore/LibWebRTCProvider.h>
+
+namespace WebKit {
+
+#if ENABLE(WEB_RTC)
+class RemoteWorkerLibWebRTCProvider final : public WebCore::LibWebRTCProvider {
+public:
+    RemoteWorkerLibWebRTCProvider() = default;
+
+private:
+    RefPtr<WebCore::RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final { return &RTCDataChannelRemoteManager::sharedManager().remoteHandlerConnection(); }
+};
+#endif
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (288971 => 288972)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp	2022-02-02 19:13:21 UTC (rev 288972)
@@ -33,8 +33,9 @@
 #include "Logging.h"
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcessMessages.h"
-#include "RTCDataChannelRemoteManager.h"
 #include "RemoteWebLockRegistry.h"
+#include "RemoteWorkerFrameLoaderClient.h"
+#include "RemoteWorkerLibWebRTCProvider.h"
 #include "ServiceWorkerFetchTaskMessages.h"
 #include "ServiceWorkerInitializationData.h"
 #include "WebBroadcastChannelRegistry.h"
@@ -56,7 +57,6 @@
 #include "WebUserContentController.h"
 #include <WebCore/EditorClient.h>
 #include <WebCore/EmptyClients.h>
-#include <WebCore/LibWebRTCProvider.h>
 #include <WebCore/MessageWithMessagePorts.h>
 #include <WebCore/PageConfiguration.h>
 #include <WebCore/RuntimeEnabledFeatures.h>
@@ -76,31 +76,6 @@
 using namespace PAL;
 using namespace WebCore;
 
-
-#if ENABLE(WEB_RTC)
-class ServiceWorkerLibWebRTCProvider final : public WebCore::LibWebRTCProvider {
-public:
-    ServiceWorkerLibWebRTCProvider() = default;
-
-private:
-    RefPtr<WebCore::RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final { return &RTCDataChannelRemoteManager::sharedManager().remoteHandlerConnection(); }
-};
-#endif
-
-ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient(WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, FrameIdentifier frameID, const String& userAgent)
-    : m_webPageProxyID(webPageProxyID)
-    , m_pageID(pageID)
-    , m_frameID(frameID)
-    , m_userAgent(userAgent)
-{
-    RELEASE_LOG(ServiceWorker, "ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient webPageProxyID %llu, pageID %llu, frameID  %llu", webPageProxyID.toUInt64(), pageID.toUInt64(), frameID.toUInt64());
-}
-
-Ref<DocumentLoader> ServiceWorkerFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
-{
-    return WebDocumentLoader::create(request, substituteData);
-}
-
 WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, WebCore::RegistrableDomain&& registrableDomain, std::optional<WebCore::ScriptExecutionContextIdentifier> serviceWorkerPageIdentifier, PageGroupIdentifier pageGroupID, WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, const WebPreferencesStore& store, ServiceWorkerInitializationData&& initializationData)
     : m_connectionToNetworkProcess(WTFMove(connection))
     , m_registrableDomain(WTFMove(registrableDomain))
@@ -152,7 +127,7 @@
     pageConfiguration.webLockRegistry = WebProcess::singleton().webLockRegistry();
     pageConfiguration.userContentProvider = m_userContentController;
 #if ENABLE(WEB_RTC)
-    pageConfiguration.libWebRTCProvider = makeUniqueRef<ServiceWorkerLibWebRTCProvider>();
+    pageConfiguration.libWebRTCProvider = makeUniqueRef<RemoteWorkerLibWebRTCProvider>();
 #endif
 
     auto effectiveUserAgent =  WTFMove(userAgent);
@@ -159,7 +134,7 @@
     if (effectiveUserAgent.isNull())
         effectiveUserAgent = m_userAgent;
 
-    pageConfiguration.loaderClientForMainFrame = makeUniqueRef<ServiceWorkerFrameLoaderClient>(m_webPageProxyID, m_pageID, FrameIdentifier::generate(), effectiveUserAgent);
+    pageConfiguration.loaderClientForMainFrame = makeUniqueRef<RemoteWorkerFrameLoaderClient>(m_webPageProxyID, m_pageID, FrameIdentifier::generate(), effectiveUserAgent);
 
 #if !RELEASE_LOG_DISABLED
     auto serviceWorkerIdentifier = contextData.serviceWorkerIdentifier;
@@ -235,7 +210,7 @@
 void WebSWContextManagerConnection::continueDidReceiveFetchResponse(SWServerConnectionIdentifier serverConnectionIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, FetchIdentifier fetchIdentifier)
 {
     auto* serviceWorkerThreadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(serviceWorkerIdentifier);
-    RELEASE_LOG(ServiceWorker, "ServiceWorkerFrameLoaderClient::continueDidReceiveFetchResponse for service worker %llu, fetch identifier %llu, has service worker %d", serviceWorkerIdentifier.toUInt64(), fetchIdentifier.toUInt64(), !!serviceWorkerThreadProxy);
+    RELEASE_LOG(ServiceWorker, "WebSWContextManagerConnection::continueDidReceiveFetchResponse for service worker %llu, fetch identifier %llu, has service worker %d", serviceWorkerIdentifier.toUInt64(), fetchIdentifier.toUInt64(), !!serviceWorkerThreadProxy);
 
     if (serviceWorkerThreadProxy)
         serviceWorkerThreadProxy->continueDidReceiveFetchResponse(serverConnectionIdentifier, fetchIdentifier);

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (288971 => 288972)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h	2022-02-02 18:54:06 UTC (rev 288971)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h	2022-02-02 19:13:21 UTC (rev 288972)
@@ -37,7 +37,6 @@
 #include "WebPageProxyIdentifier.h"
 #include "WebPreferencesStore.h"
 #include "WebSWContextManagerConnectionMessagesReplies.h"
-#include <WebCore/EmptyFrameLoaderClient.h>
 #include <WebCore/SWContextManager.h>
 #include <WebCore/ServiceWorkerClientData.h>
 #include <WebCore/ServiceWorkerTypes.h>
@@ -56,9 +55,9 @@
 
 namespace WebKit {
 
-class ServiceWorkerFrameLoaderClient;
+class RemoteWorkerFrameLoaderClient;
+class WebUserContentController;
 struct ServiceWorkerInitializationData;
-class WebUserContentController;
 
 class WebSWContextManagerConnection final : public WebCore::SWContextManager::Connection, public IPC::MessageReceiver {
 public:
@@ -115,7 +114,7 @@
     WebPageProxyIdentifier m_webPageProxyID;
     WebCore::PageIdentifier m_pageID;
 
-    HashSet<std::unique_ptr<ServiceWorkerFrameLoaderClient>> m_loaders;
+    HashSet<std::unique_ptr<RemoteWorkerFrameLoaderClient>> m_loaders;
     HashMap<uint64_t, WebCore::ServiceWorkerClientsMatchAllCallback> m_matchAllRequests;
     uint64_t m_previousRequestIdentifier { 0 };
     String m_userAgent;
@@ -124,35 +123,6 @@
     std::optional<WebPreferencesStore> m_preferencesStore;
 };
 
-class ServiceWorkerFrameLoaderClient final : public WebCore::EmptyFrameLoaderClient {
-public:
-    ServiceWorkerFrameLoaderClient(WebPageProxyIdentifier, WebCore::PageIdentifier, WebCore::FrameIdentifier, const String& userAgent);
-
-    WebPageProxyIdentifier webPageProxyID() const { return m_webPageProxyID; }
-
-    void setUserAgent(String&& userAgent) { m_userAgent = WTFMove(userAgent); }
-
-private:
-    Ref<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&) final;
-
-    std::optional<WebCore::PageIdentifier> pageID() const final { return m_pageID; }
-    std::optional<WebCore::FrameIdentifier> frameID() const final { return m_frameID; }
-
-    bool shouldUseCredentialStorage(WebCore::DocumentLoader*, WebCore::ResourceLoaderIdentifier) final { return true; }
-    bool isServiceWorkerFrameLoaderClient() const final { return true; }
-
-    String userAgent(const URL&) const final { return m_userAgent; }
-
-    WebPageProxyIdentifier m_webPageProxyID;
-    WebCore::PageIdentifier m_pageID;
-    WebCore::FrameIdentifier m_frameID;
-    String m_userAgent;
-};
-
 } // namespace WebKit
 
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::ServiceWorkerFrameLoaderClient)
-    static bool isType(const WebCore::FrameLoaderClient& frameLoaderClient) { return frameLoaderClient.isServiceWorkerFrameLoaderClient(); }
-SPECIALIZE_TYPE_TRAITS_END()
-
 #endif // ENABLE(SERVICE_WORKER)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to