Title: [158930] trunk/Source/WebKit2
Revision
158930
Author
[email protected]
Date
2013-11-08 11:10:27 -0800 (Fri, 08 Nov 2013)

Log Message

Add WKRemoteObjectRegistry to WKConnection
https://bugs.webkit.org/show_bug.cgi?id=124054

Reviewed by Sam Weinig.

* UIProcess/API/mac/WKConnection.h:
* UIProcess/API/mac/WKConnection.mm:
(-[WKConnection delegate]):
(-[WKConnection setDelegate:]):
(-[WKConnection remoteObjectRegistry]):
(didReceiveMessage):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (158929 => 158930)


--- trunk/Source/WebKit2/ChangeLog	2013-11-08 18:47:26 UTC (rev 158929)
+++ trunk/Source/WebKit2/ChangeLog	2013-11-08 19:10:27 UTC (rev 158930)
@@ -1,5 +1,19 @@
 2013-11-08  Anders Carlsson  <[email protected]>
 
+        Add WKRemoteObjectRegistry to WKConnection
+        https://bugs.webkit.org/show_bug.cgi?id=124054
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/mac/WKConnection.h:
+        * UIProcess/API/mac/WKConnection.mm:
+        (-[WKConnection delegate]):
+        (-[WKConnection setDelegate:]):
+        (-[WKConnection remoteObjectRegistry]):
+        (didReceiveMessage):
+
+2013-11-08  Anders Carlsson  <[email protected]>
+
         Encode and decode NSURLRequests using NSCoder
         https://bugs.webkit.org/show_bug.cgi?id=124051
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.h (158929 => 158930)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.h	2013-11-08 18:47:26 UTC (rev 158929)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.h	2013-11-08 19:10:27 UTC (rev 158930)
@@ -26,7 +26,9 @@
 #import <Foundation/Foundation.h>
 #import <WebKit2/WKDeclarationSpecifiers.h>
 
-@class WKConnection, WKConnectionData;
+@class WKConnection;
+@class WKConnectionData;
+@class WKRemoteObjectRegistry;
 
 @protocol WKConnectionDelegate <NSObject>
 
@@ -43,8 +45,8 @@
 
 - (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody;
 
-#pragma mark Delegates
+@property(assign) id <WKConnectionDelegate> delegate;
 
-@property(assign) id<WKConnectionDelegate> delegate;
+@property (nonatomic, readonly) WKRemoteObjectRegistry *remoteObjectRegistry;
 
 @end

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.mm (158929 => 158930)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.mm	2013-11-08 18:47:26 UTC (rev 158929)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.mm	2013-11-08 19:10:27 UTC (rev 158930)
@@ -33,6 +33,7 @@
 #import "WKRetainPtr.h"
 #import "WKString.h"
 #import "WKStringCF.h"
+#import "WKRemoteObjectRegistryInternal.h"
 #import <wtf/RetainPtr.h>
 
 using namespace WebKit;
@@ -44,6 +45,8 @@
 
     // Delegate for callbacks.
     id<WKConnectionDelegate> _delegate;
+
+    RetainPtr<WKRemoteObjectRegistry> _remoteObjectRegistry;
 }
 @end
 
@@ -68,18 +71,24 @@
     WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), (WKTypeRef)wkMessageBody.get());
 }
 
-#pragma mark Delegates
-
-- (id<WKConnectionDelegate>)delegate
+- (id <WKConnectionDelegate>)delegate
 {
     return _data->_delegate;
 }
 
-- (void)setDelegate:(id<WKConnectionDelegate>)delegate
+- (void)setDelegate:(id <WKConnectionDelegate>)delegate
 {
     _data->_delegate = delegate;
 }
 
+- (WKRemoteObjectRegistry *)remoteObjectRegistry
+{
+    if (!_data->_remoteObjectRegistry)
+        _data->_remoteObjectRegistry = adoptNS([[WKRemoteObjectRegistry alloc] _initWithConnectionRef:_data->_connectionRef.get()]);
+
+    return _data->_remoteObjectRegistry.get();
+}
+
 @end
 
 @implementation WKConnection (Internal)
@@ -87,6 +96,9 @@
 static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
 {
     WKConnection *connection = (WKConnection *)clientInfo;
+    if ([connection->_data->_remoteObjectRegistry _handleMessageWithName:messageName body:messageBody])
+        return;
+
     if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) {
         RetainPtr<CFStringRef> nsMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName));
         RetainPtr<id> nsMessageBody = ((ObjCObjectGraph*)messageBody)->rootObject();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to