⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185803 in webkit


Ignore:
Timestamp:
Jun 20, 2015, 8:27:20 PM (11 years ago)
Author:
mitz@apple.com
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.
Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r185799 r185803  
     12015-06-20  Dan Bernstein  <mitz@apple.com>
     2
     3        [Cocoa] Actually use Objective-C lightweight generics when the compiler supports them
     4        https://bugs.webkit.org/show_bug.cgi?id=146183
     5
     6        Reviewed by Sam Weinig.
     7
     8        * Shared/API/Cocoa/WKFoundation.h: When the compiler supports Objective-C generics, define
     9        WK_ARRAY and WK_SET to use them. Also added a definition of WK_DICTIONARY.
     10
     11        * UIProcess/API/Cocoa/WKWebViewPrivate.h: Use WK_DICTIONARY for the options dictionary of
     12        -_loadRequest:withOptions:.
     13
     14        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
     15        (-[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:]): Made the completion
     16        halder type match the declaration, now that NSArray and WK_ARRAY(WKWebsiteDataRecord *) are
     17        not the same.
     18
     19        * mac/postprocess-framework-headers.sh: Also rewrite WK_DICTIONARY.
     20
    1212015-06-20  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebKit2/Shared/API/Cocoa/WKFoundation.h

    r184043 r185803  
    5050#define WK_ENUM_AVAILABLE_IOS(_ios)
    5151
     52#if __has_feature(objc_generics)
     53
     54#define WK_ARRAY(_objectType) NSArray<_objectType>
     55#define WK_DICTIONARY(_keyType, _valueType) NSDictionary<_keyType, _valueType>
     56#define WK_SET(_objectType) NSSet<_objectType>
     57
     58#else
     59
    5260#define WK_ARRAY(...) NSArray
     61#define WK_DICTIONARY(...) NSDictionary
    5362#define WK_SET(...) NSSet
     63
     64#endif
    5465
    5566#ifndef __NSi_8_3
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r185799 r185803  
    206206@property (nonatomic, readonly) NSArray *_scrollPerformanceData WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
    207207
    208 - (WKNavigation *)_loadRequest:(NSURLRequest *)request withOptions:(NSDictionary *)loadOptions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
     208- (WKNavigation *)_loadRequest:(NSURLRequest *)request withOptions:(WK_DICTIONARY(NSString *, id) *)loadOptions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
    209209
    210210@end
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm

    r185334 r185803  
    7575}
    7676
    77 - (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(NSArray *))completionHandler
     77- (void)fetchDataRecordsOfTypes:(NSSet *)dataTypes completionHandler:(void (^)(WK_ARRAY(WKWebsiteDataRecord *) *))completionHandler
    7878{
    7979    auto completionHandlerCopy = Block_copy(completionHandler);
  • trunk/Source/WebKit2/mac/postprocess-framework-headers.sh

    r185590 r185803  
    6060    SED_OPTIONS=(
    6161        -e 's/WK_ARRAY\(([^\)]+)\)/NSArray<\1>/g'
     62        -e 's/WK_DICTIONARY\(([^\)]+)\)/NSDictionary<\1>/g'
    6263        -e 's/WK_SET\(([^\)]+)\)/NSSet<\1>/g'
    6364        -e s/WK_ASSUME_NONNULL_BEGIN/NS_ASSUME_NONNULL_BEGIN/
Note: See TracChangeset for help on using the changeset viewer.