Optimize for AsyncTextManager 47/319947/3
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 20 Feb 2025 06:15:13 +0000 (15:15 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Mon, 24 Feb 2025 02:12:23 +0000 (11:12 +0900)
Slow operations such as InitDefaultFontDescription are performed in worker threads.
This is performed once on the first task of each AsyncTextLoader.
The calculation time for the first task increases slightly compared to before,
but the delay in the UI thread is minimal.

Change-Id: I864686519da43040d45860ccbe43924430f5e7d5
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
automated-tests/src/dali-toolkit-internal/utc-Dali-TextLabel-internal.cpp
dali-toolkit/internal/text/async-text/async-text-loader-impl.cpp
dali-toolkit/internal/text/async-text/async-text-module-impl.cpp

index 12575d30bc0320e19fcaa9dbcd3a767cedb12cc8..ef2f10374d6f06291236f1dca578fd96b17fc4a9 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <stdlib.h>
 #include <iostream>
+#include <thread>
 
 #include <toolkit-event-thread-callback.h>
 
@@ -1492,6 +1493,8 @@ int UtcDaliTextLabelLocaleChange02(void)
   // Request render.
   DevelTextLabel::RequestAsyncRenderWithFixedSize(label, expectedWidth, expectedHeight);
 
+  std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+
   newLocale = "label_TEST_2";
   adaptor.LocaleChangedSignal().Emit(newLocale);
 
index 61bd61323f045f72f4541db11eedd4d6ef89c4c2..a83aef6af1bdcc7fd98a9d9841018d155bf8c045 100644 (file)
@@ -110,6 +110,8 @@ bool AsyncTextLoader::IsModuleClearNeeded()
 // Worker thread
 void AsyncTextLoader::Initialize()
 {
+  mModule.GetFontClient().InitDefaultFontDescription();
+
   ClearTextModelData();
 
   mNumberOfCharacters = 0u;
index e5b4edff4f13958018001fe856e0d99af768873d..f6c443eea612181376129b52b842f237e70c43f1 100644 (file)
@@ -50,8 +50,6 @@ AsyncTextModule::AsyncTextModule()
   mSegmentation         = TextAbstraction::Segmentation::New();
   mHyphenation          = TextAbstraction::Hyphenation::New();
   mMultilanguageSupport = Text::MultilanguageSupport::New(connnectLocaleChangedSignal);
-
-  mFontClient.InitDefaultFontDescription();
 }
 
 AsyncTextModule::~AsyncTextModule()
@@ -61,7 +59,6 @@ AsyncTextModule::~AsyncTextModule()
 void AsyncTextModule::ClearCache()
 {
   mFontClient.ClearCacheOnLocaleChanged();
-  mFontClient.InitDefaultFontDescription();
   mMultilanguageSupport.ClearCache();
 }