From 55184d32e36b29b4c8e2daa65c9f1f2bd3a3e093 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 15 Nov 2013 22:26:59 +0900 Subject: [PATCH] Update pending list management code if the dbox is not shown yet (not the pause,resume event). do not append it to pending list. instead of pending list, add it to hidden list. so if it is shown (render buffer is ready to draw something one it, in case of script type), move it to the pending list from hidden list. so while creating a render buffer from master, the livebox will not do busy waiting now. just it will do update again when it gets shown. (move from hidden_list to pending_list) Change-Id: Ic13db8f7d7c2f8bc2c6908975bfb6dac6a9a06d3 --- packaging/com.samsung.data-provider-slave.spec | 2 +- src/lb.c | 52 +++++++++++++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/packaging/com.samsung.data-provider-slave.spec b/packaging/com.samsung.data-provider-slave.spec index 6b14942..4f9d342 100644 --- a/packaging/com.samsung.data-provider-slave.spec +++ b/packaging/com.samsung.data-provider-slave.spec @@ -2,7 +2,7 @@ Name: com.samsung.data-provider-slave Summary: Plugin type livebox service provider -Version: 0.12.18 +Version: 0.12.19 Release: 1 Group: HomeTF/Livebox License: Flora License diff --git a/src/lb.c b/src/lb.c index 1d52bff..3eccfa5 100644 --- a/src/lb.c +++ b/src/lb.c @@ -66,6 +66,7 @@ static struct info { Eina_List *item_list; Eina_List *update_list; Eina_List *pending_list; + Eina_List *hidden_list; Ecore_Timer *pending_timer; Eina_List *pd_open_pending_list; Ecore_Timer *pd_open_pending_timer; @@ -77,6 +78,7 @@ static struct info { .item_list = NULL, .update_list = NULL, .pending_list = NULL, + .hidden_list = NULL, .pending_timer = NULL, .pd_open_pending_list = NULL, .pd_open_pending_timer = NULL, @@ -324,6 +326,11 @@ static inline int is_pended_item(struct item *item) static int append_pending_list(struct item *item) { + if (item->deleteme) { + DbgPrint("Item will be deleted, ignore update request: %s\n", item->inst->id); + return LB_STATUS_ERROR_BUSY; + } + if (pd_is_opened(item->inst->item->pkgname) == 1) { if (eina_list_data_find(s_info.pd_open_pending_list, item) == item) { DbgPrint("Already pended - %s\n", item->inst->item->pkgname); @@ -342,15 +349,34 @@ static int append_pending_list(struct item *item) return LB_STATUS_ERROR_EXIST; } - if (activate_pending_consumer() < 0) { - return LB_STATUS_ERROR_FAULT; - } + if (IS_LB_SHOWN(item)) { + if (activate_pending_consumer() < 0) { + return LB_STATUS_ERROR_FAULT; + } - s_info.pending_list = eina_list_append(s_info.pending_list, item); + s_info.pending_list = eina_list_append(s_info.pending_list, item); + } else { + if (eina_list_data_find(s_info.hidden_list, item) == item) { + DbgPrint("Already in hidden list - %s\n", item->inst->item->pkgname); + return LB_STATUS_ERROR_EXIST; + } + + s_info.hidden_list = eina_list_append(s_info.hidden_list, item); + } } return 0; } +static inline void migrate_to_pending_list_from_hidden_list(struct item *item) +{ + if (!eina_list_data_find(s_info.hidden_list, item)) { + return; + } + + s_info.hidden_list = eina_list_remove(s_info.hidden_list, item); + append_pending_list(item); +} + /*! * \brief * This function can call the update callback @@ -1145,21 +1171,19 @@ HAPI int lb_destroy(const char *pkgname, const char *id) s_info.item_list = eina_list_remove_list(s_info.item_list, l); s_info.update_list = eina_list_remove(s_info.update_list, item); + s_info.hidden_list = eina_list_remove(s_info.hidden_list, item); + clear_from_pd_open_pending_list(item); + clear_from_pending_list(item); if (item->timer) { - clear_from_pd_open_pending_list(item); - clear_from_pending_list(item); ecore_timer_del(item->timer); item->timer = NULL; - - if (item->monitor) { - item->deleteme = 1; - } else { - update_monitor_del(id, item); - } } - if (!item->monitor) { + if (item->monitor) { + item->deleteme = 1; + } else { + update_monitor_del(id, item); free(item); (void)so_destroy(inst); } @@ -1328,6 +1352,8 @@ HAPI int lb_script_event(const char *pkgname, const char *id, const char *emissi if (!strcmp(emission, "lb,show")) { item->is_lb_show = 1; + migrate_to_pending_list_from_hidden_list(item); + if (item->is_lb_updated && !is_pended_item(item)) { reset_lb_updated_flag(item); } -- 2.7.4