Preinitialize app root path to improve performance 30/58030/1 accepted/tizen/mobile/20160128.010553 accepted/tizen/tv/20160128.010605 accepted/tizen/wearable/20160128.010633 submit/tizen/20160127.083815
authorJunghoon Park <jh9216.park@samsung.com>
Wed, 27 Jan 2016 02:47:05 +0000 (11:47 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Wed, 27 Jan 2016 02:47:05 +0000 (11:47 +0900)
Change-Id: Iacbf6a7becbb1aa2038b5b7ae0901f53cfcc8fc9
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
inc/key.h
inc/launchpad_common.h
src/launchpad_common.c
src/launchpad_lib.c

index c9527ce..be5d9af 100644 (file)
--- 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
 }
index 9dbb8b3..434c793 100644 (file)
@@ -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);
index 84146fa..49fe6f9 100644 (file)
@@ -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);
 }
index 28ecb52..4a46ce3 100644 (file)
@@ -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);