[Cocoa] Remove some indirection that was only necessary for supporting the legacy...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Nov 2013 23:50:27 +0000 (23:50 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Nov 2013 23:50:27 +0000 (23:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123065

Reviewed by Sam Weinig.

* UIProcess/API/mac/WKBrowsingContextController.h: Removed _data ivar and
WKBrowsingContextControllerData class declaration.
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController dealloc]): Removed
WKBrowsingContextControllerData class and moved ivars directly into
WKBrowsingContextController, declaring them in the @implementation. Removed ivar and
accessors for the delegate properties, letting the compiler synthesize them.
(-[WKBrowsingContextController _pageRef]): Removed indirection via _data.
(-[WKBrowsingContextController loadRequest:userData:]): Removed indirection via -_pageRef.
(-[WKBrowsingContextController loadFileURL:restrictToFilesWithin:userData:]): Ditto.
(-[WKBrowsingContextController loadHTMLString:baseURL:userData:]): Ditto.
(-[WKBrowsingContextController loadData:MIMEType:textEncodingName:baseURL:userData:]): Ditto.
(-[WKBrowsingContextController stopLoading]): Ditto.
(-[WKBrowsingContextController reload]): Ditto.
(-[WKBrowsingContextController reloadFromOrigin]): Ditto.
(-[WKBrowsingContextController goForward]): Ditto.
(-[WKBrowsingContextController canGoForward]): Ditto.
(-[WKBrowsingContextController goBack]): Ditto.
(-[WKBrowsingContextController canGoBack]): Ditto.
(-[WKBrowsingContextController goToBackForwardListItem:]): Ditto.
(-[WKBrowsingContextController backForwardList]): Ditto.
(-[WKBrowsingContextController activeURL]): Ditto.
(-[WKBrowsingContextController provisionalURL]): Ditto.
(-[WKBrowsingContextController committedURL]): Ditto.
(-[WKBrowsingContextController unreachableURL]): Removed idirection via _data.
(-[WKBrowsingContextController estimatedProgress]): Removed indirection via -_pageRef.
(-[WKBrowsingContextController title]): Ditto.
(-[WKBrowsingContextController textZoom]): Ditto.
(-[WKBrowsingContextController setTextZoom:]): Ditto.
(-[WKBrowsingContextController pageZoom]): Ditto.
(-[WKBrowsingContextController setPageZoom:]): Ditto.
(-[WKBrowsingContextController setPaginationMode:]): Ditto.
(-[WKBrowsingContextController paginationMode]): Ditto.
(-[WKBrowsingContextController setPaginationBehavesLikeColumns:]): Ditto.
(-[WKBrowsingContextController paginationBehavesLikeColumns]): Ditto.
(-[WKBrowsingContextController setPageLength:]): Ditto.
(-[WKBrowsingContextController pageLength]): Ditto.
(-[WKBrowsingContextController setGapBetweenPages:]): Ditto.
(-[WKBrowsingContextController gapBetweenPages]): Ditto.
(-[WKBrowsingContextController pageCount]): Ditto.
(-[WKBrowsingContextController handle]): Ditto.
(-[WKBrowsingContextController _initWithPageRef:]): Removed indirection via _data.

* UIProcess/API/mac/WKBrowsingContextGroup.h: Removed _data ivar and
WKBrowsingContextGroupData class declaration.
* UIProcess/API/mac/WKBrowsingContextGroup.mm: Removed WKBrowsingContextGroupData class and
moved _pageGroupRef ivar directly into WKBrowsingContextGroup, declaring it in the
@implementation.
(-[WKBrowsingContextGroup initWithIdentifier:]): Removed indirection via _data.
(-[WKBrowsingContextGroup allowsJavaScript]): Removed indirection via -_pageGroupRef.
(-[WKBrowsingContextGroup setAllowsJavaScript:]): Ditto.
(-[WKBrowsingContextGroup allowsJavaScriptMarkup]): Ditto.
(-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]): Ditto.
(-[WKBrowsingContextGroup allowsPlugIns]): Ditto.
(-[WKBrowsingContextGroup setAllowsPlugIns:]): Ditto.
(-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): Ditto.
(-[WKBrowsingContextGroup removeAllUserStyleSheets]): Ditto.
(-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): Ditto.
(-[WKBrowsingContextGroup removeAllUserScripts]): Ditto.
(-[WKBrowsingContextGroup _pageGroupRef]): Removed indirection via _data.

* UIProcess/API/mac/WKConnection.h: Removed _data ivar and WKConnectionData class declaration.
* UIProcess/API/mac/WKConnection.mm: Removed WKConnectionData class and moved _connectionRef
ivar directly into WKConnection, declaring it in the @implementation. Removed ivar and
accessors for the delegate property, letting the compiler synthesize them.
(-[WKConnection dealloc]): Removed indirection via _data.
(-[WKConnection sendMessageWithName:body:]): Ditto.
(-[WKConnection remoteObjectRegistry]): Ditto.
(didReceiveMessage): Ditto.
(-[WKConnection _initWithConnectionRef:]): Ditto.

