Diff
Modified: trunk/Source/WebKit2/ChangeLog (191008 => 191009)
--- trunk/Source/WebKit2/ChangeLog 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/ChangeLog 2015-10-13 21:56:59 UTC (rev 191009)
@@ -1,3 +1,25 @@
+2015-10-13 Anders Carlsson <[email protected]>
+
+ Add and implement WKPageGetObjectRegistry
+ https://bugs.webkit.org/show_bug.cgi?id=150102
+
+ Reviewed by Tim Horton.
+
+ Put the _WKObjectRegistry used by WKPageRef and WKBrowsingContextController on the WKView for now.
+ If we decide to share more code between WKView and WKWebView, the object registry could live in an object that would be shared
+ between WKView and WKWebView.
+
+ * UIProcess/API/C/mac/WKPagePrivateMac.h:
+ * UIProcess/API/C/mac/WKPagePrivateMac.mm:
+ (WKPageGetObjectRegistry):
+ * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+ (-[WKBrowsingContextController _remoteObjectRegistry]):
+ (-[WKBrowsingContextController dealloc]): Deleted.
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView dealloc]):
+ (-[WKView _remoteObjectRegistry]):
+ * UIProcess/API/mac/WKViewInternal.h:
+
2015-10-13 Chris Dumez <[email protected]>
Avoid useless copies in range-loops that are using 'auto'
Modified: trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h (191008 => 191009)
--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.h 2015-10-13 21:56:59 UTC (rev 191009)
@@ -35,6 +35,8 @@
#ifdef __OBJC__
+@class _WKRemoteObjectRegistry;
+
@protocol _WKObservablePageState
@property (nonatomic, readonly, copy) NSString *title;
@@ -49,6 +51,7 @@
@end
WK_EXPORT id <_WKObservablePageState> WKPageCreateObservableState(WKPageRef page) NS_RETURNS_RETAINED;
+WK_EXPORT _WKRemoteObjectRegistry *WKPageGetObjectRegistry(WKPageRef page);
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.mm (191008 => 191009)
--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.mm 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKPagePrivateMac.mm 2015-10-13 21:56:59 UTC (rev 191009)
@@ -29,6 +29,7 @@
#import "PageLoadStateObserver.h"
#import "WKAPICast.h"
#import "WKNSURLExtras.h"
+#import "WKViewInternal.h"
#import "WebPageGroup.h"
#import "WebPageProxy.h"
#import "WebPreferences.h"
@@ -101,6 +102,11 @@
return [[WKObservablePageState alloc] initWithPage:toImpl(pageRef)];
}
+_WKRemoteObjectRegistry *WKPageGetObjectRegistry(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->wkView()._remoteObjectRegistry;
+}
+
pid_t WKPageGetProcessIdentifier(WKPageRef pageRef)
{
return toImpl(pageRef)->processIdentifier();
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm (191008 => 191009)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKBrowsingContextController.mm 2015-10-13 21:56:59 UTC (rev 191009)
@@ -51,6 +51,7 @@
#import "WKRetainPtr.h"
#import "WKURLRequestNS.h"
#import "WKURLResponseNS.h"
+#import "WKViewInternal.h"
#import "WeakObjCPtr.h"
#import "WebCertificateInfo.h"
#import "WebPageProxy.h"
@@ -79,8 +80,6 @@
WeakObjCPtr<id <WKBrowsingContextLoadDelegate>> _loadDelegate;
WeakObjCPtr<id <WKBrowsingContextPolicyDelegate>> _policyDelegate;
-
- RetainPtr<_WKRemoteObjectRegistry> _remoteObjectRegistry;
}
static HashMap<WebPageProxy*, WKBrowsingContextController *>& browsingContextControllerMap()
@@ -96,11 +95,6 @@
_page->pageLoadState().removeObserver(*_pageLoadStateObserver);
- if (_remoteObjectRegistry) {
- _page->process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID());
- [_remoteObjectRegistry _invalidate];
- }
-
[super dealloc];
}
@@ -757,12 +751,7 @@
- (_WKRemoteObjectRegistry *)_remoteObjectRegistry
{
- if (!_remoteObjectRegistry) {
- _remoteObjectRegistry = adoptNS([[_WKRemoteObjectRegistry alloc] _initWithMessageSender:*_page]);
- _page->process().processPool().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _page->pageID(), [_remoteObjectRegistry remoteObjectRegistry]);
- }
-
- return _remoteObjectRegistry.get();
+ return _page->wkView()._remoteObjectRegistry;
}
- (pid_t)processIdentifier
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191008 => 191009)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-10-13 21:56:59 UTC (rev 191009)
@@ -48,6 +48,8 @@
#import "PageClientImpl.h"
#import "PasteboardTypes.h"
#import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "RemoteObjectRegistry.h"
+#import "RemoteObjectRegistryMessages.h"
#import "StringUtilities.h"
#import "TextChecker.h"
#import "TextCheckerState.h"
@@ -78,6 +80,7 @@
#import "WebProcessPool.h"
#import "WebProcessProxy.h"
#import "WebSystemInterface.h"
+#import "_WKRemoteObjectRegistryInternal.h"
#import "_WKThumbnailViewInternal.h"
#import <QuartzCore/QuartzCore.h>
#import <WebCore/AXObjectCache.h>
@@ -181,6 +184,8 @@
#if WK_API_ENABLED
RetainPtr<WKBrowsingContextController> _browsingContextController;
RetainPtr<NSView> _inspectorAttachmentView;
+
+ RetainPtr<_WKRemoteObjectRegistry> _remoteObjectRegistry;
#endif
RetainPtr<NSTrackingArea> _primaryTrackingArea;
@@ -386,6 +391,13 @@
#endif
[_data->_layoutStrategy willDestroyView:self];
+#if WK_API_ENABLED
+ if (_data->_remoteObjectRegistry) {
+ _data->_page->process().processPool().removeMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _data->_page->pageID());
+ [_data->_remoteObjectRegistry _invalidate];
+ }
+#endif
+
_data->_page->close();
#if WK_API_ENABLED
@@ -3949,6 +3961,20 @@
}
}
+#if WK_API_ENABLED
+- (_WKRemoteObjectRegistry *)_remoteObjectRegistry
+{
+ if (!_data->_remoteObjectRegistry) {
+ _data->_remoteObjectRegistry = adoptNS([[_WKRemoteObjectRegistry alloc] _initWithMessageSender:*_data->_page]);
+ _data->_page->process().processPool().addMessageReceiver(Messages::RemoteObjectRegistry::messageReceiverName(), _data->_page->pageID(), [_data->_remoteObjectRegistry remoteObjectRegistry]);
+ }
+
+ return _data->_remoteObjectRegistry.get();
+}
+
+#endif
+
+
- (void)_didCommitLoadForMainFrame
{
[self _updateSupportsArbitraryLayoutModes];
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (191008 => 191009)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-10-13 21:46:10 UTC (rev 191008)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-10-13 21:56:59 UTC (rev 191009)
@@ -34,7 +34,7 @@
#import <wtf/RetainPtr.h>
#import <wtf/Vector.h>
-@class WKWebViewConfiguration;
+@class _WKRemoteObjectRegistry;
namespace API {
class Object;
@@ -163,4 +163,8 @@
- (void)_updateSupportsArbitraryLayoutModes;
+#if WK_API_ENABLED
+@property (nonatomic, readonly) _WKRemoteObjectRegistry *_remoteObjectRegistry;
+#endif
+
@end