Update the coderQueue QoS based on SDWebImageDownloaderLowPriority && SDWebImageDownloaderHighPriority

This commit is contained in:
DreamPiggy 2020-03-11 11:54:10 +08:00
parent 3d1280315b
commit 13d0e739fb
1 changed files with 5 additions and 0 deletions

View File

@ -208,8 +208,13 @@ typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
if (self.dataTask) {
if (self.options & SDWebImageDownloaderHighPriority) {
self.dataTask.priority = NSURLSessionTaskPriorityHigh;
self.coderQueue.qualityOfService = NSQualityOfServiceUserInteractive;
} else if (self.options & SDWebImageDownloaderLowPriority) {
self.dataTask.priority = NSURLSessionTaskPriorityLow;
self.coderQueue.qualityOfService = NSQualityOfServiceBackground;
} else {
self.dataTask.priority = NSURLSessionTaskPriorityDefault;
self.coderQueue.qualityOfService = NSQualityOfServiceDefault;
}
[self.dataTask resume];
for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {