Title: [284564] trunk/Source/WebKit
Revision
284564
Author
beid...@apple.com
Date
2021-10-20 13:32:37 -0700 (Wed, 20 Oct 2021)

Log Message

Factor out some Notifications-specific messages from WebPageProxy messages
https://bugs.webkit.org/show_bug.cgi?id=232021

Reviewed by Alex Christensen.

In a future patch, there will be a runtime switch where WebContent sometimes sends these Notification
related messages to an objecting in Networking, and othertimes sends them to a WebPageProxy in the UIProcess.

To accomodate this switch, let's split them out into their own Notifications specific object and messages.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:

* Shared/Notifications/NotificationManagerMessageHandler.h: Added.
* Shared/Notifications/NotificationManagerMessageHandler.messages.in: Added.

* UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp: Added.
(WebKit::WebNotificationManagerMessageHandler::WebNotificationManagerMessageHandler):
(WebKit::WebNotificationManagerMessageHandler::showNotification):
(WebKit::WebNotificationManagerMessageHandler::cancelNotification):
(WebKit::WebNotificationManagerMessageHandler::clearNotifications):
(WebKit::WebNotificationManagerMessageHandler::didDestroyNotification):
* UIProcess/Notifications/WebNotificationManagerMessageHandler.h: Added.

* UIProcess/WebPageProxy.cpp:
(WebKit::m_notificationManagerMessageHandler):
(WebKit::WebPageProxy::addAllMessageReceivers):
(WebKit::WebPageProxy::removeAllMessageReceivers):
(WebKit::WebPageProxy::launchProcess):
(WebKit::WebPageProxy::swapToProvisionalPage):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::commitProvisionalPage):
(WebKit::m_limitsNavigationsToAppBoundDomains): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::show):
(WebKit::WebNotificationManager::cancel):
(WebKit::WebNotificationManager::clearNotifications):
(WebKit::WebNotificationManager::didDestroyNotification):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/CMakeLists.txt (284563 => 284564)


--- trunk/Source/WebKit/CMakeLists.txt	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/CMakeLists.txt	2021-10-20 20:32:37 UTC (rev 284564)
@@ -44,6 +44,7 @@
     "${WEBKIT_DIR}/Shared/Databases/IndexedDB"
     "${WEBKIT_DIR}/Shared/FileAPI"
     "${WEBKIT_DIR}/Shared/Gamepad"
+    "${WEBKIT_DIR}/Shared/Notifications"
     "${WEBKIT_DIR}/Shared/Plugins"
     "${WEBKIT_DIR}/Shared/Plugins/Netscape"
     "${WEBKIT_DIR}/Shared/Plugins/Netscape/x11"
@@ -192,6 +193,8 @@
 
     Shared/Authentication/AuthenticationManager
 
+    Shared/Notifications/NotificationManagerMessageHandler
+
     Shared/Plugins/NPObjectMessageReceiver
 
     UIProcess/DrawingAreaProxy

Modified: trunk/Source/WebKit/ChangeLog (284563 => 284564)


