Changeset 136095 in webkit
- Timestamp:
- Nov 28, 2012, 9:33:42 PM (14 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 added
- 12 edited
-
ChangeLog (modified) (1 diff)
-
Shared/APIClient.h (modified) (1 diff)
-
Shared/APIObject.h (modified) (1 diff)
-
Shared/mac/ObjCObjectGraph.h (added)
-
Shared/mac/ObjCObjectGraph.mm (added)
-
Shared/mac/ObjCObjectGraphCoders.h (added)
-
Shared/mac/ObjCObjectGraphCoders.mm (added)
-
UIProcess/API/mac/WKBrowsingContextController.mm (modified) (4 diffs)
-
UIProcess/API/mac/WKBrowsingContextControllerInternal.h (modified) (1 diff)
-
UIProcess/API/mac/WKConnection.mm (modified) (3 diffs)
-
UIProcess/WebContextUserMessageCoders.h (modified) (3 diffs)
-
UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit2.xcodeproj/project.pbxproj (modified) (6 diffs)
-
WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm (modified) (1 diff)
-
WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h (modified) (1 diff)
-
WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r136083 r136095 1 2012-11-28 Sam Weinig <sam@webkit.org> 2 3 Add an objc object graph wrapper and coder for WKConnection message bodies 4 https://bugs.webkit.org/show_bug.cgi?id=103589 5 6 Reviewed by Anders Carlsson. 7 8 Adds a new type of UserMessageCoder for objc object graphs that allows encoding/decoding 9 WKBrowsingContextController across the wire. 10 11 * Shared/APIClient.h: 12 (APIClient): 13 (WebKit::APIClient::client): 14 Add accessor for the ClientInterface. 15 16 * Shared/APIObject.h: 17 Add new TypeObjCObjectGraph type. 18 19 * Shared/mac/ObjCObjectGraph.h: Added. 20 (ObjCObjectGraph): 21 (WebKit::ObjCObjectGraph::create): 22 (WebKit::ObjCObjectGraph::root): 23 (WebKit::ObjCObjectGraph::ObjCObjectGraph): 24 (WebKit::ObjCObjectGraph::type): 25 * Shared/mac/ObjCObjectGraph.mm: Added. 26 Wraps 27 28 * Shared/mac/ObjCObjectGraphCoders.h: Added. 29 (WebContextObjCObjectGraphEncoder): 30 (WebContextObjCObjectGraphDecoder): 31 (InjectedBundleObjCObjectGraphEncoder): 32 (InjectedBundleObjCObjectGraphDecoder): 33 * Shared/mac/ObjCObjectGraphCoders.mm: Added. 34 (WebKit::typeFromObject): 35 (ObjCObjectGraphEncoder): 36 (WebKit::ObjCObjectGraphEncoder::baseEncode): 37 (WebKit::ObjCObjectGraphEncoder::ObjCObjectGraphEncoder): 38 (ObjCObjectGraphDecoder): 39 (WebKit::ObjCObjectGraphDecoder::baseDecode): 40 (WebKit::ObjCObjectGraphDecoder::ObjCObjectGraphDecoder): 41 (WebContextObjCObjectGraphEncoderImpl): 42 (WebKit::WebContextObjCObjectGraphEncoderImpl::WebContextObjCObjectGraphEncoderImpl): 43 (WebKit::WebContextObjCObjectGraphEncoderImpl::encode): 44 (WebContextObjCObjectGraphDecoderImpl): 45 (WebKit::WebContextObjCObjectGraphDecoderImpl::WebContextObjCObjectGraphDecoderImpl): 46 (WebKit::WebContextObjCObjectGraphDecoderImpl::decode): 47 (InjectedBundleObjCObjectGraphEncoderImpl): 48 (WebKit::InjectedBundleObjCObjectGraphEncoderImpl::InjectedBundleObjCObjectGraphEncoderImpl): 49 (WebKit::InjectedBundleObjCObjectGraphEncoderImpl::encode): 50 (InjectedBundleObjCObjectGraphDecoderImpl): 51 (WebKit::InjectedBundleObjCObjectGraphDecoderImpl::InjectedBundleObjCObjectGraphDecoderImpl): 52 (WebKit::InjectedBundleObjCObjectGraphDecoderImpl::decode): 53 (WebKit::WebContextObjCObjectGraphEncoder::WebContextObjCObjectGraphEncoder): 54 (WebKit::WebContextObjCObjectGraphEncoder::encode): 55 (WebKit::WebContextObjCObjectGraphDecoder::WebContextObjCObjectGraphDecoder): 56 (WebKit::WebContextObjCObjectGraphDecoder::decode): 57 (WebKit::InjectedBundleObjCObjectGraphEncoder::InjectedBundleObjCObjectGraphEncoder): 58 (WebKit::InjectedBundleObjCObjectGraphEncoder::encode): 59 (WebKit::InjectedBundleObjCObjectGraphDecoder::InjectedBundleObjCObjectGraphDecoder): 60 (WebKit::InjectedBundleObjCObjectGraphDecoder::decode): 61 Added. 62 63 * UIProcess/API/mac/WKBrowsingContextController.mm: 64 (+[WKBrowsingContextController _browsingContextControllerForPageRef:]): 65 * UIProcess/API/mac/WKBrowsingContextControllerInternal.h: 66 Expose the accessor to get the WKPageRef from a WKBrowsingContextController and add a 67 new method to get a WKBrowsingContextController from a WKPageRef. 68 69 * UIProcess/API/mac/WKConnection.mm: 70 (-[WKConnection sendMessageWithName:body:]): 71 (didReceiveMessage): 72 Switch WKConnection to use ObjCObjectGraph to encode the messageBody. 73 74 * UIProcess/WebContextUserMessageCoders.h: 75 (WebKit::WebContextUserMessageEncoder::encode): 76 (WebKit::WebContextUserMessageDecoder::decode): 77 * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h: 78 (WebKit::InjectedBundleUserMessageEncoder::encode): 79 (WebKit::InjectedBundleUserMessageDecoder::decode): 80 Proxy to ObjCObjectGraph coders when user message encoding/decoding ObjCObjectGraph APIObjects. 81 82 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm: 83 (-[WKWebProcessPlugInController _browserContextControllerForBundlePageRef:]): 84 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h: 85 Add method to get WKWebProcessPlugInController from the WKBundlePageRef. 86 87 * WebKit2.xcodeproj/project.pbxproj: 88 Add new files. 89 1 90 2012-11-28 Sergio Villar Senin <svillar@igalia.com> 2 91 -
trunk/Source/WebKit2/Shared/APIClient.h
r95901 r136095 52 52 memcpy(&m_client, client, APIClientTraits<ClientInterface>::interfaceSizesByVersion[client->version]); 53 53 } 54 54 55 const ClientInterface& client() const { return m_client; } 56 55 57 protected: 56 58 ClientInterface m_client; -
trunk/Source/WebKit2/Shared/APIObject.h
r128553 r136095 131 131 // Platform specific 132 132 TypeEditCommandProxy, 133 TypeObjCObjectGraph, 133 134 TypeView, 134 135 #if USE(SOUP) -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r134681 r136095 38 38 #import "WKURLRequestNS.h" 39 39 #import "WebContext.h" 40 #import "WebPageProxy.h" 40 41 #import <wtf/RetainPtr.h> 41 42 … … 53 54 return [(NSURL *)WKURLCopyCFURL(kCFAllocatorDefault, wkURL.get()) autorelease]; 54 55 } 55 56 56 57 57 @interface WKBrowsingContextControllerData : NSObject { … … 66 66 67 67 @implementation WKBrowsingContextControllerData 68 @end69 70 71 @interface WKBrowsingContextController ()72 73 @property(readonly) WKPageRef _pageRef;74 75 68 @end 76 69 … … 419 412 } 420 413 414 + (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef 415 { 416 return (WKBrowsingContextController *)WebKit::toImpl(pageRef)->loaderClient().client().clientInfo; 417 } 418 421 419 + (NSMutableSet *)customSchemes 422 420 { -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
r134681 r136095 30 30 /* This should only be called from associate view. */ 31 31 - (id)_initWithPageRef:(WKPageRef)pageRef; 32 33 /* Returns a WKBrowsingContextController associated with the WKPageRef. */ 34 + (WKBrowsingContextController *)_browsingContextControllerForPageRef:(WKPageRef)pageRef; 35 36 @property(readonly) WKPageRef _pageRef; 37 32 38 + (NSMutableSet *)customSchemes; 33 39 -
trunk/Source/WebKit2/UIProcess/API/mac/WKConnection.mm
r133558 r136095 28 28 #import "WKConnectionInternal.h" 29 29 30 #import "ArgumentCodersMac.h" 31 #import "ArgumentDecoder.h" 32 #import "ArgumentEncoder.h" 30 #import "ObjCObjectGraph.h" 33 31 #import "WKConnectionRef.h" 34 32 #import "WKData.h" … … 65 63 - (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody 66 64 { 67 OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create();68 encode(*messageData,messageBody);65 WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName)); 66 RefPtr<ObjCObjectGraph> wkMessageBody = ObjCObjectGraph::create(messageBody); 69 67 70 WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName)); 71 WKRetainPtr<WKDataRef> wkMessageBody = adoptWK(WKDataCreate(messageData->buffer(), messageData->bufferSize())); 72 73 WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), wkMessageBody.get()); 68 WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), (WKTypeRef)wkMessageBody.get()); 74 69 } 75 70 … … 94 89 WKConnection *connection = (WKConnection *)clientInfo; 95 90 if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) { 96 RetainPtr<CFStringRef> cfMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName)); 91 RetainPtr<NSString> nsMessageName = adoptNS((NSString *)WKStringCopyCFString(kCFAllocatorDefault, messageName)); 92 RetainPtr<id> nsMessageBody = ((ObjCObjectGraph*)messageBody)->rootObject(); 97 93 98 WKDataRef messageData = (WKDataRef)messageBody; 99 OwnPtr<CoreIPC::ArgumentDecoder> decoder = CoreIPC::ArgumentDecoder::create(WKDataGetBytes(messageData), WKDataGetSize(messageData)); 100 101 RetainPtr<id> messageDictionary; 102 // FIXME: Don't just silently drop decoding failures on the ground. 103 if (!decode(decoder.get(), messageDictionary)) 104 return; 105 106 [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:messageDictionary.get()]; 94 [connection.delegate connection:connection didReceiveMessageWithName:nsMessageName.get() body:nsMessageBody.get()]; 107 95 } 108 96 } -
trunk/Source/WebKit2/UIProcess/WebContextUserMessageCoders.h
r132926 r136095 30 30 #include "WebPageGroupData.h" 31 31 #include "WebPageProxy.h" 32 33 #if PLATFORM(MAC) 34 #include "ObjCObjectGraphCoders.h" 35 #endif 32 36 33 37 namespace WebKit { … … 69 73 break; 70 74 } 75 #if PLATFORM(MAC) 76 case APIObject::TypeObjCObjectGraph: { 77 ObjCObjectGraph* objectGraph = static_cast<ObjCObjectGraph*>(m_root); 78 encoder << WebContextObjCObjectGraphEncoder(objectGraph); 79 break; 80 } 81 #endif 71 82 default: 72 83 ASSERT_NOT_REACHED(); … … 128 139 break; 129 140 } 141 #if PLATFORM(MAC) 142 case APIObject::TypeObjCObjectGraph: { 143 RefPtr<ObjCObjectGraph> objectGraph; 144 WebContextObjCObjectGraphDecoder objectGraphDecoder(objectGraph, coder.m_process); 145 if (!decoder->decode(objectGraphDecoder)) 146 return false; 147 coder.m_root = objectGraph.get(); 148 break; 149 } 150 #endif 130 151 default: 131 152 return false; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r136075 r136095 755 755 void endColorChooser(); 756 756 #endif 757 758 const WebLoaderClient& loaderClient() { return m_loaderClient; } 757 759 758 760 private: -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r135958 r136095 812 812 BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */; }; 813 813 BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8A501411765F5600757573 /* WKRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; 814 BC8ACA1316670D89004C1941 /* ObjCObjectGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8ACA0F16670D7A004C1941 /* ObjCObjectGraph.h */; }; 815 BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8ACA1016670D7B004C1941 /* ObjCObjectGraph.mm */; }; 816 BC8ACA1516670D89004C1941 /* ObjCObjectGraphCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8ACA1116670D7E004C1941 /* ObjCObjectGraphCoders.h */; }; 817 BC8ACA1616670D89004C1941 /* ObjCObjectGraphCoders.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8ACA1216670D83004C1941 /* ObjCObjectGraphCoders.mm */; }; 814 818 BC8F2F2A16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC8F2F2816273A2B005FACB5 /* WKWebProcessPlugInBrowserContextController.mm */; }; 815 819 BC8F2F2B16273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8F2F2916273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h */; settings = {ATTRIBUTES = (Public, ); }; }; … … 2076 2080 BC8A501011765AF700757573 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebProcess/Info.plist; sourceTree = "<group>"; }; 2077 2081 BC8A501411765F5600757573 /* WKRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRetainPtr.h; sourceTree = "<group>"; }; 2082 BC8ACA0F16670D7A004C1941 /* ObjCObjectGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCObjectGraph.h; sourceTree = "<group>"; }; 2083 BC8ACA1016670D7B004C1941 /* ObjCObjectGraph.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCObjectGraph.mm; sourceTree = "<group>"; }; 2084 BC8ACA1116670D7E004C1941 /* ObjCObjectGraphCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCObjectGraphCoders.h; sourceTree = "<group>"; }; 2085 BC8ACA1216670D83004C1941 /* ObjCObjectGraphCoders.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCObjectGraphCoders.mm; sourceTree = "<group>"; }; 2078 2086 BC8F2F2816273A2B005FACB5 /* WKWebProcessPlugInBrowserContextController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInBrowserContextController.mm; sourceTree = "<group>"; }; 2079 2087 BC8F2F2916273A2C005FACB5 /* WKWebProcessPlugInBrowserContextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInBrowserContextController.h; sourceTree = "<group>"; }; … … 3776 3784 isa = PBXGroup; 3777 3785 children = ( 3786 BC8ACA0F16670D7A004C1941 /* ObjCObjectGraph.h */, 3787 BC8ACA1016670D7B004C1941 /* ObjCObjectGraph.mm */, 3788 BC8ACA1116670D7E004C1941 /* ObjCObjectGraphCoders.h */, 3789 BC8ACA1216670D83004C1941 /* ObjCObjectGraphCoders.mm */, 3778 3790 E179FD9B134D38060015B883 /* ArgumentCodersMac.h */, 3779 3791 E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */, … … 3790 3802 31EA25D0134F78B2005B1452 /* NativeWebMouseEventMac.mm */, 3791 3803 DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */, 3804 C574A57F12E66681002DFE98 /* PasteboardTypes.h */, 3805 C574A58012E66681002DFE98 /* PasteboardTypes.mm */, 3792 3806 E19582D2153CBFD700B60875 /* PDFKitImports.h */, 3793 3807 E19582D4153CC05300B60875 /* PDFKitImports.mm */, 3794 C574A57F12E66681002DFE98 /* PasteboardTypes.h */,3795 C574A58012E66681002DFE98 /* PasteboardTypes.mm */,3796 3808 BCF505E51243047B005955AE /* PlatformCertificateInfo.h */, 3797 3809 BCF505E61243047B005955AE /* PlatformCertificateInfo.mm */, … … 5003 5015 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */, 5004 5016 5175944B1657080400DD771D /* NetworkResourceLoaderMessages.h in Headers */, 5017 BC8ACA1316670D89004C1941 /* ObjCObjectGraph.h in Headers */, 5018 BC8ACA1516670D89004C1941 /* ObjCObjectGraphCoders.h in Headers */, 5005 5019 ); 5006 5020 runOnlyForDeploymentPostprocessing = 0; … … 5957 5971 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */, 5958 5972 5175944A1657080400DD771D /* NetworkResourceLoaderMessageReceiver.cpp in Sources */, 5973 BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */, 5974 BC8ACA1616670D89004C1941 /* ObjCObjectGraphCoders.mm in Sources */, 5959 5975 ); 5960 5976 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.mm
r133558 r136095 124 124 } 125 125 126 - (WKWebProcessPlugInBrowserContextController *)_browserContextControllerForBundlePageRef:(WKBundlePageRef)pageRef 127 { 128 ASSERT(_bundlePageWrapperCache.contains(pageRef)); 129 return _bundlePageWrapperCache.get(pageRef).get(); 130 } 131 126 132 @end 127 133 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInInternal.h
r131264 r136095 33 33 - (id)_initWithPrincipalClassInstance:(id<WKWebProcessPlugIn>)principalClassInstance bundleRef:(WKBundleRef)bundleRef; 34 34 35 - (WKWebProcessPlugInBrowserContextController *)_browserContextControllerForBundlePageRef:(WKBundlePageRef)pageRef; 36 35 37 @end 36 38 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
r132926 r136095 33 33 #include "WebPageGroupProxy.h" 34 34 #include "WebProcess.h" 35 36 #if PLATFORM(MAC) 37 #include "ObjCObjectGraphCoders.h" 38 #endif 35 39 36 40 namespace WebKit { … … 72 76 break; 73 77 } 78 #if PLATFORM(MAC) 79 case APIObject::TypeObjCObjectGraph: { 80 ObjCObjectGraph* objectGraph = static_cast<ObjCObjectGraph*>(m_root); 81 encoder << InjectedBundleObjCObjectGraphEncoder(objectGraph); 82 break; 83 } 84 #endif 74 85 default: 75 86 ASSERT_NOT_REACHED(); … … 129 140 break; 130 141 } 142 #if PLATFORM(MAC) 143 case APIObject::TypeObjCObjectGraph: { 144 RefPtr<ObjCObjectGraph> objectGraph; 145 InjectedBundleObjCObjectGraphDecoder objectGraphDecoder(objectGraph, &WebProcess::shared()); 146 if (!decoder->decode(objectGraphDecoder)) 147 return false; 148 coder.m_root = objectGraph.get(); 149 break; 150 } 151 #endif 131 152 default: 132 153 return false;
Note:
See TracChangeset
for help on using the changeset viewer.