Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SDWebImage/SDWebImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,17 @@ - (NSInteger)maxConcurrentDownloads {
operation = [[SDWebImageDownloaderOperation alloc] initWithRequest:request
options:options
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
if (!wself) return;
SDWebImageDownloader *sself = wself;
if (!sself) return;
NSArray *callbacksForURL = [sself callbacksForURL:url];
for (NSDictionary *callbacks in callbacksForURL) {
SDWebImageDownloaderProgressBlock callback = callbacks[kProgressCallbackKey];
if (callback) callback(receivedSize, expectedSize);
}
}
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
if (!wself) return;
SDWebImageDownloader *sself = wself;
if (!sself) return;
NSArray *callbacksForURL = [sself callbacksForURL:url];
if (finished) {
[sself removeCallbacksForURL:url];
Expand All @@ -148,8 +148,8 @@ - (NSInteger)maxConcurrentDownloads {
}
}
cancelled:^{
if (!wself) return;
SDWebImageDownloader *sself = wself;
if (!sself) return;
[sself removeCallbacksForURL:url];
}];

Expand Down
8 changes: 4 additions & 4 deletions SDWebImage/SDWebImagePrefetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
*
* @param imagePrefetcher The current image prefetcher
* @param imageURL The image url that was prefetched
* @param finishedCount The total number of images that were prefetched
* @param totalCount The total number of images that need to be prefetched
* @param finishedCount The total number of images that were prefetched (successful or not)
* @param totalCount The total number of images that were to be prefetched
*/
- (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount;

/**
* Called when all images are prefetched.
* @param imagePrefetcher The current image prefetcher
* @param totalCount The total number of images that need to be prefetched
* @param totalCount The total number of images that were prefetched (whether successful or not)
* @param skippedCount The total number of images that were skipped
*/
- (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount;
Expand Down Expand Up @@ -73,7 +73,7 @@
* and skips images for failed downloads and proceed to the next image in the list
*
* @param urls list of URLs to prefetch
* @param progressBlock block to be called when progress updates
* @param progressBlock block to be called when progress updates; first parameter is the number of completed (successful or not) requests, second parameter is the total number of images originally requested to be prefetched
* @param completionBlock block to be called when prefetching is completed
*/
- (void)prefetchURLs:(NSArray *)urls progress:(void (^)(NSUInteger, NSUInteger))progressBlock completed:(void (^)(NSUInteger, NSUInteger))completionBlock;
Expand Down
2 changes: 1 addition & 1 deletion SDWebImage/SDWebImagePrefetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ - (void)startPrefetchingAtIndex:(NSUInteger)index {
[self startPrefetchingAtIndex:self.requestedCount];
});
}
else if (self.finishedCount + self.skippedCount == self.requestedCount) {
else if (self.finishedCount == self.requestedCount) {
[self reportStatus];
if (self.completionBlock) {
self.completionBlock(self.finishedCount, self.skippedCount);
Expand Down