--- trunk/Source/WebKit/ChangeLog	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/ChangeLog	2021-10-20 20:32:37 UTC (rev 284564)
@@ -1,3 +1,51 @@
+2021-10-20  Brady Eidson  <beid...@apple.com>
+
+        Factor out some Notifications-specific messages from WebPageProxy messages
+        https://bugs.webkit.org/show_bug.cgi?id=232021
+
+        Reviewed by Alex Christensen.
+
+        In a future patch, there will be a runtime switch where WebContent sometimes sends these Notification
+        related messages to an objecting in Networking, and othertimes sends them to a WebPageProxy in the UIProcess.
+
+        To accomodate this switch, let's split them out into their own Notifications specific object and messages.
+        
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+
+        * Shared/Notifications/NotificationManagerMessageHandler.h: Added.
+        * Shared/Notifications/NotificationManagerMessageHandler.messages.in: Added.
+
+        * UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp: Added.
+        (WebKit::WebNotificationManagerMessageHandler::WebNotificationManagerMessageHandler):
+        (WebKit::WebNotificationManagerMessageHandler::showNotification):
+        (WebKit::WebNotificationManagerMessageHandler::cancelNotification):
+        (WebKit::WebNotificationManagerMessageHandler::clearNotifications):
+        (WebKit::WebNotificationManagerMessageHandler::didDestroyNotification):
+        * UIProcess/Notifications/WebNotificationManagerMessageHandler.h: Added.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::m_notificationManagerMessageHandler):
+        (WebKit::WebPageProxy::addAllMessageReceivers):
+        (WebKit::WebPageProxy::removeAllMessageReceivers):
+        (WebKit::WebPageProxy::launchProcess):
+        (WebKit::WebPageProxy::swapToProvisionalPage):
+        (WebKit::WebPageProxy::close):
+        (WebKit::WebPageProxy::commitProvisionalPage):
+        (WebKit::m_limitsNavigationsToAppBoundDomains): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::show):
+        (WebKit::WebNotificationManager::cancel):
+        (WebKit::WebNotificationManager::clearNotifications):
+        (WebKit::WebNotificationManager::didDestroyNotification):
+
 2021-10-20  David Kilzer  <ddkil...@apple.com>
 
         WebKit Objective-C classes should use weak delegates

Modified: trunk/Source/WebKit/DerivedSources-input.xcfilelist (284563 => 284564)


--- trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-10-20 20:32:37 UTC (rev 284564)
@@ -100,6 +100,8 @@
 $(PROJECT_DIR)/Shared/Authentication/AuthenticationManager.messages.in
 $(PROJECT_DIR)/Shared/AuxiliaryProcess.messages.in
 $(PROJECT_DIR)/Shared/HTTPSUpgrade/HTTPSUpgradeList.txt
+$(PROJECT_DIR)/Shared/Notifications/NotificationManagerMessageHandler.messages.in
+$(PROJECT_DIR)/Shared/Notifications/NotificationManagerProxy.messages.in
 $(PROJECT_DIR)/Shared/Plugins/NPObjectMessageReceiver.messages.in
 $(PROJECT_DIR)/Shared/WebConnection.messages.in
 $(PROJECT_DIR)/UIProcess/Automation/Automation.json

Modified: trunk/Source/WebKit/DerivedSources-output.xcfilelist (284563 => 284564)


--- trunk/Source/WebKit/DerivedSources-output.xcfilelist	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/DerivedSources-output.xcfilelist	2021-10-20 20:32:37 UTC (rev 284564)
@@ -115,6 +115,9 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NetworkStorageManagerMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NetworkStorageManagerMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NetworkStorageManagerMessagesReplies.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NotificationManagerMessageHandlerMessageReceiver.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NotificationManagerMessageHandlerMessages.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/NotificationManagerMessageHandlerMessagesReplies.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/PlatformXRSystemMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/PlatformXRSystemMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/PlatformXRSystemMessagesReplies.h

Modified: trunk/Source/WebKit/DerivedSources.make (284563 => 284564)


--- trunk/Source/WebKit/DerivedSources.make	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/DerivedSources.make	2021-10-20 20:32:37 UTC (rev 284564)
@@ -47,6 +47,7 @@
     $(WebKit2)/Shared/ApplePay \
     $(WebKit2)/Shared/Authentication \
     $(WebKit2)/Shared/mac \
+    $(WebKit2)/Shared/Notifications \
     $(WebKit2)/WebAuthnProcess \
     $(WebKit2)/WebAuthnProcess/mac \
     $(WebKit2)/WebProcess/ApplePay \
@@ -147,6 +148,7 @@
 	Shared/API/Cocoa/RemoteObjectRegistry \
 	Shared/ApplePay/WebPaymentCoordinatorProxy \
 	Shared/Authentication/AuthenticationManager \
+	Shared/Notifications/NotificationManagerMessageHandler \
 	Shared/WebConnection \
 	UIProcess/WebFullScreenManagerProxy \
 	UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy \

Added: trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h (0 => 284564)


--- trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.h	2021-10-20 20:32:37 UTC (rev 284564)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 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 "MessageReceiver.h"
+#include "WebPageProxyIdentifier.h"
+#include <WebCore/NotificationDirection.h>
+
+namespace WebKit {
+
+class NotificationManagerMessageHandler : public IPC::MessageReceiver {
+public:
+    virtual ~NotificationManagerMessageHandler() = default;
+
+    virtual void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& language, WebCore::NotificationDirection, const String& originString, uint64_t notificationID) = 0;
+    virtual void cancelNotification(uint64_t notificationID) = 0;
+    virtual void clearNotifications(const Vector<uint64_t>& notificationIDs) = 0;
+    virtual void didDestroyNotification(uint64_t notificationID) = 0;
+
+private:
+    // IPC::MessageReceiver
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
+};
+
+} // namespace WebKit

Added: trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in (0 => 284564)


--- trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Notifications/NotificationManagerMessageHandler.messages.in	2021-10-20 20:32:37 UTC (rev 284564)
@@ -0,0 +1,28 @@
+# Copyright (C) 2021 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.
+
+messages -> NotificationManagerMessageHandler NotRefCounted {
+    ShowNotification(String title, String body, String iconURL, String tag, String language, enum:uint8_t WebCore::NotificationDirection direction, String originIdentifier, uint64_t notificationID)
+    CancelNotification(uint64_t notificationID)
+    ClearNotifications(Vector<uint64_t> notificationIDs)
+    DidDestroyNotification(uint64_t notificationID)
+}

Modified: trunk/Source/WebKit/Sources.txt (284563 => 284564)


--- trunk/Source/WebKit/Sources.txt	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/Sources.txt	2021-10-20 20:32:37 UTC (rev 284564)
@@ -494,6 +494,7 @@
 UIProcess/Media/RemoteMediaSessionCoordinatorProxy.cpp
 
 UIProcess/Notifications/WebNotification.cpp
+UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp
 UIProcess/Notifications/WebNotificationManagerProxy.cpp
 UIProcess/Notifications/WebNotificationProvider.cpp
 

Added: trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp (0 => 284564)


--- trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.cpp	2021-10-20 20:32:37 UTC (rev 284564)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 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 "WebNotificationManagerMessageHandler.h"
+
+#include "WebPageProxy.h"
+
+namespace WebKit {
+
+WebNotificationManagerMessageHandler::WebNotificationManagerMessageHandler(WebPageProxy& webPageProxy)
+    : m_webPageProxy(webPageProxy)
+{
+}
+
+void WebNotificationManagerMessageHandler::showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& language, WebCore::NotificationDirection direction, const String& originString, uint64_t notificationID)
+{
+    m_webPageProxy.showNotification(title, body, iconURL, tag, language, direction, originString, notificationID);
+}
+
+void WebNotificationManagerMessageHandler::cancelNotification(uint64_t notificationID)
+{
+    m_webPageProxy.cancelNotification(notificationID);
+}
+
+void WebNotificationManagerMessageHandler::clearNotifications(const Vector<uint64_t>& notificationIDs)
+{
+    m_webPageProxy.clearNotifications(notificationIDs);
+}
+
+void WebNotificationManagerMessageHandler::didDestroyNotification(uint64_t notificationID)
+{
+    m_webPageProxy.didDestroyNotification(notificationID);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h (0 => 284564)


--- trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/Notifications/WebNotificationManagerMessageHandler.h	2021-10-20 20:32:37 UTC (rev 284564)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2021 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 "NotificationManagerMessageHandler.h"
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebNotificationManagerMessageHandler : public NotificationManagerMessageHandler {
+    friend class WebPageProxy;
+private:
+    explicit WebNotificationManagerMessageHandler(WebPageProxy&);
+
+    void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& language, WebCore::NotificationDirection, const String& originString, uint64_t notificationID) final;
+    void cancelNotification(uint64_t notificationID) final;
+    void clearNotifications(const Vector<uint64_t>& notificationIDs) final;
+    void didDestroyNotification(uint64_t notificationID) final;
+
+    WebPageProxy& m_webPageProxy;
+};
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (284563 => 284564)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-10-20 20:32:37 UTC (rev 284564)
@@ -77,6 +77,7 @@
 #include "NavigationActionData.h"
 #include "NetworkProcessMessages.h"
 #include "NetworkProcessProxy.h"
