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.containsOperationPolicy = SDImageCachesManagerOperationPolicySerial;
self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent; self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent;
// initialize with default image caches // initialize with default image caches
self.caches = @[[SDImageCache sharedImageCache]]; _caches = @[[SDImageCache sharedImageCache]];
self.cachesLock = dispatch_semaphore_create(1); _cachesLock = dispatch_semaphore_create(1);
} }
return self; return self;
} }

View File

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

View File

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

View File

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