* UIProcess/API/mac/WKProcessGroup.h: Replaced forward declaration of WKConnection with an
import. Removed _data ivar and WKProcessGroupData class declaration.
* UIProcess/API/mac/WKProcessGroup.mm: Removed WKProcessGroupData class and moved
_contextRef ivar directly into WKProcessGroup, declaring it in the @implementation. Removed
ivar and accessors for the delegate property, letting the compiler synthesize them.
(-[WKProcessGroup initWithInjectedBundleURL:]): Removed indirection via _data.
(-[WKProcessGroup dealloc]): Ditto.
(-[WKProcessGroup _contextRef]): Ditto.
(-[WKProcessGroup _geolocationProvider]): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159770 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.h
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextGroup.mm
Source/WebKit2/UIProcess/API/mac/WKConnection.h
Source/WebKit2/UIProcess/API/mac/WKConnection.mm
Source/WebKit2/UIProcess/API/mac/WKProcessGroup.h
Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm

index 41e95a3..452e42b 100644 (file)
@@ -1,3 +1,91 @@
+2013-11-25  Dan Bernstein  <mitz@apple.com>
+
+        [Cocoa] Remove some indirection that was only necessary for supporting the legacy Objective-C runtime
+        https://bugs.webkit.org/show_bug.cgi?id=123065
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/mac/WKBrowsingContextController.h: Removed _data ivar and
+        WKBrowsingContextControllerData class declaration.
+        * UIProcess/API/mac/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController dealloc]): Removed
+        WKBrowsingContextControllerData class and moved ivars directly into
+        WKBrowsingContextController, declaring them in the @implementation. Removed ivar and
+        accessors for the delegate properties, letting the compiler synthesize them.
+        (-[WKBrowsingContextController _pageRef]): Removed indirection via _data.
+        (-[WKBrowsingContextController loadRequest:userData:]): Removed indirection via -_pageRef.
+        (-[WKBrowsingContextController loadFileURL:restrictToFilesWithin:userData:]): Ditto.
+        (-[WKBrowsingContextController loadHTMLString:baseURL:userData:]): Ditto.
+        (-[WKBrowsingContextController loadData:MIMEType:textEncodingName:baseURL:userData:]): Ditto.
+        (-[WKBrowsingContextController stopLoading]): Ditto.
+        (-[WKBrowsingContextController reload]): Ditto.
+        (-[WKBrowsingContextController reloadFromOrigin]): Ditto.
+        (-[WKBrowsingContextController goForward]): Ditto.
+        (-[WKBrowsingContextController canGoForward]): Ditto.
+        (-[WKBrowsingContextController goBack]): Ditto.
+        (-[WKBrowsingContextController canGoBack]): Ditto.
+        (-[WKBrowsingContextController goToBackForwardListItem:]): Ditto.
+        (-[WKBrowsingContextController backForwardList]): Ditto.
+        (-[WKBrowsingContextController activeURL]): Ditto.
+        (-[WKBrowsingContextController provisionalURL]): Ditto.
+        (-[WKBrowsingContextController committedURL]): Ditto.
+        (-[WKBrowsingContextController unreachableURL]): Removed idirection via _data.
+        (-[WKBrowsingContextController estimatedProgress]): Removed indirection via -_pageRef.
+        (-[WKBrowsingContextController title]): Ditto.
+        (-[WKBrowsingContextController textZoom]): Ditto.
+        (-[WKBrowsingContextController setTextZoom:]): Ditto.
+        (-[WKBrowsingContextController pageZoom]): Ditto.
+        (-[WKBrowsingContextController setPageZoom:]): Ditto.
+        (-[WKBrowsingContextController setPaginationMode:]): Ditto.
+        (-[WKBrowsingContextController paginationMode]): Ditto.
+        (-[WKBrowsingContextController setPaginationBehavesLikeColumns:]): Ditto.
+        (-[WKBrowsingContextController paginationBehavesLikeColumns]): Ditto.
+        (-[WKBrowsingContextController setPageLength:]): Ditto.
+        (-[WKBrowsingContextController pageLength]): Ditto.
+        (-[WKBrowsingContextController setGapBetweenPages:]): Ditto.
+        (-[WKBrowsingContextController gapBetweenPages]): Ditto.
+        (-[WKBrowsingContextController pageCount]): Ditto.
+        (-[WKBrowsingContextController handle]): Ditto.
+        (-[WKBrowsingContextController _initWithPageRef:]): Removed indirection via _data.
+
+        * UIProcess/API/mac/WKBrowsingContextGroup.h: Removed _data ivar and
+        WKBrowsingContextGroupData class declaration.
+        * UIProcess/API/mac/WKBrowsingContextGroup.mm: Removed WKBrowsingContextGroupData class and
+        moved _pageGroupRef ivar directly into WKBrowsingContextGroup, declaring it in the
+        @implementation.
+        (-[WKBrowsingContextGroup initWithIdentifier:]): Removed indirection via _data.
+        (-[WKBrowsingContextGroup allowsJavaScript]): Removed indirection via -_pageGroupRef.
+        (-[WKBrowsingContextGroup setAllowsJavaScript:]): Ditto.
+        (-[WKBrowsingContextGroup allowsJavaScriptMarkup]): Ditto.
+        (-[WKBrowsingContextGroup setAllowsJavaScriptMarkup:]): Ditto.
+        (-[WKBrowsingContextGroup allowsPlugIns]): Ditto.
+        (-[WKBrowsingContextGroup setAllowsPlugIns:]): Ditto.
+        (-[WKBrowsingContextGroup addUserStyleSheet:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:mainFrameOnly:]): Ditto.
+        (-[WKBrowsingContextGroup removeAllUserStyleSheets]): Ditto.
+        (-[WKBrowsingContextGroup addUserScript:baseURL:whitelistedURLPatterns:blacklistedURLPatterns:injectionTime:mainFrameOnly:]): Ditto.
+        (-[WKBrowsingContextGroup removeAllUserScripts]): Ditto.
+        (-[WKBrowsingContextGroup _pageGroupRef]): Removed indirection via _data.
+
+        * UIProcess/API/mac/WKConnection.h: Removed _data ivar and WKConnectionData class declaration.
+        * UIProcess/API/mac/WKConnection.mm: Removed WKConnectionData class and moved _connectionRef
+        ivar directly into WKConnection, declaring it in the @implementation. Removed ivar and
+        accessors for the delegate property, letting the compiler synthesize them.
+        (-[WKConnection dealloc]): Removed indirection via _data.
+        (-[WKConnection sendMessageWithName:body:]): Ditto.
+        (-[WKConnection remoteObjectRegistry]): Ditto.
+        (didReceiveMessage): Ditto.
+        (-[WKConnection _initWithConnectionRef:]): Ditto.
+
+        * UIProcess/API/mac/WKProcessGroup.h: Replaced forward declaration of WKConnection with an
+        import. Removed _data ivar and WKProcessGroupData class declaration.
+        * UIProcess/API/mac/WKProcessGroup.mm: Removed WKProcessGroupData class and moved
+        _contextRef ivar directly into WKProcessGroup, declaring it in the @implementation. Removed
+        ivar and accessors for the delegate property, letting the compiler synthesize them.
+        (-[WKProcessGroup initWithInjectedBundleURL:]): Removed indirection via _data.
+        (-[WKProcessGroup dealloc]): Ditto.
+        (-[WKProcessGroup _contextRef]): Ditto.
+        (-[WKProcessGroup _geolocationProvider]): Ditto.
+
 2013-11-25  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r159740.
