You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@property (strong, nonatomic, nonnull) dispatch_queue_tcoderQueue; // the serial operation queue to do image decoding
78
+
@property (strong, nonatomic, nonnull) NSOperationQueue *coderQueue; // the serial operation queue to do image decoding
79
79
80
80
@property (strong, nonatomic, nonnull) NSMapTable<SDImageCoderOptions *, UIImage *> *imageMap; // each variant of image is weak-referenced to avoid too many re-decode during downloading
// keep maximum one progressive decode process during download
469
-
@weakify(self);
470
-
dispatch_async(self.coderQueue, ^{
471
-
@strongify(self);
472
-
if (!self) {
473
-
return;
474
-
}
475
-
// When cancelled or transfer finished (`didCompleteWithError`), cancel the progress callback, only completed block is called and enough
476
-
if (self.isCancelled || SDWebImageDownloaderOperationGetCompleted(self)) {
477
-
return;
478
-
}
479
-
UIImage *image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, NO, self, [[selfclass] imageOptionsFromDownloaderOptions:self.options], self.context);
480
-
if (image) {
481
-
// We do not keep the progressive decoding image even when `finished`=YES. Because they are for view rendering but not take full function from downloader options. And some coders implementation may not keep consistent between progressive decoding and normal decoding.
// NSOperation have autoreleasepool, don't need to create extra one
473
+
@weakify(self);
474
+
[self.coderQueue addOperationWithBlock:^{
475
+
@strongify(self);
476
+
if (!self) {
477
+
return;
478
+
}
479
+
// When cancelled or transfer finished (`didCompleteWithError`), cancel the progress callback, only completed block is called and enough
480
+
if (self.isCancelled || SDWebImageDownloaderOperationGetCompleted(self)) {
481
+
return;
482
+
}
483
+
UIImage *image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, NO, self, [[selfclass] imageOptionsFromDownloaderOptions:self.options], self.context);
484
+
if (image) {
485
+
// We do not keep the progressive decoding image even when `finished`=YES. Because they are for view rendering but not take full function from downloader options. And some coders implementation may not keep consistent between progressive decoding and normal decoding.
[selfcallCompletionBlocksWithError:[NSErrorerrorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}]];
0 commit comments