From: Junghoon Park Date: Wed, 27 Jan 2016 02:47:05 +0000 (+0900) Subject: Preinitialize app root path to improve performance X-Git-Tag: submit/tizen/20160127.083815^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F58030%2F1;p=platform%2Fcore%2Fappfw%2Flaunchpad.git Preinitialize app root path to improve performance Change-Id: Iacbf6a7becbb1aa2038b5b7ae0901f53cfcc8fc9 Signed-off-by: Junghoon Park --- diff --git a/inc/key.h b/inc/key.h index c9527cec..be5d9af8 100644 --- a/inc/key.h +++ b/inc/key.h @@ -40,6 +40,7 @@ extern "C" { #define AUL_K_LOADER_EXTRA "__AUL_LOADER_EXTRA__" #define AUL_K_WAYLAND_DISPLAY "__AUL_WAYLAND_DISPLAY__" #define AUL_K_WAYLAND_WORKING_DIR "__AUL_WAYLAND_WORKING_DIR__" +#define AUL_K_ROOT_PATH "__AUL_ROOT_PATH__" #ifdef __cplusplus } diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index 9dbb8b34..434c7933 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -83,6 +83,7 @@ typedef struct { char *pkgid; char *comp_type; char *internal_pool; + char *root_path; } appinfo_t; char *_proc_get_cmdline_bypid(int pid); diff --git a/src/launchpad_common.c b/src/launchpad_common.c index 84146fa4..49fe6f95 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -406,6 +406,9 @@ appinfo_t* _appinfo_create(bundle *kb) ptr = bundle_get_val(kb, AUL_K_INTERNAL_POOL); if (ptr) menu_info->internal_pool = strdup(ptr); + ptr = bundle_get_val(kb, AUL_K_ROOT_PATH); + if (ptr) + menu_info->root_path = strdup(ptr); if (!_appinfo_get_app_path(menu_info)) { _appinfo_free(menu_info); @@ -473,6 +476,8 @@ void _appinfo_free(appinfo_t *menu_info) free(menu_info->comp_type); if (menu_info->internal_pool != NULL) free(menu_info->internal_pool); + if (menu_info->root_path != NULL) + free(menu_info->root_path); free(menu_info); } diff --git a/src/launchpad_lib.c b/src/launchpad_lib.c index 28ecb52e..4a46ce39 100644 --- a/src/launchpad_lib.c +++ b/src/launchpad_lib.c @@ -32,6 +32,7 @@ static char **__argv; static bundle *__bundle; static char *__appid; static char *__pkgid; +static char *__root_path; static int __loader_type = LAUNCHPAD_TYPE_UNSUPPORTED; static int __loader_id; @@ -41,13 +42,16 @@ static void __at_exit_to_release_bundle() bundle_free(__bundle); } -static void __release_appid_at_exit(void) +static void __release_at_exit(void) { if (__appid != NULL) free(__appid); if (__pkgid != NULL) free(__pkgid); + + if (__root_path != NULL) + free(__root_path); } static int __set_access(const char* appId, const char* pkg_type, @@ -149,6 +153,7 @@ static int __candidate_process_launchpad_main_loop(app_pkt_t* pkt, __bundle = kb; atexit(__at_exit_to_release_bundle); + atexit(__release_at_exit); menu_info = _appinfo_create(kb); if (menu_info == NULL) { @@ -200,7 +205,13 @@ static int __candidate_process_launchpad_main_loop(app_pkt_t* pkt, exit(-1); } aul_set_preinit_pkgid(__pkgid); - atexit(__release_appid_at_exit); + + __root_path = strdup(menu_info->root_path); + if (__root_path == NULL) { + _E("Out of memory"); + exit(-1); + } + aul_set_preinit_root_path(__root_path); tmp_argv = _create_argc_argv(kb, &tmp_argc);