index 6a77729..7dfb1d8 100644 (file)
@@ -28,7 +28,6 @@
 
 #if WK_API_ENABLED
 
-@class WKBrowsingContextControllerData;
 @class WKBackForwardList;
 @class WKBackForwardListItem;
 @protocol WKBrowsingContextHistoryDelegate;
 @protocol WKBrowsingContextPolicyDelegate;
 
 WK_API_CLASS
-@interface WKBrowsingContextController : NSObject {
-@private
-    WKBrowsingContextControllerData *_data;
-}
+@interface WKBrowsingContextController : NSObject
 
 #pragma mark Delegates
 
index cea7799..fc40d55 100644 (file)
@@ -97,64 +97,25 @@ NSString * const WKActionFrameNameKey = @"WKActionFrameNameKey";
 NSString * const WKActionOriginatingFrameURLKey = @"WKActionOriginatingFrameURLKey";
 NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
 
-@interface WKBrowsingContextControllerData : NSObject {
-@public
+@implementation WKBrowsingContextController {
     // Underlying WKPageRef.
     WKRetainPtr<WKPageRef> _pageRef;
-    
-    // Delegate for load callbacks.
-    id<WKBrowsingContextLoadDelegate> _loadDelegate;
-#if PLATFORM(IOS)
-    id <WKBrowsingContextLoadDelegateInternal> _loadDelegateInternal;
-#endif // PLATFORM(IOS)
-
-    // Delegate for policy callbacks.
-    id<WKBrowsingContextPolicyDelegate> _policyDelegate;
 
     std::unique_ptr<PageLoadStateObserver> _pageLoadStateObserver;
 }
-@end
-
-@implementation WKBrowsingContextControllerData
-@end
-
-@implementation WKBrowsingContextController
 
 - (void)dealloc
 {
-    toImpl(_data->_pageRef.get())->pageLoadState().removeObserver(*_data->_pageLoadStateObserver);
-    WKPageSetPageLoaderClient(_data->_pageRef.get(), nullptr);
-    WKPageSetPagePolicyClient(_data->_pageRef.get(), nullptr);
+    toImpl(_pageRef.get())->pageLoadState().removeObserver(*_pageLoadStateObserver);
+    WKPageSetPageLoaderClient(_pageRef.get(), nullptr);
+    WKPageSetPagePolicyClient(_pageRef.get(), nullptr);
 
-    [_data release];
     [super dealloc];
 }
 
 - (WKPageRef)_pageRef
 {
-    return _data->_pageRef.get();
-}
-
-#pragma mark Delegates
-
-- (id<WKBrowsingContextLoadDelegate>)loadDelegate
-{
-    return _data->_loadDelegate;
-}
-
-- (void)setLoadDelegate:(id<WKBrowsingContextLoadDelegate>)loadDelegate
-{
-    _data->_loadDelegate = loadDelegate;
-}
-
-- (id<WKBrowsingContextPolicyDelegate>)policyDelegate
-{
-    return _data->_policyDelegate;
-}
-
-- (void)setPolicyDelegate:(id<WKBrowsingContextPolicyDelegate>)policyDelegate
-{
-    _data->_policyDelegate = policyDelegate;
+    return _pageRef.get();
 }
 
 #pragma mark Loading
@@ -192,7 +153,7 @@ NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
     if (userData)
         wkUserData = ObjCObjectGraph::create(userData);
 
-    WKPageLoadURLRequestWithUserData(self._pageRef, wkRequest.get(), (WKTypeRef)wkUserData.get());
+    WKPageLoadURLRequestWithUserData(_pageRef.get(), wkRequest.get(), (WKTypeRef)wkUserData.get());
 }
 
 - (void)loadFileURL:(NSURL *)URL restrictToFilesWithin:(NSURL *)allowedDirectory
@@ -212,7 +173,7 @@ NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
     if (userData)
         wkUserData = ObjCObjectGraph::create(userData);
 
-    WKPageLoadFileWithUserData(self._pageRef, wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
+    WKPageLoadFileWithUserData(_pageRef.get(), wkURL.get(), wkAllowedDirectory.get(), (WKTypeRef)wkUserData.get());
 }
 
 - (void)loadHTMLString:(NSString *)HTMLString baseURL:(NSURL *)baseURL
@@ -234,7 +195,7 @@ NSString * const WKActionCanShowMIMETypeKey = @"WKActionCanShowMIMETypeKey";
     if (userData)
         wkUserData = ObjCObjectGraph::create(userData);
 
-    WKPageLoadHTMLStringWithUserData(self._pageRef, wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
+    WKPageLoadHTMLStringWithUserData(_pageRef.get(), wkHTMLString.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
 }
 
 - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL
@@ -271,54 +232,54 @@ static void releaseNSData(unsigned char*, const void* data)
     if (userData)
         wkUserData = ObjCObjectGraph::create(userData);
 
-    WKPageLoadDataWithUserData(self._pageRef, toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
+    WKPageLoadDataWithUserData(_pageRef.get(), toAPI(wkData.get()), wkMIMEType.get(), wkEncodingName.get(), wkBaseURL.get(), (WKTypeRef)wkUserData.get());
 }
 
 - (void)stopLoading
 {
-    WKPageStopLoading(self._pageRef);
+    WKPageStopLoading(_pageRef.get());
 }
 
 - (void)reload
 {
-    WKPageReload(self._pageRef);
+    WKPageReload(_pageRef.get());
 }
 
 - (void)reloadFromOrigin
 {
-    WKPageReloadFromOrigin(self._pageRef);
+    WKPageReloadFromOrigin(_pageRef.get());
 }
 
 #pragma mark Back/Forward
 
 - (void)goForward
 {
-    WKPageGoForward(self._pageRef);
+    WKPageGoForward(_pageRef.get());
 }
 
 - (BOOL)canGoForward
 {
-    return WKPageCanGoForward(self._pageRef);
+    return WKPageCanGoForward(_pageRef.get());
 }
 
 - (void)goBack
 {
-    WKPageGoBack(self._pageRef);
+    WKPageGoBack(_pageRef.get());
 }
 
 - (BOOL)canGoBack
 {
-    return WKPageCanGoBack(self._pageRef);
+    return WKPageCanGoBack(_pageRef.get());
 }
 
 - (void)goToBackForwardListItem:(WKBackForwardListItem *)item
 {
-    toImpl(self._pageRef)->goToBackForwardItem(&item._item);
+    toImpl(_pageRef.get())->goToBackForwardItem(&item._item);
 }
 
 - (WKBackForwardList *)backForwardList
 {
-    WebBackForwardList* list = toImpl(self._pageRef)->backForwardList();
+    WebBackForwardList* list = toImpl(_pageRef.get())->backForwardList();
     if (!list)
         return nil;
 
@@ -329,56 +290,56 @@ static void releaseNSData(unsigned char*, const void* data)
 
 - (NSURL *)activeURL
 {
-    return autoreleased(WKPageCopyActiveURL(self._pageRef));
+    return autoreleased(WKPageCopyActiveURL(_pageRef.get()));
 }
 
 - (NSURL *)provisionalURL
 {
-    return autoreleased(WKPageCopyProvisionalURL(self._pageRef));
+    return autoreleased(WKPageCopyProvisionalURL(_pageRef.get()));
 }
 
 - (NSURL *)committedURL
 {
-    return autoreleased(WKPageCopyCommittedURL(self._pageRef));
+    return autoreleased(WKPageCopyCommittedURL(_pageRef.get()));
 }
 
 - (NSURL *)unreachableURL
 {
-    return [NSURL _web_URLWithWTFString:toImpl(_data->_pageRef.get())->pageLoadState().unreachableURL() relativeToURL:nil];
+    return [NSURL _web_URLWithWTFString:toImpl(_pageRef.get())->pageLoadState().unreachableURL() relativeToURL:nil];
 }
 
 - (double)estimatedProgress
 {
-    return toImpl(self._pageRef)->estimatedProgress();
+    return toImpl(_pageRef.get())->estimatedProgress();
 }
 
 #pragma mark Active Document Introspection
 
 - (NSString *)title
 {
-    return autoreleased(WKPageCopyTitle(self._pageRef));
+    return autoreleased(WKPageCopyTitle(_pageRef.get()));
 }
 
 #pragma mark Zoom
 
 - (CGFloat)textZoom
 {
-    return WKPageGetTextZoomFactor(self._pageRef);
+    return WKPageGetTextZoomFactor(_pageRef.get());
 }
 
 - (void)setTextZoom:(CGFloat)textZoom
 {
-    return WKPageSetTextZoomFactor(self._pageRef, textZoom);
+    return WKPageSetTextZoomFactor(_pageRef.get(), textZoom);
 }
 
 - (CGFloat)pageZoom
 {
-    return WKPageGetPageZoomFactor(self._pageRef);
+    return WKPageGetPageZoomFactor(_pageRef.get());
 }
 
 - (void)setPageZoom:(CGFloat)pageZoom
 {
-    return WKPageSetPageZoomFactor(self._pageRef, pageZoom);
+    return WKPageSetPageZoomFactor(_pageRef.get(), pageZoom);
 }
 
 @end
@@ -408,12 +369,12 @@ static void releaseNSData(unsigned char*, const void* data)
         return;
     }
 
-    WKPageSetPaginationMode(self._pageRef, mode);
+    WKPageSetPaginationMode(_pageRef.get(), mode);
 }
 
 - (WKBrowsingContextPaginationMode)paginationMode
 {
-    switch (WKPageGetPaginationMode(self._pageRef)) {
+    switch (WKPageGetPaginationMode(_pageRef.get())) {
     case kWKPaginationModeUnpaginated:
         return WKPaginationModeUnpaginated;
     case kWKPaginationModeLeftToRight:
@@ -432,42 +393,42 @@ static void releaseNSData(unsigned char*, const void* data)
 
 - (void)setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
 {
-    WKPageSetPaginationBehavesLikeColumns(self._pageRef, behavesLikeColumns);
+    WKPageSetPaginationBehavesLikeColumns(_pageRef.get(), behavesLikeColumns);
 }
 
 - (BOOL)paginationBehavesLikeColumns
 {
-    return WKPageGetPaginationBehavesLikeColumns(self._pageRef);
+    return WKPageGetPaginationBehavesLikeColumns(_pageRef.get());
 }
 
 - (void)setPageLength:(CGFloat)pageLength
 {
-    WKPageSetPageLength(self._pageRef, pageLength);
+    WKPageSetPageLength(_pageRef.get(), pageLength);
 }
 
 - (CGFloat)pageLength
 {
-    return WKPageGetPageLength(self._pageRef);
+    return WKPageGetPageLength(_pageRef.get());
 }
 
 - (void)setGapBetweenPages:(CGFloat)gapBetweenPages
 {
-    WKPageSetGapBetweenPages(self._pageRef, gapBetweenPages);
+    WKPageSetGapBetweenPages(_pageRef.get(), gapBetweenPages);
 }
 
 - (CGFloat)gapBetweenPages
 {
-    return WKPageGetGapBetweenPages(self._pageRef);
+    return WKPageGetGapBetweenPages(_pageRef.get());
 }
 
 - (NSUInteger)pageCount
 {
-    return WKPageGetPageCount(self._pageRef);
+    return WKPageGetPageCount(_pageRef.get());
 }
 
 - (WKBrowsingContextHandle *)handle
 {
-    return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(self._pageRef)->pageID()] autorelease];
+    return [[[WKBrowsingContextHandle alloc] _initWithPageID:toImpl(_pageRef.get())->pageID()] autorelease];
 }
 
 @end
@@ -686,18 +647,6 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
     WKPageSetPagePolicyClient(pageRef, &policyClient);
 }
 