+#include "NotificationManagerMessageHandlerMessages.h"
 #include "NotificationPermissionRequest.h"
 #include "NotificationPermissionRequestManager.h"
 #include "PageClient.h"
@@ -516,6 +517,7 @@
     , m_ignoresAppBoundDomains(m_configuration->ignoresAppBoundDomains())
     , m_limitsNavigationsToAppBoundDomains(m_configuration->limitsNavigationsToAppBoundDomains())
 #endif
+    , m_notificationManagerMessageHandler(*this)
 {
     WEBPAGEPROXY_RELEASE_LOG(Loading, "constructor:");
 
@@ -546,7 +548,7 @@
     if (hasRunningProcess())
         didAttachToRunningProcess();
 
-    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
+    addAllMessageReceivers();
 
 #if PLATFORM(IOS_FAMILY)
     DeprecatedGlobalSettings::setDisableScreenSizeOverride(m_preferences->disableScreenSizeOverride());
@@ -620,6 +622,18 @@
 #endif
 }
 
+void WebPageProxy::addAllMessageReceivers()
+{
+    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
+    m_process->addMessageReceiver(Messages::NotificationManagerMessageHandler::messageReceiverName(), m_webPageID, m_notificationManagerMessageHandler);
+}
+
+void WebPageProxy::removeAllMessageReceivers()
+{
+    m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
+    m_process->removeMessageReceiver(Messages::NotificationManagerMessageHandler::messageReceiverName(), m_webPageID);
+}
+
 // FIXME: Should return a const PageClient& and add a separate non-const
 // version of this function, but several PageClient methods will need to become
 // const for this to be possible.
@@ -841,7 +855,7 @@
     m_inspector->reset();
 
     m_process->removeWebPage(*this, WebProcessProxy::EndsUsingDataStore::Yes);
-    m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
+    removeAllMessageReceivers();
 
     auto& processPool = m_process->processPool();
 
@@ -853,7 +867,7 @@
     m_hasRunningProcess = true;
 
     m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::Yes);
-    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
+    addAllMessageReceivers();
 
 #if ENABLE(IPC_TESTING_API)
     if (m_preferences->store().getBoolValueForKey(WebPreferencesKey::ipcTestingAPIEnabledKey()))
@@ -964,7 +978,7 @@
     m_mainFrame = provisionalPage->mainFrame();
 
     m_process->addExistingWebPage(*this, WebProcessProxy::BeginsUsingDataStore::No);
-    m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID, *this);
+    addAllMessageReceivers();
 
     finishAttachingToWebProcess(ProcessLaunchReason::ProcessSwap);
 
@@ -1192,7 +1206,7 @@
         protectedProcess->send(Messages::WebPage::Close(), destinationID);
     });
     m_process->removeWebPage(*this, WebProcessProxy::EndsUsingDataStore::Yes);
-    m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
+    removeAllMessageReceivers();
     m_process->processPool().supplement<WebNotificationManagerProxy>()->clearNotifications(this);
 
     // Null out related WebPageProxy to avoid leaks.
@@ -3613,7 +3627,7 @@
 
     resetStateAfterProcessTermination(ProcessTerminationReason::NavigationSwap);
 
-    m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
+    removeAllMessageReceivers();
     auto* navigation = navigationState().navigation(m_provisionalPage->navigationID());
     bool didSuspendPreviousPage = navigation && !m_provisionalPage->shouldClosePreviousPageAfterCommit() ? suspendCurrentPageIfPossible(*navigation, mainFrameIDInPreviousProcess, m_provisionalPage->processSwapRequestedByClient(), shouldDelayClosingUntilFirstLayerFlush) : false;
     m_process->removeWebPage(*this, m_websiteDataStore.ptr() == &m_provisionalPage->process().websiteDataStore() ? WebProcessProxy::EndsUsingDataStore::No : WebProcessProxy::EndsUsingDataStore::Yes);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (284563 => 284564)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-10-20 20:32:37 UTC (rev 284564)
@@ -69,6 +69,7 @@
 #include "WebCoreArgumentCoders.h"
 #include "WebDataListSuggestionsDropdown.h"
 #include "WebFrameProxy.h"
+#include "WebNotificationManagerMessageHandler.h"
 #include "WebPageCreationParameters.h"
 #include "WebPageDiagnosticLoggingClient.h"
 #include "WebPageInjectedBundleClient.h"
@@ -1990,10 +1991,18 @@
     bool isQuarantinedAndNotUserApproved(const String&);
 #endif
 
+    void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, WebCore::NotificationDirection, const String& originString, uint64_t notificationID);
+    void cancelNotification(uint64_t notificationID);
+    void clearNotifications(const Vector<uint64_t>& notificationIDs);
+    void didDestroyNotification(uint64_t notificationID);
+
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
     void platformInitialize();
 
+    void addAllMessageReceivers();
+    void removeAllMessageReceivers();
+
     void notifyProcessPoolToPrewarm();
     bool shouldUseBackForwardCache() const;
 
@@ -2185,10 +2194,6 @@
     RefPtr<API::Navigation> launchProcessForReload();
 
     void requestNotificationPermission(const String& originString, CompletionHandler<void(bool allowed)>&&);
-    void showNotification(const String& title, const String& body, const String& iconURL, const String& tag, const String& lang, WebCore::NotificationDirection, const String& originString, uint64_t notificationID);
-    void cancelNotification(uint64_t notificationID);
-    void clearNotifications(const Vector<uint64_t>& notificationIDs);
-    void didDestroyNotification(uint64_t notificationID);
 
     void didChangeContentSize(const WebCore::IntSize&);
     void didChangeIntrinsicContentSize(const WebCore::IntSize&);
@@ -3122,6 +3127,8 @@
 #endif
 
     WindowKind m_windowKind { WindowKind::Unparented };
+
+    WebNotificationManagerMessageHandler m_notificationManagerMessageHandler;
 };
 
 #ifdef __OBJC__

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (284563 => 284564)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-10-20 20:32:37 UTC (rev 284564)
@@ -285,10 +285,6 @@
 
     # Notification messages
     RequestNotificationPermission(String originIdentifier) -> (bool allowed) Async
-    ShowNotification(String title, String body, String iconURL, String tag, String lang, enum:uint8_t WebCore::NotificationDirection dir, String originIdentifier, uint64_t notificationID)
-    CancelNotification(uint64_t notificationID)
-    ClearNotifications(Vector<uint64_t> notificationIDs)
-    DidDestroyNotification(uint64_t notificationID)
 
     # Spelling and grammar messages
 #if USE(UNIFIED_TEXT_CHECKING)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (284563 => 284564)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-20 20:32:37 UTC (rev 284564)
@@ -1054,6 +1054,11 @@
 		513E462D1AD837560016234A /* WKSharingServicePickerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 513E462B1AD837560016234A /* WKSharingServicePickerDelegate.h */; };
 		513FFB91201459C6002596EA /* WebMessagePortChannelProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 513FFB8F201459C2002596EA /* WebMessagePortChannelProvider.h */; };
 		514129941C6428BB0059E714 /* WebIDBConnectionToServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 514129921C6428100059E714 /* WebIDBConnectionToServer.h */; };
