Updated code for #1608 #1623 - set a name for the download queue, avoid using the `_request` ivar and made sure we strip request of mutability

This commit is contained in:
Bogdan Poplauschi 2016-09-01 15:05:30 +03:00
parent 033899d0ac
commit 20760d71e5
2 changed files with 3 additions and 2 deletions

View File

@ -69,6 +69,7 @@ static NSString *const kCompletedCallbackKey = @"completed";
_executionOrder = SDWebImageDownloaderFIFOExecutionOrder;
_downloadQueue = [NSOperationQueue new];
_downloadQueue.maxConcurrentOperationCount = 6;
_downloadQueue.name = @"com.hackemist.SDWebImageDownloader";
_URLCallbacks = [NSMutableDictionary new];
#ifdef SD_WEBP
_HTTPHeaders = [@{@"Accept": @"image/webp,image/*;q=0.8"} mutableCopy];

View File

@ -73,7 +73,7 @@ NSString *const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinis
completed:(SDWebImageDownloaderCompletedBlock)completedBlock
cancelled:(SDWebImageNoParamsBlock)cancelBlock {
if ((self = [super init])) {
_request = request;
_request = [request copy];
_shouldDecompressImages = YES;
_options = options;
_progressBlock = [progressBlock copy];
@ -404,7 +404,7 @@ didReceiveResponse:(NSURLResponse *)response
} else {
SDWebImageDownloaderCompletedBlock completionBlock = self.completedBlock;
if (![[NSURLCache sharedURLCache] cachedResponseForRequest:_request]) {
if (![[NSURLCache sharedURLCache] cachedResponseForRequest:self.request]) {
responseFromCached = NO;
}