From bd552c2e346bf4c0993c443a30e2fc0a07986c3b Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 8 Mar 2023 08:32:57 +0900 Subject: [PATCH] Determine priority type for each task For example, remote image loading might be heavy process. So let we give some hints for this tasks priority as LOW. If we set priority as low, Remote image loading didn't use whole AsyncTaskManager's threads. Change-Id: Ife22517deff47b7f4da769bad2b97f472fa8efef Signed-off-by: Eunki, Hong --- dali-scene3d/internal/common/environment-map-load-task.cpp | 4 +--- dali-scene3d/internal/common/model-load-task.cpp | 3 +-- dali-toolkit/internal/image-loader/loading-task.cpp | 4 ++-- .../internal/visuals/animated-vector-image/vector-animation-task.cpp | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dali-scene3d/internal/common/environment-map-load-task.cpp b/dali-scene3d/internal/common/environment-map-load-task.cpp index d847f46..5ff0d51 100644 --- a/dali-scene3d/internal/common/environment-map-load-task.cpp +++ b/dali-scene3d/internal/common/environment-map-load-task.cpp @@ -21,14 +21,12 @@ // INTERNAL INCLUDES #include - namespace Dali { namespace Scene3D { namespace Internal { - EnvironmentMapLoadTask::EnvironmentMapLoadTask(const std::string& environmentMapUrl, Dali::Scene3D::EnvironmentMapType environmentMapType, CallbackBase* callback) : AsyncTask(callback), mEnvironmentMapUrl(environmentMapUrl), @@ -60,7 +58,7 @@ bool EnvironmentMapLoadTask::HasSucceeded() const Dali::Texture EnvironmentMapLoadTask::GetLoadedTexture() { - return (HasSucceeded()) ? mEnvironmentMapData.GetTexture() : Texture();; + return (HasSucceeded()) ? mEnvironmentMapData.GetTexture() : Texture(); } } // namespace Internal diff --git a/dali-scene3d/internal/common/model-load-task.cpp b/dali-scene3d/internal/common/model-load-task.cpp index b979c22..6456b6d 100644 --- a/dali-scene3d/internal/common/model-load-task.cpp +++ b/dali-scene3d/internal/common/model-load-task.cpp @@ -55,8 +55,7 @@ void ModelLoadTask::Process() mResourceDirectoryUrl = std::string(modelUrl.parent_path()) + "/"; } - Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type) - { + Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type) { return mResourceDirectoryUrl; }; diff --git a/dali-toolkit/internal/image-loader/loading-task.cpp b/dali-toolkit/internal/image-loader/loading-task.cpp index 11f83a8..e81b16f 100644 --- a/dali-toolkit/internal/image-loader/loading-task.cpp +++ b/dali-toolkit/internal/image-loader/loading-task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ LoadingTask::LoadingTask(uint32_t id, Dali::AnimatedImageLoading animatedImageLo } LoadingTask::LoadingTask(uint32_t id, const VisualUrl& url, ImageDimensions dimensions, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection, DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad, bool loadPlanes, CallbackBase* callback) -: AsyncTask(callback), +: AsyncTask(callback, url.GetProtocolType() == VisualUrl::ProtocolType::REMOTE ? AsyncTask::PriorityType::LOW : AsyncTask::PriorityType::HIGH), url(url), encodedImageBuffer(), id(id), diff --git a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp index 158ef83..40f1a64 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.cpp @@ -46,7 +46,7 @@ Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New(Debug::NoLogging, } // unnamed namespace VectorAnimationTask::VectorAnimationTask(VisualFactoryCache& factoryCache) -: AsyncTask(MakeCallback(this, &VectorAnimationTask::TaskCompleted), AsyncTask::ThreadType::WORKER_THREAD), +: AsyncTask(MakeCallback(this, &VectorAnimationTask::TaskCompleted), AsyncTask::PriorityType::HIGH, AsyncTask::ThreadType::WORKER_THREAD), mUrl(), mVectorRenderer(VectorAnimationRenderer::New()), mAnimationData(), -- 2.7.4