Update the coders manager initializer, without the useless mutable copy

Update the comments
This commit is contained in:
DreamPiggy 2019-03-31 18:09:17 +08:00
parent f060310ffe
commit 75d3adedfa
4 changed files with 8 additions and 9 deletions

View File

@ -36,8 +36,8 @@
self.containsOperationPolicy = SDImageCachesManagerOperationPolicySerial;
self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent;
// initialize with default image caches
self.caches = @[[SDImageCache sharedImageCache]];
self.cachesLock = dispatch_semaphore_create(1);
_caches = @[[SDImageCache sharedImageCache]];
_cachesLock = dispatch_semaphore_create(1);
}
return self;
}

View File

@ -17,10 +17,10 @@
Note: the `coders` getter will return the coders in their reversed order
Example:
- by default we internally set coders = `IOCoder`, `GIFCoder`
- calling `coders` will return `@[IOCoder, GIFCoder]`
- by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder`
- calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]`
- call `[addCoder:[MyCrazyCoder new]]`
- calling `coders` now returns `@[IOCoder, GIFCoder, MyCrazyCoder]`
- calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]`
Coders
------

View File

@ -31,8 +31,7 @@
- (instancetype)init {
if (self = [super init]) {
// initialize with default coders
NSMutableArray<id<SDImageCoder>> *mutableCoders = [@[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]] mutableCopy];
_coders = [mutableCoders copy];
_coders = @[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]];
_codersLock = dispatch_semaphore_create(1);
}
return self;

View File

@ -30,8 +30,8 @@
self = [super init];
if (self) {
// initialize with default image loaders
self.loaders = @[[SDWebImageDownloader sharedDownloader]];
self.loadersLock = dispatch_semaphore_create(1);
_loaders = @[[SDWebImageDownloader sharedDownloader]];
_loadersLock = dispatch_semaphore_create(1);
}
return self;
}