-#if PLATFORM(IOS)
-- (id <WKBrowsingContextLoadDelegateInternal>)loadDelegateInternal
-{
-    return _data->_loadDelegateInternal;
-}
-
-- (void)setLoadDelegateInternal:(id <WKBrowsingContextLoadDelegateInternal>)loadDelegateInternal
-{
-    _data->_loadDelegateInternal = loadDelegateInternal;
-}
-#endif // PLATFORM(IOS)
-
 /* This should only be called from associate view. */
 
 - (id)_initWithPageRef:(WKPageRef)pageRef
@@ -706,11 +655,10 @@ static void setUpPagePolicyClient(WKBrowsingContextController *browsingContext,
     if (!self)
         return nil;
 
-    _data = [[WKBrowsingContextControllerData alloc] init];
-    _data->_pageRef = pageRef;
+    _pageRef = pageRef;
 
-    _data->_pageLoadStateObserver = std::make_unique<PageLoadStateObserver>(self);
-    toImpl(_data->_pageRef.get())->pageLoadState().addObserver(*_data->_pageLoadStateObserver);
+    _pageLoadStateObserver = std::make_unique<PageLoadStateObserver>(self);
+    toImpl(_pageRef.get())->pageLoadState().addObserver(*_pageLoadStateObserver);
 
     setUpPageLoaderClient(self, pageRef);
     setUpPagePolicyClient(self, pageRef);
index 66ca0c8..e050c2b 100644 (file)
 #import <Foundation/Foundation.h>
 #import <WebKit2/WKUserScriptInjectionTime.h>
 
-@class WKBrowsingContextGroupData;
-
 WK_API_CLASS
-@interface WKBrowsingContextGroup : NSObject {
-@private
-    WKBrowsingContextGroupData *_data;
-}
+@interface WKBrowsingContextGroup : NSObject
 
 - (id)initWithIdentifier:(NSString *)identifier;
 
index 93e686d..4490cc3 100644 (file)
 
 using namespace WebKit;
 
-@interface WKBrowsingContextGroupData : NSObject {
-@public
+@implementation WKBrowsingContextGroup {
     WKRetainPtr<WKPageGroupRef> _pageGroupRef;
 }
-@end
-
-@implementation WKBrowsingContextGroupData
-@end
-
-@implementation WKBrowsingContextGroup
 
 - (id)initWithIdentifier:(NSString *)identifier
 {
@@ -59,52 +52,45 @@ using namespace WebKit;
     if (!self)
         return nil;
 
-    _data = [[WKBrowsingContextGroupData alloc] init];
-    _data->_pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(adoptWK(WKStringCreateWithCFString((CFStringRef)identifier)).get()));
+    _pageGroupRef = adoptWK(WKPageGroupCreateWithIdentifier(adoptWK(WKStringCreateWithCFString((CFStringRef)identifier)).get()));
 
     // Give the WKBrowsingContextGroup a identifier-less preferences, so that they
     // don't get automatically written to the disk. The automatic writing has proven
     // confusing to users of the API.
     WKRetainPtr<WKPreferencesRef> preferences = adoptWK(WKPreferencesCreate());
-    WKPageGroupSetPreferences(_data->_pageGroupRef.get(), preferences.get());
+    WKPageGroupSetPreferences(_pageGroupRef.get(), preferences.get());
 
     return self;
 }
 
-- (void)dealloc
-{
-    [_data release];
-    [super dealloc];
-}
-
 - (BOOL)allowsJavaScript
 {
-    return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(self._pageGroupRef));
+    return WKPreferencesGetJavaScriptEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
 }
 
 - (void)setAllowsJavaScript:(BOOL)allowsJavaScript
 {
-    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsJavaScript);
+    WKPreferencesSetJavaScriptEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsJavaScript);
 }
 
 - (BOOL)allowsJavaScriptMarkup
 {
-    return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(self._pageGroupRef));
+    return WKPreferencesGetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
 }
 
 - (void)setAllowsJavaScriptMarkup:(BOOL)allowsJavaScriptMarkup
 {
-    WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsJavaScriptMarkup);
+    WKPreferencesSetJavaScriptMarkupEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsJavaScriptMarkup);
 }
 
 - (BOOL)allowsPlugIns
 {
-    return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(self._pageGroupRef));
+    return WKPreferencesGetPluginsEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()));
 }
 
 - (void)setAllowsPlugIns:(BOOL)allowsPlugIns
 {
-    WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(self._pageGroupRef), allowsPlugIns);
+    WKPreferencesSetPluginsEnabled(WKPageGroupGetPreferences(_pageGroupRef.get()), allowsPlugIns);
 }
 
 static WKRetainPtr<WKArrayRef> createWKArray(NSArray *array)
