Remove the out-dated compatible code for non-ARC

This commit is contained in:
DreamPiggy 2017-12-15 20:11:42 +08:00
parent efa030cb47
commit eda6d5d485
7 changed files with 11 additions and 29 deletions

View File

@ -50,7 +50,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
@property (strong, nonatomic, nonnull) NSCache *memCache; @property (strong, nonatomic, nonnull) NSCache *memCache;
@property (strong, nonatomic, nonnull) NSString *diskCachePath; @property (strong, nonatomic, nonnull) NSString *diskCachePath;
@property (strong, nonatomic, nullable) NSMutableArray<NSString *> *customPaths; @property (strong, nonatomic, nullable) NSMutableArray<NSString *> *customPaths;
@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t ioQueue; @property (strong, nonatomic, nullable) dispatch_queue_t ioQueue;
@end @end
@ -129,7 +129,6 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
SDDispatchQueueRelease(_ioQueue);
} }
- (void)checkIfQueueIsIOQueue { - (void)checkIfQueueIsIOQueue {

View File

@ -15,8 +15,8 @@
@interface SDWebImageCodersManager () @interface SDWebImageCodersManager ()
@property (nonatomic, strong, nonnull) NSMutableArray<SDWebImageCoder>* mutableCoders; @property (strong, nonatomic, nonnull) NSMutableArray<SDWebImageCoder>* mutableCoders;
@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t mutableCodersAccessQueue; @property (strong, nonatomic, nullable) dispatch_queue_t mutableCodersAccessQueue;
@end @end
@ -43,10 +43,6 @@
return self; return self;
} }
- (void)dealloc {
SDDispatchQueueRelease(_mutableCodersAccessQueue);
}
#pragma mark - Coder IO operations #pragma mark - Coder IO operations
- (void)addCoder:(nonnull id<SDWebImageCoder>)coder { - (void)addCoder:(nonnull id<SDWebImageCoder>)coder {

View File

@ -81,18 +81,6 @@
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif #endif
#if OS_OBJECT_USE_OBJC
#undef SDDispatchQueueRelease
#undef SDDispatchQueueSetterSementics
#define SDDispatchQueueRelease(q)
#define SDDispatchQueueSetterSementics strong
#else
#undef SDDispatchQueueRelease
#undef SDDispatchQueueSetterSementics
#define SDDispatchQueueRelease(q) (dispatch_release(q))
#define SDDispatchQueueSetterSementics assign
#endif
FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image); FOUNDATION_EXPORT UIImage *SDScaledImageForKey(NSString *key, UIImage *image);
typedef void(^SDWebImageNoParamsBlock)(void); typedef void(^SDWebImageNoParamsBlock)(void);

View File

@ -10,7 +10,11 @@
#import "UIImage+MultiFormat.h" #import "UIImage+MultiFormat.h"
#if !__has_feature(objc_arc) #if !__has_feature(objc_arc)
#error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
#endif
#if !OS_OBJECT_USE_OBJC
#error SDWebImage need ARC for dispatch object
#endif #endif
inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { inline UIImage *SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) {

View File

@ -21,7 +21,7 @@
@property (strong, nonatomic, nonnull) NSMutableDictionary<NSURL *, SDWebImageDownloaderOperation *> *URLOperations; @property (strong, nonatomic, nonnull) NSMutableDictionary<NSURL *, SDWebImageDownloaderOperation *> *URLOperations;
@property (strong, nonatomic, nullable) SDHTTPHeadersMutableDictionary *HTTPHeaders; @property (strong, nonatomic, nullable) SDHTTPHeadersMutableDictionary *HTTPHeaders;
// This queue is used to serialize the handling of the network responses of all the download operation in a single queue // This queue is used to serialize the handling of the network responses of all the download operation in a single queue
@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue; @property (strong, nonatomic, nullable) dispatch_queue_t barrierQueue;
// The session in which data tasks will run // The session in which data tasks will run
@property (strong, nonatomic) NSURLSession *session; @property (strong, nonatomic) NSURLSession *session;
@ -112,7 +112,6 @@
self.session = nil; self.session = nil;
[self.downloadQueue cancelAllOperations]; [self.downloadQueue cancelAllOperations];
SDDispatchQueueRelease(_barrierQueue);
} }
- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field { - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field {

View File

@ -38,7 +38,7 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
@property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask; @property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask;
@property (SDDispatchQueueSetterSementics, nonatomic, nullable) dispatch_queue_t barrierQueue; @property (strong, nonatomic, nullable) dispatch_queue_t barrierQueue;
#if SD_UIKIT #if SD_UIKIT
@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId; @property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId;
@ -74,10 +74,6 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
return self; return self;
} }
- (void)dealloc {
SDDispatchQueueRelease(_barrierQueue);
}
- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock - (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock
completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock {
SDCallbacksDictionary *callbacks = [NSMutableDictionary new]; SDCallbacksDictionary *callbacks = [NSMutableDictionary new];

View File

@ -61,7 +61,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
/** /**
* Queue options for Prefetcher. Defaults to Main Queue. * Queue options for Prefetcher. Defaults to Main Queue.
*/ */
@property (SDDispatchQueueSetterSementics, nonatomic, nonnull) dispatch_queue_t prefetcherQueue; @property (strong, nonatomic, nonnull) dispatch_queue_t prefetcherQueue;
@property (weak, nonatomic, nullable) id <SDWebImagePrefetcherDelegate> delegate; @property (weak, nonatomic, nullable) id <SDWebImagePrefetcherDelegate> delegate;