+		514526FF271FB7EC000467B6 /* NotificationManagerMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 514526FE271FB7E8000467B6 /* NotificationManagerMessageHandler.h */; };
+		51452703271FBA3A000467B6 /* NotificationManagerMessageHandlerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51452702271FBA36000467B6 /* NotificationManagerMessageHandlerMessageReceiver.cpp */; };
+		51452704271FBA40000467B6 /* NotificationManagerMessageHandlerMessagesReplies.h in Headers */ = {isa = PBXBuildFile; fileRef = 51452700271FBA34000467B6 /* NotificationManagerMessageHandlerMessagesReplies.h */; };
+		51452705271FBA40000467B6 /* NotificationManagerMessageHandlerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51452701271FBA35000467B6 /* NotificationManagerMessageHandlerMessages.h */; };
+		51452708271FBEC6000467B6 /* WebNotificationManagerMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 51452707271FBEC1000467B6 /* WebNotificationManagerMessageHandler.h */; };
 		51489CC32370DBFA0044E68A /* WKFindResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 51489CC12370DACC0044E68A /* WKFindResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		51489CC7237237800044E68A /* WKFindResultInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51489CC6237237780044E68A /* WKFindResultInternal.h */; };
 		514AB9F02360D2A900EDC396 /* WKFindConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 514AB9EF235FA59B00EDC396 /* WKFindConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -4160,6 +4165,13 @@
 		514129921C6428100059E714 /* WebIDBConnectionToServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIDBConnectionToServer.h; sourceTree = "<group>"; };
 		5143B25E1DDCDFD10014FAC6 /* _WKIconLoadingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKIconLoadingDelegate.h; sourceTree = "<group>"; };
 		5143B2611DDD0DA00014FAC6 /* APIIconLoadingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIIconLoadingClient.h; sourceTree = "<group>"; };
+		514526FC271FB7E8000467B6 /* NotificationManagerMessageHandler.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NotificationManagerMessageHandler.messages.in; sourceTree = "<group>"; };
+		514526FE271FB7E8000467B6 /* NotificationManagerMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationManagerMessageHandler.h; sourceTree = "<group>"; };
+		51452700271FBA34000467B6 /* NotificationManagerMessageHandlerMessagesReplies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationManagerMessageHandlerMessagesReplies.h; sourceTree = "<group>"; };
+		51452701271FBA35000467B6 /* NotificationManagerMessageHandlerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationManagerMessageHandlerMessages.h; sourceTree = "<group>"; };
+		51452702271FBA36000467B6 /* NotificationManagerMessageHandlerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotificationManagerMessageHandlerMessageReceiver.cpp; sourceTree = "<group>"; };
+		51452706271FBEC1000467B6 /* WebNotificationManagerMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationManagerMessageHandler.cpp; sourceTree = "<group>"; };
+		51452707271FBEC1000467B6 /* WebNotificationManagerMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotificationManagerMessageHandler.h; sourceTree = "<group>"; };
 		51489CC12370DACC0044E68A /* WKFindResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindResult.h; sourceTree = "<group>"; };
 		51489CC22370DACC0044E68A /* WKFindResult.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKFindResult.mm; sourceTree = "<group>"; };
 		51489CC6237237780044E68A /* WKFindResultInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFindResultInternal.h; sourceTree = "<group>"; };
@@ -6939,6 +6951,7 @@
 				515BE1AE1D59003400DD7C68 /* Gamepad */,
 				2DA944961884E4DA00ED86DB /* ios */,
 				BC111B5A112F628200337BAB /* mac */,
+				51AF1B3D271F46A6001538E6 /* Notifications */,
 				1AAE058C1279DCD400852418 /* Plugins */,
 				2D2E04761F5BEC4F00BB25ED /* RemoteLayerTree */,
 				E3612FF026F90862007B1175 /* Sandbox */,
@@ -8137,6 +8150,8 @@
 				31A2EC531489982500810D71 /* NotificationPermissionRequest.h */,
 				31A2EC41148997BE00810D71 /* WebNotification.cpp */,
 				31A2EC42148997BE00810D71 /* WebNotification.h */,
+				51452706271FBEC1000467B6 /* WebNotificationManagerMessageHandler.cpp */,
+				51452707271FBEC1000467B6 /* WebNotificationManagerMessageHandler.h */,
 				31A2EC43148997BE00810D71 /* WebNotificationManagerProxy.cpp */,
 				31A2EC44148997BF00810D71 /* WebNotificationManagerProxy.h */,
 				31A2EC46148997C000810D71 /* WebNotificationProvider.cpp */,
@@ -9092,6 +9107,15 @@
 			path = Authentication;
 			sourceTree = "<group>";
 		};