@@ -136,12 +122,12 @@ static WKRetainPtr<WKArrayRef> createWKArray(NSArray *array)
     auto wkBlacklist = createWKArray(blacklist);
     WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
 
-    WKPageGroupAddUserStyleSheet(self._pageGroupRef, wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
+    WKPageGroupAddUserStyleSheet(_pageGroupRef.get(), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames);
 }
 
 - (void)removeAllUserStyleSheets
 {
-    WKPageGroupRemoveAllUserStyleSheets(self._pageGroupRef);
+    WKPageGroupRemoveAllUserStyleSheets(_pageGroupRef.get());
 }
 
 - (void)addUserScript:(NSString *)source baseURL:(NSURL *)baseURL whitelistedURLPatterns:(NSArray *)whitelist blacklistedURLPatterns:(NSArray *)blacklist injectionTime:(WKUserScriptInjectionTime)injectionTime mainFrameOnly:(BOOL)mainFrameOnly
@@ -155,12 +141,12 @@ static WKRetainPtr<WKArrayRef> createWKArray(NSArray *array)
     auto wkBlacklist = createWKArray(blacklist);
     WKUserContentInjectedFrames injectedFrames = mainFrameOnly ? kWKInjectInTopFrameOnly : kWKInjectInAllFrames;
 
