Remove redundant queue switch from RCTLocalAssetImageLoader

Summary:
Switching queues in `RCTLocalAssetImageLoader` is unnecessary. We dispatch to main queue before assigning the image to `UIImageView`.

Changelog: Remove redundant queue switch from RCTLocalAssetImageLoader

Reviewed By: PeteTheHeat

Differential Revision: D20347223

fbshipit-source-id: ff6215838f0462356d4a516e6ec31c82a742881a
This commit is contained in:
Samuel Susla 2020-03-11 13:57:52 -07:00 коммит произвёл Facebook GitHub Bot
Родитель f3a53fd338
Коммит 3198009410
1 изменённых файлов: 12 добавлений и 21 удалений

Просмотреть файл

@ -49,12 +49,6 @@ RCT_EXPORT_MODULE()
partialLoadHandler:(RCTImageLoaderPartialLoadBlock)partialLoadHandler
completionHandler:(RCTImageLoaderCompletionBlock)completionHandler
{
__block auto cancelled = std::make_shared<std::atomic<bool>>(false);
RCTExecuteOnMainQueue(^{
if (cancelled->load()) {
return;
}
UIImage *image = RCTImageFromLocalAssetURL(imageURL);
if (image) {
if (progressHandler) {
@ -66,11 +60,8 @@ RCT_EXPORT_MODULE()
RCTLogWarn(@"%@", message);
completionHandler(RCTErrorWithMessage(message), nil);
}
});
return ^{
cancelled->store(true);
};
return nil;
}
@end