Diff
Modified: trunk/Source/WebKit/ChangeLog (249154 => 249155)
--- trunk/Source/WebKit/ChangeLog 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/ChangeLog 2019-08-27 18:22:12 UTC (rev 249155)
@@ -1,3 +1,45 @@
+2019-08-27 Chris Dumez <cdu...@apple.com>
+
+ Introduce subclasses to RemoteObjectRegistry for the UIProcess and the WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=201153
+
+ Reviewed by Alex Christensen.
+
+ This better factoring improves code clarity.
+
+ * PlatformMac.cmake:
+ * Shared/API/Cocoa/RemoteObjectRegistry.h:
+ (WebKit::RemoteObjectRegistry::~RemoteObjectRegistry):
+ (WebKit::RemoteObjectRegistry::takeBackgroundActivityToken):
+ * Shared/API/Cocoa/RemoteObjectRegistry.mm:
+ (WebKit::RemoteObjectRegistry::RemoteObjectRegistry):
+ (WebKit::RemoteObjectRegistry::sendInvocation):
+ (WebKit::RemoteObjectRegistry::sendReplyBlock):
+ (WebKit::RemoteObjectRegistry::sendUnusedReply):
+ * Shared/API/Cocoa/_WKRemoteObjectRegistry.mm:
+ (-[_WKRemoteObjectRegistry _initWithWebPage:]):
+ (-[_WKRemoteObjectRegistry _initWithWebPageProxy:]):
+ * SourcesCocoa.txt:
+ * UIProcess/Cocoa/UIRemoteObjectRegistry.cpp: Added.
+ (WebKit::UIRemoteObjectRegistry::takeBackgroundActivityToken):
+ (WebKit::UIRemoteObjectRegistry::UIRemoteObjectRegistry):
+ (WebKit::UIRemoteObjectRegistry::sendInvocation):
+ (WebKit::UIRemoteObjectRegistry::messageSender):
+ * UIProcess/Cocoa/UIRemoteObjectRegistry.h: Added.
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::setRemoteObjectRegistry):
+ (WebKit::WebPage::remoteObjectRegistry):
+ * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp: Added.
+ (WebKit::WebRemoteObjectRegistry::WebRemoteObjectRegistry):
+ (WebKit::WebRemoteObjectRegistry::~WebRemoteObjectRegistry):
+ (WebKit::WebRemoteObjectRegistry::close):
+ (WebKit::WebRemoteObjectRegistry::messageSender):
+ * WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.h: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::close):
+ * WebProcess/WebPage/WebPage.h:
+
2019-08-26 Jer Noble <jer.no...@apple.com>
Removing fullscreen element in rAF() callback after requestFullscreen() can leave fullscreen in inconsistent state.
Modified: trunk/Source/WebKit/PlatformMac.cmake (249154 => 249155)
--- trunk/Source/WebKit/PlatformMac.cmake 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/PlatformMac.cmake 2019-08-27 18:22:12 UTC (rev 249155)
@@ -252,6 +252,7 @@
UIProcess/Cocoa/PageClientImplCocoa.mm
UIProcess/Cocoa/SessionStateCoding.mm
UIProcess/Cocoa/UIDelegate.mm
+ UIProcess/Cocoa/UIRemoteObjectRegistry.cpp
UIProcess/Cocoa/VersionChecks.mm
UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm
UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
@@ -362,6 +363,7 @@
WebProcess/WebPage/ViewGestureGeometryCollector.cpp
WebProcess/WebPage/Cocoa/WebPageCocoa.mm
+ WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp
WebProcess/WebPage/mac/PageBannerMac.mm
WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Modified: trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h (249154 => 249155)
--- trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.h 2019-08-27 18:22:12 UTC (rev 249155)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-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,8 +27,7 @@
#include "MessageReceiver.h"
#include "ProcessThrottler.h"
-#include <WebCore/PageIdentifier.h>
-#include <wtf/Function.h>
+#include <wtf/HashMap.h>
#include <wtf/WeakObjCPtr.h>
#include <wtf/WeakPtr.h>
@@ -42,24 +41,23 @@
class RemoteObjectInvocation;
class UserData;
-class WebPage;
-class WebPageProxy;
-class RemoteObjectRegistry final : public CanMakeWeakPtr<RemoteObjectRegistry>, public IPC::MessageReceiver {
+class RemoteObjectRegistry : public CanMakeWeakPtr<RemoteObjectRegistry>, public IPC::MessageReceiver {
WTF_MAKE_FAST_ALLOCATED;
public:
- RemoteObjectRegistry(_WKRemoteObjectRegistry *, WebPage&);
- RemoteObjectRegistry(_WKRemoteObjectRegistry *, WebPageProxy&);
+ virtual ~RemoteObjectRegistry();
- ~RemoteObjectRegistry();
-
- void sendInvocation(const RemoteObjectInvocation&);
+ virtual void sendInvocation(const RemoteObjectInvocation&);
void sendReplyBlock(uint64_t replyID, const UserData& blockInvocation);
void sendUnusedReply(uint64_t replyID);
- void close();
+protected:
+ explicit RemoteObjectRegistry(_WKRemoteObjectRegistry *);
+
+private:
+ virtual ProcessThrottler::BackgroundActivityToken takeBackgroundActivityToken() { return nullptr; }
+ virtual IPC::MessageSender& messageSender() = 0;
-private:
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
@@ -69,12 +67,7 @@
void releaseUnusedReplyBlock(uint64_t replyID);
WeakObjCPtr<_WKRemoteObjectRegistry> m_remoteObjectRegistry;
- IPC::MessageSender& m_messageSender;
- Function<ProcessThrottler::BackgroundActivityToken()> m_takeBackgroundActivityToken;
- Function<void()> m_launchInitialProcessIfNecessary;
HashMap<uint64_t, ProcessThrottler::BackgroundActivityToken> m_pendingReplies;
- bool m_isRegisteredAsMessageReceiver { false };
- WebCore::PageIdentifier m_messageReceiverID;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm (249154 => 249155)
--- trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/Shared/API/Cocoa/RemoteObjectRegistry.mm 2019-08-27 18:22:12 UTC (rev 249155)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-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,72 +27,41 @@
#import "RemoteObjectRegistry.h"
#import "MessageSender.h"
-#import "ProcessThrottler.h"
#import "RemoteObjectInvocation.h"
#import "RemoteObjectRegistryMessages.h"
#import "UserData.h"
-#import "WebPage.h"
-#import "WebPageProxy.h"
-#import "WebProcess.h"
-#import "WebProcessProxy.h"
#import "_WKRemoteObjectRegistryInternal.h"
namespace WebKit {
-RemoteObjectRegistry::RemoteObjectRegistry(_WKRemoteObjectRegistry *remoteObjectRegistry, WebPage& page)
+RemoteObjectRegistry::RemoteObjectRegistry(_WKRemoteObjectRegistry *remoteObjectRegistry)
: m_remoteObjectRegistry(remoteObjectRegistry)
- , m_messageSender(page)
- , m_takeBackgroundActivityToken([] { return ProcessThrottler::BackgroundActivityToken(); })
- , m_isRegisteredAsMessageReceiver(true)
- , m_messageReceiverID(page.pageID())
{
- WebProcess::singleton().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_messageReceiverID, *this);
- page.setRemoteObjectRegistry(*this);
}
-RemoteObjectRegistry::RemoteObjectRegistry(_WKRemoteObjectRegistry *remoteObjectRegistry, WebPageProxy& page)
- : m_remoteObjectRegistry(remoteObjectRegistry)
- , m_messageSender(page)
- , m_takeBackgroundActivityToken([&page] { return page.process().throttler().backgroundActivityToken(); })
- , m_launchInitialProcessIfNecessary([&page] { page.launchInitialProcessIfNecessary(); })
-{
-}
-
RemoteObjectRegistry::~RemoteObjectRegistry()
{
- close();
}
-void RemoteObjectRegistry::close()
-{
- if (m_isRegisteredAsMessageReceiver) {
- WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_messageReceiverID);
- m_isRegisteredAsMessageReceiver = false;
- }
-}
-
void RemoteObjectRegistry::sendInvocation(const RemoteObjectInvocation& invocation)
{
- // For backward-compatibility, support invoking injected bundle methods before having done any load in the WebView.
- if (m_launchInitialProcessIfNecessary)
- m_launchInitialProcessIfNecessary();
if (auto* replyInfo = invocation.replyInfo()) {
ASSERT(!m_pendingReplies.contains(replyInfo->replyID));
- m_pendingReplies.add(replyInfo->replyID, m_takeBackgroundActivityToken());
+ m_pendingReplies.add(replyInfo->replyID, takeBackgroundActivityToken());
}
- m_messageSender.send(Messages::RemoteObjectRegistry::InvokeMethod(invocation));
+ messageSender().send(Messages::RemoteObjectRegistry::InvokeMethod(invocation));
}
void RemoteObjectRegistry::sendReplyBlock(uint64_t replyID, const UserData& blockInvocation)
{
- m_messageSender.send(Messages::RemoteObjectRegistry::CallReplyBlock(replyID, blockInvocation));
+ messageSender().send(Messages::RemoteObjectRegistry::CallReplyBlock(replyID, blockInvocation));
}
void RemoteObjectRegistry::sendUnusedReply(uint64_t replyID)
{
- m_messageSender.send(Messages::RemoteObjectRegistry::ReleaseUnusedReplyBlock(replyID));
+ messageSender().send(Messages::RemoteObjectRegistry::ReleaseUnusedReplyBlock(replyID));
}
void RemoteObjectRegistry::invokeMethod(const RemoteObjectInvocation& invocation)
@@ -115,4 +84,5 @@
[m_remoteObjectRegistry _releaseReplyWithID:replyID];
}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm (249154 => 249155)
--- trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm 2019-08-27 18:22:12 UTC (rev 249155)
@@ -30,7 +30,7 @@
#import "BlockSPI.h"
#import "Connection.h"
#import "RemoteObjectInvocation.h"
-#import "RemoteObjectRegistry.h"
+#import "UIRemoteObjectRegistry.h"
#import "UserData.h"
#import "WKConnectionRef.h"
#import "WKRemoteObject.h"
@@ -37,6 +37,7 @@
#import "WKRemoteObjectCoder.h"
#import "WKSharedAPICast.h"
#import "WebPage.h"
+#import "WebRemoteObjectRegistry.h"
#import "_WKRemoteObjectInterface.h"
#import <objc/runtime.h>
@@ -109,7 +110,7 @@
if (!(self = [super init]))
return nil;
- _remoteObjectRegistry = makeUnique<WebKit::RemoteObjectRegistry>(self, page);
+ _remoteObjectRegistry = makeUnique<WebKit::WebRemoteObjectRegistry>(self, page);
return self;
}
@@ -119,7 +120,7 @@
if (!(self = [super init]))
return nil;
- _remoteObjectRegistry = makeUnique<WebKit::RemoteObjectRegistry>(self, page);
+ _remoteObjectRegistry = makeUnique<WebKit::UIRemoteObjectRegistry>(self, page);
return self;
}
Modified: trunk/Source/WebKit/SourcesCocoa.txt (249154 => 249155)
--- trunk/Source/WebKit/SourcesCocoa.txt 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/SourcesCocoa.txt 2019-08-27 18:22:12 UTC (rev 249155)
@@ -356,6 +356,7 @@
UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
UIProcess/Cocoa/TextCheckingController.mm
UIProcess/Cocoa/UIDelegate.mm
+UIProcess/Cocoa/UIRemoteObjectRegistry.cpp
UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
UIProcess/Cocoa/VersionChecks.mm
UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
@@ -579,6 +580,7 @@
WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm
WebProcess/WebPage/Cocoa/WebPageCocoa.mm
+WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp
WebProcess/WebPage/ios/FindControllerIOS.mm
WebProcess/WebPage/ios/WebPageIOS.mm
Added: trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.cpp (0 => 249155)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.cpp (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.cpp 2019-08-27 18:22:12 UTC (rev 249155)
@@ -0,0 +1,58 @@
+/*
+* Copyright (C) 2013-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.
+*/
+
+#include "config.h"
+#include "UIRemoteObjectRegistry.h"
+
+#include "WebPageProxy.h"
+#include "WebProcessProxy.h"
+
+namespace WebKit {
+
+ProcessThrottler::BackgroundActivityToken UIRemoteObjectRegistry::takeBackgroundActivityToken()
+{
+ return m_page.process().throttler().backgroundActivityToken();
+}
+
+UIRemoteObjectRegistry::UIRemoteObjectRegistry(_WKRemoteObjectRegistry *remoteObjectRegistry, WebPageProxy& page)
+ : RemoteObjectRegistry(remoteObjectRegistry)
+ , m_page(page)
+{
+}
+
+void UIRemoteObjectRegistry::sendInvocation(const RemoteObjectInvocation& invocation)
+{
+ // For backward-compatibility, support invoking injected bundle methods before having done any load in the WebView.
+ m_page.launchInitialProcessIfNecessary();
+
+ RemoteObjectRegistry::sendInvocation(invocation);
+}
+
+IPC::MessageSender& UIRemoteObjectRegistry::messageSender()
+{
+ return m_page;
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.h (0 => 249155)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.h 2019-08-27 18:22:12 UTC (rev 249155)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013-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 "RemoteObjectRegistry.h"
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class UIRemoteObjectRegistry final : public RemoteObjectRegistry {
+public:
+ UIRemoteObjectRegistry(_WKRemoteObjectRegistry *, WebPageProxy&);
+
+ void sendInvocation(const RemoteObjectInvocation&) final;
+
+private:
+ IPC::MessageSender& messageSender() final;
+ ProcessThrottler::BackgroundActivityToken takeBackgroundActivityToken() final;
+
+ WebPageProxy& m_page;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (249154 => 249155)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-08-27 18:22:12 UTC (rev 249155)
@@ -902,6 +902,8 @@
449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 449D90D821FD63FE00F677C0 /* LocalAuthenticationSoftLink.mm */; };
460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */; };
460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */; };
+ 461CCCA5231485A700B659B9 /* UIRemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */; };
+ 461CCCA6231485AA00B659B9 /* WebRemoteObjectRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 46323683231481EF00A48FA7 /* WebRemoteObjectRegistry.h */; };
463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; };
463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; };
4657D88922664A2D005DE823 /* WKOrientationAccessAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */; };
@@ -3195,6 +3197,10 @@
460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSWContextManagerConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/WebSWContextManagerConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSWContextManagerConnectionMessages.h; path = DerivedSources/WebKit2/WebSWContextManagerConnectionMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
462107D71F38DBD300DD7810 /* PingLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PingLoad.cpp; sourceTree = "<group>"; };
+ 46323683231481EF00A48FA7 /* WebRemoteObjectRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebRemoteObjectRegistry.h; sourceTree = "<group>"; };
+ 463236842314825C00A48FA7 /* WebRemoteObjectRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebRemoteObjectRegistry.cpp; sourceTree = "<group>"; };
+ 463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIRemoteObjectRegistry.h; sourceTree = "<group>"; };
+ 463236862314833F00A48FA7 /* UIRemoteObjectRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UIRemoteObjectRegistry.cpp; sourceTree = "<group>"; };
463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessTerminationReason.h; sourceTree = "<group>"; };
463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; };
4651ECE622178A850067EB95 /* WebProcessCacheCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCacheCocoa.mm; sourceTree = "<group>"; };
@@ -5556,6 +5562,8 @@
2D0CF64B21F2A80300787566 /* TextCheckingController.mm */,
1AFE436418B6C081009C7A48 /* UIDelegate.h */,
1AFE436318B6C081009C7A48 /* UIDelegate.mm */,
+ 463236862314833F00A48FA7 /* UIRemoteObjectRegistry.cpp */,
+ 463236852314833F00A48FA7 /* UIRemoteObjectRegistry.h */,
E4E8648E1B1673FB00C82F40 /* VersionChecks.h */,
E4E8648F1B1673FB00C82F40 /* VersionChecks.mm */,
52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */,
@@ -5798,6 +5806,8 @@
2D9CD5EB21FA503F0029ACFA /* TextCheckingControllerProxy.messages.in */,
2D9CD5EC21FA503F0029ACFA /* TextCheckingControllerProxy.mm */,
2DC4CF7A1D2DE24B00ECCC94 /* WebPageCocoa.mm */,
+ 463236842314825C00A48FA7 /* WebRemoteObjectRegistry.cpp */,
+ 46323683231481EF00A48FA7 /* WebRemoteObjectRegistry.h */,
);
path = Cocoa;
sourceTree = "<group>";
@@ -9762,6 +9772,7 @@
515BE1A91D55293400DD7C68 /* UIGamepadProvider.h in Headers */,
CEE4AE2B1A5DCF430002F49B /* UIKitSPI.h in Headers */,
513FFB8D201459B0002596EA /* UIMessagePortChannelProvider.h in Headers */,
+ 461CCCA5231485A700B659B9 /* UIRemoteObjectRegistry.h in Headers */,
5C4B9D8B210A8CCF008F14D1 /* UndoOrRedo.h in Headers */,
1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */,
5C19A5201FD0B29500EEA323 /* URLSchemeTaskParameters.h in Headers */,
@@ -9958,6 +9969,7 @@
BCE0E425168B7A280057E66A /* WebProcessSupplement.h in Headers */,
1A1E093418861D3800D2DC49 /* WebProgressTrackerClient.h in Headers */,
512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
+ 461CCCA6231485AA00B659B9 /* WebRemoteObjectRegistry.h in Headers */,
37948404150C350600E52CE9 /* WebRenderLayer.h in Headers */,
3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (249154 => 249155)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2019-08-27 18:22:12 UTC (rev 249155)
@@ -29,10 +29,10 @@
#import "AttributedString.h"
#import "LoadParameters.h"
#import "PluginView.h"
-#import "RemoteObjectRegistry.h"
#import "WKAccessibilityWebPageObjectBase.h"
#import "WebPageProxyMessages.h"
#import "WebPaymentCoordinator.h"
+#import "WebRemoteObjectRegistry.h"
#import <WebCore/DictionaryLookup.h>
#import <WebCore/Editor.h>
#import <WebCore/EventHandler.h>
@@ -217,11 +217,16 @@
completionHandler({ result });
}
-void WebPage::setRemoteObjectRegistry(RemoteObjectRegistry& registry)
+void WebPage::setRemoteObjectRegistry(WebRemoteObjectRegistry* registry)
{
m_remoteObjectRegistry = makeWeakPtr(registry);
}
+WebRemoteObjectRegistry* WebPage::remoteObjectRegistry()
+{
+ return m_remoteObjectRegistry.get();
+}
+
void WebPage::updateMockAccessibilityElementAfterCommittingLoad()
{
auto* document = mainFrame()->document();
Added: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp (0 => 249155)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.cpp 2019-08-27 18:22:12 UTC (rev 249155)
@@ -0,0 +1,60 @@
+/*
+* Copyright (C) 2013-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.
+*/
+
+#include "config.h"
+#include "WebRemoteObjectRegistry.h"
+
+#include "RemoteObjectRegistryMessages.h"
+#include "WebPage.h"
+
+namespace WebKit {
+
+WebRemoteObjectRegistry::WebRemoteObjectRegistry(_WKRemoteObjectRegistry *remoteObjectRegistry, WebPage& page)
+ : RemoteObjectRegistry(remoteObjectRegistry)
+ , m_page(page)
+{
+ WebProcess::singleton().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page.pageID(), *this);
+ page.setRemoteObjectRegistry(this);
+}
+
+WebRemoteObjectRegistry::~WebRemoteObjectRegistry()
+{
+ close();
+}
+
+void WebRemoteObjectRegistry::close()
+{
+ if (m_page.remoteObjectRegistry() == this) {
+ WebProcess::singleton().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), m_page.pageID());
+ m_page.setRemoteObjectRegistry(nullptr);
+ }
+}
+
+IPC::MessageSender& WebRemoteObjectRegistry::messageSender()
+{
+ return m_page;
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.h (0 => 249155)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.h 2019-08-27 18:22:12 UTC (rev 249155)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013-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 "RemoteObjectRegistry.h"
+
+namespace WebKit {
+
+class WebPage;
+
+class WebRemoteObjectRegistry final : public RemoteObjectRegistry {
+public:
+ WebRemoteObjectRegistry(_WKRemoteObjectRegistry *, WebPage&);
+ ~WebRemoteObjectRegistry();
+
+ void close();
+
+private:
+ IPC::MessageSender& messageSender() final;
+
+ WebPage& m_page;
+};
+
+} // namespace WebKit
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (249154 => 249155)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-08-27 18:22:12 UTC (rev 249155)
@@ -258,7 +258,6 @@
#include "PDFPlugin.h"
#include "PlaybackSessionManager.h"
#include "RemoteLayerTreeTransaction.h"
-#include "RemoteObjectRegistry.h"
#include "RemoteObjectRegistryMessages.h"
#include "TextCheckingControllerProxy.h"
#include "TouchBarMenuData.h"
@@ -265,6 +264,7 @@
#include "TouchBarMenuItemData.h"
#include "VideoFullscreenManager.h"
#include "WKStringCF.h"
+#include "WebRemoteObjectRegistry.h"
#include <WebCore/LegacyWebArchive.h>
#include <WebCore/UTIRegistry.h>
#include <wtf/MachSendRight.h>
@@ -1432,6 +1432,7 @@
#if PLATFORM(COCOA)
if (m_remoteObjectRegistry)
m_remoteObjectRegistry->close();
+ ASSERT(!m_remoteObjectRegistry);
#endif
#if ENABLE(ASYNC_SCROLLING)
if (m_useAsyncScrolling)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (249154 => 249155)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-08-27 18:16:17 UTC (rev 249154)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-08-27 18:22:12 UTC (rev 249155)
@@ -217,7 +217,6 @@
class PDFPlugin;
class PageBanner;
class PluginView;
-class RemoteObjectRegistry;
class RemoteWebInspectorUI;
class TextCheckingControllerProxy;
class UserMediaPermissionRequestManager;
@@ -247,6 +246,7 @@
class WebPageOverlay;
class WebPaymentCoordinator;
class WebPopupMenu;
+class WebRemoteObjectRegistry;
class WebTouchEvent;
class WebURLSchemeHandlerProxy;
class WebUndoStep;
@@ -1198,7 +1198,10 @@
TextCheckingControllerProxy& textCheckingController() { return m_textCheckingControllerProxy.get(); }
#endif
- void setRemoteObjectRegistry(RemoteObjectRegistry&);
+#if PLATFORM(COCOA)
+ void setRemoteObjectRegistry(WebRemoteObjectRegistry*);
+ WebRemoteObjectRegistry* remoteObjectRegistry();
+#endif
void updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize&);
void scheduleFullEditorStateUpdate();
@@ -1952,7 +1955,7 @@
bool m_needsFontAttributes { false };
bool m_firstFlushAfterCommit { false };
#if PLATFORM(COCOA)
- WeakPtr<RemoteObjectRegistry> m_remoteObjectRegistry;
+ WeakPtr<WebRemoteObjectRegistry> m_remoteObjectRegistry;
#endif
WebCore::IntSize m_lastSentIntrinsicContentSize;
#if ENABLE(VIEWPORT_RESIZING)