Title: [185803] trunk/Source/WebKit2
Revision
185803
Author
[email protected]
Date
2015-06-20 20:27:20 -0700 (Sat, 20 Jun 2015)

Log Message

[Cocoa] Actually use Objective-C lightweight generics when the compiler supports them
https://bugs.webkit.org/show_bug.cgi?id=146183

Reviewed by Sam Weinig.

* Shared/API/Cocoa/WKFoundation.h: When the compiler supports Objective-C generics, define
WK_ARRAY and WK_SET to use them. Also added a definition of WK_DICTIONARY.

* UIProcess/API/Cocoa/WKWebViewPrivate.h: Use WK_DICTIONARY for the options dictionary of
-_loadRequest:withOptions:.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]): Made the completion
halder type match the declaration, now that NSArray and WK_ARRAY(WKWebsiteDataRecord *) are
not the same.

* mac/postprocess-framework-headers.sh: Also rewrite WK_DICTIONARY.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185802 => 185803)


--- trunk/Source/WebKit2/ChangeLog	2015-06-20 23:00:45 UTC (rev 185802)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-21 03:27:20 UTC (rev 185803)
@@ -1,3 +1,23 @@
+2015-06-20  Dan Bernstein  <[email protected]>
+
+        [Cocoa] Actually use Objective-C lightweight generics when the compiler supports them
+        https://bugs.webkit.org/show_bug.cgi?id=146183
+
+        Reviewed by Sam Weinig.
+
+        * Shared/API/Cocoa/WKFoundation.h: When the compiler supports Objective-C generics, define
+        WK_ARRAY and WK_SET to use them. Also added a definition of WK_DICTIONARY.
+
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h: Use WK_DICTIONARY for the options dictionary of
+        -_loadRequest:withOptions:.
+
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]): Made the completion
+        halder type match the declaration, now that NSArray and WK_ARRAY(WKWebsiteDataRecord *) are
+        not the same.
+
+        * mac/postprocess-framework-headers.sh: Also rewrite WK_DICTIONARY.
+
 2015-06-20  Chris Dumez  <[email protected]>
 
         [WK2][iOS] Avoid synchronous IPC on view state change when the content is not visible

Modified: trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h (185802 => 185803)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h	2015-06-20 23:00:45 UTC (rev 185802)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h	2015-06-21 03:27:20 UTC (rev 185803)
@@ -49,9 +49,20 @@
 #define WK_ENUM_AVAILABLE(_mac, _ios)
 #define WK_ENUM_AVAILABLE_IOS(_ios)
 
+#if __has_feature(objc_generics)
+
+#define WK_ARRAY(_objectType) NSArray<_objectType>
+#define WK_DICTIONARY(_keyType, _valueType) NSDictionary<_keyType, _valueType>
+#define WK_SET(_objectType) NSSet<_objectType>
+
+#else
+
 #define WK_ARRAY(...) NSArray
+#define WK_DICTIONARY(...) NSDictionary
 #define WK_SET(...) NSSet
 
+#endif
+
 #ifndef __NSi_8_3
 #define __NSi_8_3 introduced=8.3
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (185802 => 185803)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-06-20 23:00:45 UTC (rev 185802)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2015-06-21 03:27:20 UTC (rev 185803)
@@ -205,7 +205,7 @@
 @property (nonatomic, setter=_setScrollPerformanceDataCollectionEnabled:) BOOL _scrollPerformanceDataCollectionEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, readonly) NSArray *_scrollPerformanceData WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
-- (WKNavigation *)_loadRequest:(NSURLRequest *)request withOptions:(NSDictionary *)loadOptions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+- (WKNavigation *)_loadRequest:(NSURLRequest *)request withOptions:(WK_DICTIONARY(NSString *, id) *)loadOptions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 @end
 

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (185802 => 185803)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2015-06-20 23:00:45 UTC (rev 185802)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm	2015-06-21 03:27:20 UTC (rev 185803)
@@ -74,7 +74,7 @@
     return system_clock::time_point(duration_cast<system_clock::duration>(duration<double>(date.timeIntervalSince1970)));
 }
 
-- (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(NSArray *))completionHandler
+- (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(WK_ARRAY(WKWebsiteDataRecord *) *))completionHandler
 {
     auto completionHandlerCopy = Block_copy(completionHandler);
 

Modified: trunk/Source/WebKit2/mac/postprocess-framework-headers.sh (185802 => 185803)


--- trunk/Source/WebKit2/mac/postprocess-framework-headers.sh	2015-06-20 23:00:45 UTC (rev 185802)
+++ trunk/Source/WebKit2/mac/postprocess-framework-headers.sh	2015-06-21 03:27:20 UTC (rev 185803)
@@ -59,6 +59,7 @@
 
     SED_OPTIONS=(
         -e 's/WK_ARRAY\(([^\)]+)\)/NSArray<\1>/g'
+        -e 's/WK_DICTIONARY\(([^\)]+)\)/NSDictionary<\1>/g'
         -e 's/WK_SET\(([^\)]+)\)/NSSet<\1>/g'
         -e s/WK_ASSUME_NONNULL_BEGIN/NS_ASSUME_NONNULL_BEGIN/
         -e s/WK_ASSUME_NONNULL_END/NS_ASSUME_NONNULL_END/
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to