-    WKPageGroupAddUserScript(self._pageGroupRef, wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
+    WKPageGroupAddUserScript(_pageGroupRef.get(), wkSource.get(), wkBaseURL.get(), wkWhitelist.get(), wkBlacklist.get(), injectedFrames, injectionTime);
 }
 
 - (void)removeAllUserScripts
 {
-    WKPageGroupRemoveAllUserScripts(self._pageGroupRef);
+    WKPageGroupRemoveAllUserScripts(_pageGroupRef.get());
 }
 
 @end
@@ -169,7 +155,7 @@ static WKRetainPtr<WKArrayRef> createWKArray(NSArray *array)
 
 - (WKPageGroupRef)_pageGroupRef
 {
-    return _data->_pageGroupRef.get();
+    return _pageGroupRef.get();
 }
 
 @end
index e6fa3e1..7c7012c 100644 (file)
@@ -30,7 +30,6 @@
 #import <Foundation/Foundation.h>
 
 @class WKConnection;
-@class WKConnectionData;
 @class WKRemoteObjectRegistry;
 
 @protocol WKConnectionDelegate <NSObject>
 @end
 
 WK_API_CLASS
-@interface WKConnection : NSObject {
-@private
-    WKConnectionData *_data;
-}
+@interface WKConnection : NSObject
 
 - (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody;
 
-@property(assign) id <WKConnectionDelegate> delegate;
+@property (assign) id <WKConnectionDelegate> delegate;
 
 @property (nonatomic, readonly) WKRemoteObjectRegistry *remoteObjectRegistry;
 
index a1da0ff..0ce24ce 100644 (file)
 #import "WKConnectionRef.h"
 #import "WKData.h"
 #import "WKRetainPtr.h"
-#import "WKString.h"
 #import "WKStringCF.h"
 #import "WKRemoteObjectRegistryInternal.h"
 #import <wtf/RetainPtr.h>
 
 using namespace WebKit;
 
-@interface WKConnectionData : NSObject {
-@public
+@implementation WKConnection {
     // Underlying connection object.
     WKRetainPtr<WKConnectionRef> _connectionRef;
 
-    // Delegate for callbacks.
-    id<WKConnectionDelegate> _delegate;
-
     RetainPtr<WKRemoteObjectRegistry> _remoteObjectRegistry;
 }
-@end
-
-@implementation WKConnectionData
-@end
-
-@implementation WKConnection
 
 - (void)dealloc
 {
-    WKConnectionSetConnectionClient(_data->_connectionRef.get(), 0);
+    WKConnectionSetConnectionClient(_connectionRef.get(), 0);
 
-    [_data release];
     [super dealloc];
 }
 
@@ -69,25 +57,15 @@ using namespace WebKit;
     WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName));
     RefPtr<ObjCObjectGraph> wkMessageBody = ObjCObjectGraph::create(messageBody);
 
-    WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), (WKTypeRef)wkMessageBody.get());
-}
-
-- (id <WKConnectionDelegate>)delegate
-{
-    return _data->_delegate;
-}
-
-- (void)setDelegate:(id <WKConnectionDelegate>)delegate
-{
-    _data->_delegate = delegate;
+    WKConnectionPostMessage(_connectionRef.get(), wkMessageName.get(), (WKTypeRef)wkMessageBody.get());
 }
 
 - (WKRemoteObjectRegistry *)remoteObjectRegistry
 {
-    if (!_data->_remoteObjectRegistry)
-        _data->_remoteObjectRegistry = adoptNS([[WKRemoteObjectRegistry alloc] _initWithConnectionRef:_data->_connectionRef.get()]);
+    if (!_remoteObjectRegistry)
+        _remoteObjectRegistry = adoptNS([[WKRemoteObjectRegistry alloc] _initWithConnectionRef:_connectionRef.get()]);
 
-    return _data->_remoteObjectRegistry.get();
+    return _remoteObjectRegistry.get();
 }
 
 @end
@@ -98,7 +76,7 @@ static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRe
 {
     WKConnection *connection = (WKConnection *)clientInfo;
 
-    if ([connection->_data->_remoteObjectRegistry _handleMessageWithName:messageName body:messageBody])
+    if ([connection->_remoteObjectRegistry _handleMessageWithName:messageName body:messageBody])
         return;
 
     if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) {
@@ -136,10 +114,9 @@ static void setUpClient(WKConnection *connection, WKConnectionRef connectionRef)
     if (!self)
         return nil;
 
-    _data = [[WKConnectionData alloc] init];
-    _data->_connectionRef = connectionRef;
+    _connectionRef = connectionRef;
 
-    setUpClient(self, _data->_connectionRef.get());
+    setUpClient(self, _connectionRef.get());
 
     return self;
 }
