summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2018-06-15 17:43:16 +0900
committerHwankyu Jhun <h.jhun@samsung.com>2018-06-19 09:37:59 +0900
commit24333fed0724b3bc4f494dc71420cc6ae94fd3c8 (patch)
treefd4427dd2f25593f0b7ebf37939f32d958fc5782
parent49b92df132454979e1047362b90d1eea5e93a83e (diff)
downloadlaunchpad-24333fed0724b3bc4f494dc71420cc6ae94fd3c8.tar.gz
launchpad-24333fed0724b3bc4f494dc71420cc6ae94fd3c8.tar.bz2
launchpad-24333fed0724b3bc4f494dc71420cc6ae94fd3c8.zip
Add a new dectection method
METHOD_INSTALL is added to handle slot update events. The loader creation must be sequential. Change-Id: I3d279999ab342b84b2056ac0ce242d24cdb4b8e6 Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r--inc/loader_info.h1
-rwxr-xr-xsrc/launchpad.c21
-rw-r--r--src/loader_info.c4
3 files changed, 23 insertions, 3 deletions
diff --git a/inc/loader_info.h b/inc/loader_info.h
index 3e650af..2245107 100644
--- a/inc/loader_info.h
+++ b/inc/loader_info.h
@@ -31,6 +31,7 @@ enum loader_method_e {
METHOD_AVAILABLE_MEMORY = 0x0020,
METHOD_TTL = 0x0040,
METHOD_OUT_OF_MEMORY = 0x0100,
+ METHOD_INSTALL = 0x0200,
};
typedef struct _loader_info {
diff --git a/src/launchpad.c b/src/launchpad.c
index ebc4d29..cabc266 100755
--- a/src/launchpad.c
+++ b/src/launchpad.c
@@ -131,6 +131,7 @@ static app_labels_monitor *label_monitor;
static GList *launcher_info_list;
static GHashTable *__pid_table;
static int __memory_status;
+static guint __timer;
static candidate_process_context_t *__add_slot(int type, int loader_id,
int caller_pid, const char *loader_path, const char *extra,
@@ -1424,6 +1425,14 @@ static candidate_process_context_t *__find_available_slot(const char *hwacc,
return NULL;
}
+static gboolean __handle_slot_update(gpointer data)
+{
+ _D("[__LAUNCHPAD__] Handle slot update");
+ __add_idle_checker(METHOD_INSTALL, candidate_slot_list);
+ __timer = 0;
+ return G_SOURCE_REMOVE;
+}
+
static void __update_slot(int type, bool app_exists)
{
candidate_process_context_t *cpc;
@@ -1449,8 +1458,13 @@ static void __update_slot(int type, bool app_exists)
}
if (cpc->pid == CANDIDATE_NONE &&
- cpc->idle_checker == 0)
- __set_idle_checker_timer(cpc);
+ cpc->idle_checker == 0) {
+ if (__timer)
+ g_source_remove(__timer);
+
+ __timer = g_timeout_add(500,
+ __handle_slot_update, NULL);
+ }
}
}
@@ -2139,6 +2153,9 @@ static int __before_loop(int argc, char **argv)
static void __after_loop(void)
{
+ if (__timer)
+ g_source_remove(__timer);
+
__unregister_vconf_events();
if (__pid_table)
g_hash_table_destroy(__pid_table);
diff --git a/src/loader_info.c b/src/loader_info.c
index 2150119..8fd9a8f 100644
--- a/src/loader_info.c
+++ b/src/loader_info.c
@@ -68,7 +68,8 @@ static loader_info_t *__create_loader_info()
info->app_types = NULL;
info->hw_acc = NULL;
info->alternative_loaders = NULL;
- info->detection_method = METHOD_TIMEOUT | METHOD_VISIBILITY;
+ info->detection_method = METHOD_TIMEOUT | METHOD_VISIBILITY |
+ METHOD_INSTALL;
info->timeout_val = 5000;
info->extra = bundle_create();
info->cpu_threshold_max = DEFAULT_CPU_THRESHOLD_MAX;
@@ -100,6 +101,7 @@ static void __parse_detection_method(loader_info_t *info, char *line)
token = strtok_r(NULL, " |\t\r\n", &savedptr);
}
+ info->detection_method |= METHOD_INSTALL;
_D("detection_method:%d", info->detection_method);
}