download async

Signed-off-by: xiexiyun <xiexiyun@huawei.com>
Change-Id: I5076bc716f052bd0b6ba5a3d37a4c041f250b487
This commit is contained in:
xiexiyun 2023-12-18 03:19:46 +00:00
parent 5f9cf7f9e0
commit 9a635b5637
2 changed files with 12 additions and 3 deletions

View File

@ -109,7 +109,7 @@ frameworks/core/components_ng/pattern/refresh/ @aryawang
frameworks/core/components_ng/pattern/relative_container/ @nickyjd
frameworks/core/components_ng/pattern/remote_window/ @liuchao92
frameworks/core/components_ng/pattern/rendering_context/ @keerecles
frameworks/core/components_ng/pattern/rich_editor/ @wu-yinxiao
frameworks/core/components_ng/pattern/rich_editor/ @xiexiyun
frameworks/core/components_ng/pattern/root/ @zhoutianer
frameworks/core/components_ng/pattern/scroll/ @rongShao-Z
frameworks/core/components_ng/pattern/scroll_bar/ @rongShao-Z
@ -208,7 +208,7 @@ frameworks/core/components/proxy/ @yan-shuifeng
frameworks/core/components/qrcode/ @Zhang-Dong-hui
frameworks/core/components/rating/ @luoying_ace_admin
frameworks/core/components/refresh/ @aryawang
frameworks/core/components/relative_container/ @nickyjd
frameworks/core/components/relative_container/ @xiexiyun
frameworks/core/components/remote_window/ @liuchao92
frameworks/core/components/rich_text/ @LongLie
frameworks/core/components/root/ @yan-shuifeng

View File

@ -152,7 +152,16 @@ void ImageLoadingContext::OnDataLoading()
return;
}
if (src_.GetSrcType() == SrcType::NETWORK && SystemProperties::GetDownloadByNetworkEnabled()) {
DownloadImage();
if (syncLoad_) {
DownloadImage();
} else {
auto task = [weak = AceType::WeakClaim(this)]() {
auto ctx = weak.Upgrade();
CHECK_NULL_VOID(ctx);
ctx->DownloadImage();
};
NG::ImageUtils::PostToBg(task);
}
return;
}
ImageProvider::CreateImageObject(src_, WeakClaim(this), syncLoad_);