[M108 Migration][WRTjs] Lazy initialization of ContentMainRunner for wrt-loader 90/289490/2
authorDongHyun Song <dh81.song@samsung.com>
Wed, 8 Mar 2023 23:53:57 +0000 (08:53 +0900)
committerBot Blink <blinkbot@samsung.com>
Thu, 9 Mar 2023 05:01:47 +0000 (05:01 +0000)
In case cold booting case, WRT initialization takes much time on
the low-end product. (5s ~ 7s)
Even though wrt-loader is prepared on cold booting sequence as soon
as possible, the candidate launch can be failed because wrt-loader
is not yet ready.

To make short the initialization time, this patch defers the jobs
of WRTContentMain's initialization with ecore_idler, and return
loader's create callback early to prepare wrt-loader.

Reference:
https://review.tizen.org/gerrit/284208/

Change-Id: Icb1be128397415903d3de8b3346a862a98e7f1e2
Signed-off-by: DongHyun Song <dh81.song@samsung.com>
wrt/src/app/wrt_content_main.cc

index 4fb0b5c..b6c0fcc 100644 (file)
@@ -55,9 +55,14 @@ class WRTContentMain::Loader {
     loader_lifecycle_callback_s callback;
     callback.create = [](bundle* extra, int type, void* user_data) {
       LOG(INFO) << "loader created";
-      auto* content_main = static_cast<Loader*>(user_data)->content_main_;
-      content_main->Initialize();
-      content_main->main_delegate_->LoaderCreated();
+      ecore_idler_add(
+          [](void* data) {
+            LOG(INFO) << "ContentMain will be initialized in idler.";
+            auto* content_main = static_cast<WRTContentMain*>(data);
+            content_main->Initialize();
+            content_main->main_delegate_->LoaderCreated();
+            return ECORE_CALLBACK_CANCEL;
+          }, static_cast<Loader*>(user_data)->content_main_);
     };
 #if TIZEN_VERSION_AT_LEAST(6, 5, 0)
     callback.prelaunch = [](int argc, char** argv, const char* app_path,