diff options
author | Cho Woong Suk <ws77.cho@samsung.com> | 2016-11-22 12:57:02 +0900 |
---|---|---|
committer | JongHeon Choi <j-h.choi@samsung.com> | 2016-12-14 17:08:33 +0900 |
commit | 69a43a53ef090e1c70ab8969c420073c14caf21a (patch) | |
tree | da0226693812544b2472db950583567747b6f1cb | |
parent | af016aa0f9cf9e442f0d122d933875c54e258a77 (diff) | |
download | launcher-69a43a53ef090e1c70ab8969c420073c14caf21a.tar.gz launcher-69a43a53ef090e1c70ab8969c420073c14caf21a.tar.bz2 launcher-69a43a53ef090e1c70ab8969c420073c14caf21a.zip |
preload native libraries and pre-create windows to optimize app launching performance
Change-Id: Ia9065c5b2a1470aa3c72675b7bb953bd4bf00dc1
Signed-off-by: Cho Woong Suk <ws77.cho@samsung.com>
-rw-r--r-- | NativeLauncher/CMakeLists.txt | 2 | ||||
-rw-r--r-- | NativeLauncher/dotnet.loader | 10 | ||||
-rw-r--r-- | NativeLauncher/launcher/launcher.cc | 73 | ||||
-rw-r--r-- | packaging/dotnet-launcher.spec | 1 |
4 files changed, 84 insertions, 2 deletions
diff --git a/NativeLauncher/CMakeLists.txt b/NativeLauncher/CMakeLists.txt index cd273e1..3c35c5f 100644 --- a/NativeLauncher/CMakeLists.txt +++ b/NativeLauncher/CMakeLists.txt @@ -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}) diff --git a/NativeLauncher/dotnet.loader b/NativeLauncher/dotnet.loader index 67094b9..57b547d 100644 --- a/NativeLauncher/dotnet.loader +++ b/NativeLauncher/dotnet.loader @@ -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 diff --git a/NativeLauncher/launcher/launcher.cc b/NativeLauncher/launcher/launcher.cc index ebbc58d..c26b0e0 100644 --- a/NativeLauncher/launcher/launcher.cc +++ b/NativeLauncher/launcher/launcher.cc @@ -21,12 +21,15 @@ #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) diff --git a/packaging/dotnet-launcher.spec b/packaging/dotnet-launcher.spec index 0a95375..87cef0e 100644 --- a/packaging/dotnet-launcher.spec +++ b/packaging/dotnet-launcher.spec @@ -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 |