From 554152f33509a40b9f6bdb6dfeeda93d09fa8b30 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Wed, 26 Jun 2024 13:14:48 +0900 Subject: [PATCH] Add env-var to control number of async text loader Added DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER. default value is 4 Change-Id: I594d786c0fd05cbf886a66105ba360c598e1edd4 Signed-off-by: Bowon Ryu --- .../internal/controls/text-controls/text-label-impl.cpp | 4 ---- .../internal/text/async-text/async-text-manager-impl.cpp | 13 +++++++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 8d9b18b..388212c 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -990,10 +990,6 @@ void TextLabel::OnInitialize() self.LayoutDirectionChangedSignal().Connect(this, &TextLabel::OnLayoutDirectionChanged); - // AsyncTextManager must connect the locale changed signal before TextLabel. - // We need to find a more appropriate initial creation point for AsyncTextManager. - Text::AsyncTextManager::Get(); - if(Dali::Adaptor::IsAvailable()) { Dali::Adaptor::Get().LocaleChangedSignal().Connect(this, &TextLabel::OnLocaleChanged); diff --git a/dali-toolkit/internal/text/async-text/async-text-manager-impl.cpp b/dali-toolkit/internal/text/async-text/async-text-manager-impl.cpp index 16eb590..6821060 100644 --- a/dali-toolkit/internal/text/async-text/async-text-manager-impl.cpp +++ b/dali-toolkit/internal/text/async-text/async-text-manager-impl.cpp @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include #include #include #include @@ -31,11 +32,11 @@ namespace Dali { namespace Toolkit { -const int NUMBER_OF_LOADER = 4; -const uint32_t EMPTY_TASK_ID = 0u; - namespace { +const char* DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER("DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER"); +const int DEFAULT_NUMBER_OF_LOADER = 4; +const uint32_t EMPTY_TASK_ID = 0u; } // namespace namespace Text @@ -51,7 +52,11 @@ AsyncTextManager::AsyncTextManager() mWaitingTasks(), mRunningTasks() { - for(int i = 0; i < NUMBER_OF_LOADER; i ++) + // Check environment variable for DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER + auto numberOfLoaderString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER); + int numberOfLoader = numberOfLoaderString ? std::atoi(numberOfLoaderString) : DEFAULT_NUMBER_OF_LOADER; + + for(int i = 0; i < numberOfLoader; i ++) { Text::AsyncTextLoader loader = Text::AsyncTextLoader::New(); mAvailableLoaders.push_back(loader); -- 2.7.4