preload native libraries and pre-create windows to optimize app launching performance 55/104755/1
authorCho Woong Suk <ws77.cho@samsung.com>
Tue, 22 Nov 2016 03:57:02 +0000 (12:57 +0900)
committerJongHeon Choi <j-h.choi@samsung.com>
Wed, 14 Dec 2016 08:08:33 +0000 (17:08 +0900)
Change-Id: Ia9065c5b2a1470aa3c72675b7bb953bd4bf00dc1
Signed-off-by: Cho Woong Suk <ws77.cho@samsung.com>
NativeLauncher/CMakeLists.txt
NativeLauncher/dotnet.loader
NativeLauncher/launcher/launcher.cc
packaging/dotnet-launcher.spec

index cd273e1..3c35c5f 100644 (file)
@@ -7,7 +7,7 @@ IF(DEFINED NO_TIZEN)
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DNO_TIZEN")
 ELSE(DEFINED NO_TIZEN)
        INCLUDE(FindPkgConfig)
-       PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad)
+       PKG_CHECK_MODULES(${PROJECT_NAME} REQUIRED aul pkgmgr-info pkgmgr-installer dlog ecore bundle dlog launchpad elementary)
 ENDIF(DEFINED NO_TIZEN)
 
 FOREACH(flag ${${PROJECT_NAME}_CFLAGS})
index 67094b9..57b547d 100644 (file)
@@ -4,3 +4,13 @@ EXE     /usr/bin/dotnet-launcher
 APP_TYPE        dotnet
 DETECTION_METHOD        TIMEOUT|DEMAND
 TIMEOUT         5000
+EXTRA_ARRAY                    preload
+EXTRA_ARRAY_VAL                /usr/lib/libappcore-efl.so.1
+EXTRA_ARRAY_VAL                /usr/lib/libappcore-common.so.1
+EXTRA_ARRAY_VAL                /usr/lib/libcapi-appfw-application.so.0
+EXTRA_ARRAY_VAL                /usr/lib/ecore_imf/modules/wayland/v-1.16/libwltextinputmodule.so
+EXTRA_ARRAY_VAL                /usr/lib/libdali-toolkit.so
+EXTRA_ARRAY_VAL                /usr/lib/libcairo.so.2
+EXTRA_ARRAY_VAL                /usr/lib/libefl-assist.so.0
+EXTRA_ARRAY_VAL                /usr/lib/libcapi-media-player.so.0
+EXTRA_ARRAY_VAL                /usr/lib/libcapi-media-camera.so.0
index ebbc58d..c26b0e0 100644 (file)
 #include <aul.h>
 
 #include <Ecore.h>
+#include <Elementary.h>
+#include <bundle_internal.h>
 
 #include <map>
 #include <vector>
 #include <functional>
 
 #include <unistd.h>
+#include <dlfcn.h>
 
 
 namespace tizen {
@@ -38,6 +41,12 @@ struct FdHandler
   loader_receiver_cb receiver;
 };
 
+static int __argc;
+static char **__argv;
+static Evas_Object *__win;
+static Evas_Object *__bg;
+static Evas_Object *__conform;
+
 class LaunchpadAdapterImpl : public LaunchpadAdapter
 {
   public:
@@ -124,12 +133,74 @@ static void Fd_Remove(void *data, int fd)
   }
 }
 
-void LaunchpadAdapterImpl::LoaderMain(int argc, char* argv[])
+
+static void PreloadLibsAndWindow(bundle *extra, int type, void *user_data)
 {
+       int elm_init_cnt = 0;
+  const char **so_array;
+  int len = 0;
+  int i;
+  void *handle = NULL;
+
+  // Preload native libraries
+       if (extra == NULL) {
+               _DBG("No extra data");
+               return;
+       }
+
+       so_array = bundle_get_str_array(extra, "preload", &len);
 
+       if (!so_array)
+               return;
+
+       for (i = 0; i < len; i++) {
+               handle = dlopen(so_array[i], RTLD_NOW);
+               _DBG("preload %s# - handle : %x\n", so_array[i], handle);
+       }
+
+  // Precreate window
+       elm_init_cnt = elm_init(__argc, __argv);
+       _DBG("[candidate] elm init, returned: %d", elm_init_cnt);
+
+  elm_config_accel_preference_set("hw");
+
+  __win = elm_win_add(NULL, "package_name", ELM_WIN_BASIC);
+  if (__win == NULL) {
+    _DBG("[candidate] elm_win_add() failed");
+    return;
+  }
+
+  elm_win_precreated_object_set(__win);
+
+  __bg = elm_bg_add(__win);
+  if (__bg) {
+    evas_object_size_hint_weight_set(__bg, EVAS_HINT_EXPAND,
+        EVAS_HINT_EXPAND);
+    elm_win_resize_object_add(__win, __bg);
+    elm_bg_precreated_object_set(__bg);
+  } else {
+    _DBG("[candidate] elm_bg_add() failed");
+  }
+
+  __conform = elm_conformant_add(__win);
+  if (__conform) {
+    evas_object_size_hint_weight_set(__conform, EVAS_HINT_EXPAND,
+        EVAS_HINT_EXPAND);
+    elm_win_resize_object_add(__win, __conform);
+    elm_conformant_precreated_object_set(__conform);
+  } else {
+    _DBG("elm_conformant_add() failed");
+  }
+}
+
+void LaunchpadAdapterImpl::LoaderMain(int argc, char* argv[])
+{
+  __argc = argc;
+  __argv = argv;
   callbacks.create = [](bundle *extra, int type, void *user_data)
   {
     ecore_init();
+    PreloadLibsAndWindow(extra, type, user_data);
     WITH_SELF(user_data)
     {
       if (self->OnCreate != nullptr)
index 0a95375..87cef0e 100644 (file)
@@ -17,6 +17,7 @@ BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(launchpad)
 BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: pkgconfig(pkgmgr-installer)
+BuildRequires: pkgconfig(elementary)
 BuildRequires: aul-devel
 BuildRequires: mono-compiler
 BuildRequires: mono-devel