index 0792018..22aa57e 100644 (file)
@@ -28,8 +28,9 @@
 #if WK_API_ENABLED
 
 #import <Foundation/Foundation.h>
+#import <WebKit2/WKConnection.h>
 
-@class WKProcessGroup, WKProcessGroupData, WKConnection;
+@class WKProcessGroup;
 
 @protocol WKProcessGroupDelegate <NSObject>
 @optional
 @end
 
 WK_API_CLASS
-@interface WKProcessGroup : NSObject {
-@private
-    WKProcessGroupData *_data;
-}
+@interface WKProcessGroup : NSObject
 
 - (id)initWithInjectedBundleURL:(NSURL *)bundleURL;
 
 
 #pragma mark Delegates
 
-@property(assign) id<WKProcessGroupDelegate> delegate;
+@property (assign) id <WKProcessGroupDelegate> delegate;
 
 @end
 
index bbd54c1..bc30372 100644 (file)
 
 using namespace WebKit;
 
-@interface WKProcessGroupData : NSObject {
-@public
+@implementation WKProcessGroup {
     // Underlying context object.
     WKRetainPtr<WKContextRef> _contextRef;
 
 #if PLATFORM(IOS)
     RetainPtr<WKGeolocationProviderIOS> _geolocationProvider;
 #endif // PLATFORM(IOS)
-
-    // Delegate for callbacks.
-    id<WKProcessGroupDelegate> _delegate;
 }
-@end
-
-@implementation WKProcessGroupData
-@end
-
-@implementation WKProcessGroup
 
 static void didCreateConnection(WKContextRef, WKConnectionRef connectionRef, const void* clientInfo)
 {
@@ -181,60 +171,47 @@ static void setUpHistoryClient(WKProcessGroup *processGroup, WKContextRef contex
     if (!self)
         return nil;
 
-    _data = [[WKProcessGroupData alloc] init];
-    
 #if PLATFORM(IOS)
-    // FIXME: Remove once <rdar://problem/15256572>  is fixed.
+    // FIXME: Remove once <rdar://problem/15256572> is fixed.
     InitWebCoreThreadSystemInterface();
 #endif
 
     if (bundleURL)
-        _data->_contextRef = adoptWK(WKContextCreateWithInjectedBundlePath(adoptWK(WKStringCreateWithCFString((CFStringRef)[bundleURL path])).get()));
+        _contextRef = adoptWK(WKContextCreateWithInjectedBundlePath(adoptWK(WKStringCreateWithCFString((CFStringRef)[bundleURL path])).get()));
     else
-        _data->_contextRef = adoptWK(WKContextCreate());
+        _contextRef = adoptWK(WKContextCreate());
 
-    setUpConnectionClient(self, _data->_contextRef.get());
-    setUpInectedBundleClient(self, _data->_contextRef.get());
-    setUpHistoryClient(self, _data->_contextRef.get());
+    setUpConnectionClient(self, _contextRef.get());
+    setUpInectedBundleClient(self, _contextRef.get());
+    setUpHistoryClient(self, _contextRef.get());
 
     return self;
 }
 
 - (void)dealloc
 {
-    WKContextSetConnectionClient(_data->_contextRef.get(), 0);
-    WKContextSetInjectedBundleClient(_data->_contextRef.get(), 0);
-    WKContextSetHistoryClient(_data->_contextRef.get(), 0);
+    WKContextSetConnectionClient(_contextRef.get(), 0);
+    WKContextSetInjectedBundleClient(_contextRef.get(), 0);
+    WKContextSetHistoryClient(_contextRef.get(), 0);
 
-    [_data release];
     [super dealloc];
 }
 
-- (id<WKProcessGroupDelegate>)delegate
-{
-    return _data->_delegate;
-}
-
-- (void)setDelegate:(id<WKProcessGroupDelegate>)delegate
-{
-    _data->_delegate = delegate;
-}
-
 @end
 
 @implementation WKProcessGroup (Private)
 
 - (WKContextRef)_contextRef
 {
-    return _data->_contextRef.get();
+    return _contextRef.get();
 }
 
 #if PLATFORM(IOS)
 - (WKGeolocationProviderIOS *)_geolocationProvider
 {
-    if (!_data->_geolocationProvider)
-        _data->_geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:toImpl(_data->_contextRef.get())]);
-    return _data->_geolocationProvider.get();
+    if (!_geolocationProvider)
+        _geolocationProvider = adoptNS([[WKGeolocationProviderIOS alloc] initWithContext:toImpl(_contextRef.get())]);
+    return _geolocationProvider.get();
 }
 #endif // PLATFORM(IOS)