+		51AF1B3D271F46A6001538E6 /* Notifications */ = {
+			isa = PBXGroup;
+			children = (
+				514526FE271FB7E8000467B6 /* NotificationManagerMessageHandler.h */,
+				514526FC271FB7E8000467B6 /* NotificationManagerMessageHandler.messages.in */,
+			);
+			path = Notifications;
+			sourceTree = "<group>";
+		};
 		51B15A7D138439B200321AD8 /* unix */ = {
 			isa = PBXGroup;
 			children = (
@@ -11477,6 +11501,9 @@
 				93085DCC26E2E902000EC6A7 /* NetworkStorageManagerMessageReceiver.cpp */,
 				93085DCD26E2E902000EC6A7 /* NetworkStorageManagerMessages.h */,
 				93085DCE26E2E902000EC6A7 /* NetworkStorageManagerMessagesReplies.h */,
+				51452702271FBA36000467B6 /* NotificationManagerMessageHandlerMessageReceiver.cpp */,
+				51452701271FBA35000467B6 /* NotificationManagerMessageHandlerMessages.h */,
+				51452700271FBA34000467B6 /* NotificationManagerMessageHandlerMessagesReplies.h */,
 				1A2D8437127F65D5001EB962 /* NPObjectMessageReceiverMessageReceiver.cpp */,
 				1A2D8438127F65D5001EB962 /* NPObjectMessageReceiverMessages.h */,
 				CDA29A241CBEB67A00901CCF /* PlaybackSessionManagerMessageReceiver.cpp */,
@@ -12485,6 +12512,7 @@
 				1A6D86C21DF75265007745E8 /* MachMessage.h in Headers */,
 				BCC56F791159957D001CCAF9 /* MachPort.h in Headers */,
 				1A24B5F311F531E800C38269 /* MachUtilities.h in Headers */,
+				514526FF271FB7EC000467B6 /* NotificationManagerMessageHandler.h in Headers */,
 				A15799BE2584433200528236 /* MediaFormatReader.h in Headers */,
 				9ACC07B125C815D800DC6386 /* MediaKeySystemPermissionRequest.h in Headers */,
 				9ACC07AD25C8132D00DC6386 /* MediaKeySystemPermissionRequestManager.h in Headers */,
@@ -12519,6 +12547,7 @@
 				1ADCB86B189831B30022EE5A /* NavigationActionData.h in Headers */,
 				57FD318022B35158008D0E8B /* NavigationSOAuthorizationSession.h in Headers */,
 				1ABC3DF61899E437004F0626 /* NavigationState.h in Headers */,
+				51452708271FBEC6000467B6 /* WebNotificationManagerMessageHandler.h in Headers */,
 				57B826442304F14000B72EB0 /* NearFieldSoftLink.h in Headers */,
 				57B826412304EB3E00B72EB0 /* NearFieldSPI.h in Headers */,
 				1A6FBA2A11E6862700DB1371 /* NetscapeBrowserFuncs.h in Headers */,
@@ -12551,6 +12580,7 @@
 				E47FC8A025B8331C005495FC /* NetworkLoadScheduler.h in Headers */,
 				5179556A162876F300FA43B6 /* NetworkProcess.h in Headers */,
 				517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */,
+				51452704271FBA40000467B6 /* NotificationManagerMessageHandlerMessagesReplies.h in Headers */,
 				5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */,
 				5163199516289A6300E22F00 /* NetworkProcessMessages.h in Headers */,
 				E14A954A16E016A40068DE82 /* NetworkProcessPlatformStrategies.h in Headers */,
@@ -12782,6 +12812,7 @@
 				9368EEDF2303A9ED00BDB11A /* StorageManagerSetMessages.h in Headers */,
 				465F4E06230B2E95003CEDB7 /* StorageNamespaceIdentifier.h in Headers */,
 				7B73123C25CC8525003B2796 /* StreamClientConnection.h in Headers */,
+				51452705271FBA40000467B6 /* NotificationManagerMessageHandlerMessages.h in Headers */,
 				7B73123A25CC8525003B2796 /* StreamConnectionBuffer.h in Headers */,
 				7B73124225CC8525003B2796 /* StreamConnectionEncoder.h in Headers */,
 				7B73123E25CC8525003B2796 /* StreamConnectionWorkQueue.h in Headers */,
@@ -12984,7 +13015,6 @@
 				31BA924E148831260062EDB5 /* WebNotificationManagerMessages.h in Headers */,
 				31A2EC4B148997C200810D71 /* WebNotificationManagerProxy.h in Headers */,
 				31A2EC4E148997C200810D71 /* WebNotificationProvider.h in Headers */,
-				5127148327024F0300197034 /* WebNotificationProviderCocoa.h in Headers */,
 				BC857F8512B82D0B00EDEB2E /* WebOpenPanelResultListener.h in Headers */,
 				BC1DFEA412B31F87005DF730 /* WebOpenPanelResultListenerProxy.h in Headers */,
 				BC032D8F10F437A00058C15A /* WebPage.h in Headers */,
@@ -14633,6 +14663,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				5790A67125679F1A0077C5A7 /* _WKAuthenticationExtensionsClientInputs.mm in Sources */,
+				51452703271FBA3A000467B6 /* NotificationManagerMessageHandlerMessageReceiver.cpp in Sources */,
 				5790A67D2567A13E0077C5A7 /* _WKAuthenticationExtensionsClientOutputs.mm in Sources */,
 				5790A6892567A28A0077C5A7 /* _WKAuthenticatorAssertionResponse.mm in Sources */,
 				5790A6852567A21E0077C5A7 /* _WKAuthenticatorAttestationResponse.mm in Sources */,

Modified: trunk/Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp (284563 => 284564)


--- trunk/Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp	2021-10-20 19:55:36 UTC (rev 284563)
+++ trunk/Source/WebKit/WebProcess/Notifications/WebNotificationManager.cpp	2021-10-20 20:32:37 UTC (rev 284564)
@@ -32,6 +32,7 @@
 #include "WebProcessCreationParameters.h"
 
 #if ENABLE(NOTIFICATIONS)
+#include "NotificationManagerMessageHandlerMessages.h"
 #include "WebNotification.h"
 #include "WebNotificationManagerMessages.h"
 #include "WebPageProxyMessages.h"
@@ -149,7 +150,7 @@
     auto it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).iterator;
     it->value.append(notificationID);
 
-    m_process.parentProcessConnection()->send(Messages::WebPageProxy::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->identifier());
+    m_process.parentProcessConnection()->send(Messages::NotificationManagerMessageHandler::ShowNotification(notification->title(), notification->body(), notification->icon().string(), notification->tag(), notification->lang(), notification->dir(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->identifier());
     return true;
 #else
     UNUSED_PARAM(notification);
@@ -168,7 +169,7 @@
     if (!notificationID)
         return;
     
-    m_process.parentProcessConnection()->send(Messages::WebPageProxy::CancelNotification(notificationID), page->identifier());
+    m_process.parentProcessConnection()->send(Messages::NotificationManagerMessageHandler::CancelNotification(notificationID), page->identifier());
 #else
     UNUSED_PARAM(notification);
     UNUSED_PARAM(page);
@@ -183,7 +184,7 @@
         return;
 
     Vector<uint64_t>& notificationIDs = it->value;
-    m_process.parentProcessConnection()->send(Messages::WebPageProxy::ClearNotifications(notificationIDs), page->identifier());
+    m_process.parentProcessConnection()->send(Messages::NotificationManagerMessageHandler::ClearNotifications(notificationIDs), page->identifier());
     size_t count = notificationIDs.size();
     for (size_t i = 0; i < count; ++i) {
         RefPtr<Notification> notification = m_notificationIDMap.take(notificationIDs[i]);
@@ -211,7 +212,7 @@
 
     m_notificationIDMap.remove(notificationID);
     removeNotificationFromContextMap(notificationID, notification);
-    m_process.parentProcessConnection()->send(Messages::WebPageProxy::DidDestroyNotification(notificationID), page->identifier());
+    m_process.parentProcessConnection()->send(Messages::NotificationManagerMessageHandler::DidDestroyNotification(notificationID), page->identifier());
 #else
     UNUSED_PARAM(notification);
     UNUSED_PARAM(page);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to