mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 01:22:41 +00:00
Merge pull request #205 from facebook/image-load-blocking
Dispatch lazy image downloaders to another thread
This commit is contained in:
commit
42f801f269
@ -234,11 +234,17 @@
|
||||
}
|
||||
};
|
||||
|
||||
[_cache fetchCachedImageWithURL:_URL
|
||||
callbackQueue:dispatch_get_main_queue()
|
||||
completion:cacheCompletion];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[_cache fetchCachedImageWithURL:_URL
|
||||
callbackQueue:dispatch_get_main_queue()
|
||||
completion:cacheCompletion];
|
||||
});
|
||||
} else {
|
||||
[self _downloadImageWithCompletion:finished];
|
||||
// NSURLSessionDownloadTask will do file I/O to create a temp directory. If called on the main thread this
|
||||
// will cause significant performance issues.
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self _downloadImageWithCompletion:finished];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user