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>
#include <stdlib.h>
#include <iostream>
+#include <thread>
#include <toolkit-event-thread-callback.h>
// Request render.
DevelTextLabel::RequestAsyncRenderWithFixedSize(label, expectedWidth, expectedHeight);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1000));
+
newLocale = "label_TEST_2";
adaptor.LocaleChangedSignal().Emit(newLocale);
// Worker thread
void AsyncTextLoader::Initialize()
{
+ mModule.GetFontClient().InitDefaultFontDescription();
+
ClearTextModelData();
mNumberOfCharacters = 0u;
mSegmentation = TextAbstraction::Segmentation::New();
mHyphenation = TextAbstraction::Hyphenation::New();
mMultilanguageSupport = Text::MultilanguageSupport::New(connnectLocaleChangedSignal);
-
- mFontClient.InitDefaultFontDescription();
}
AsyncTextModule::~AsyncTextModule()
void AsyncTextModule::ClearCache()
{
mFontClient.ClearCacheOnLocaleChanged();
- mFontClient.InitDefaultFontDescription();
mMultilanguageSupport.ClearCache();
}