Update pending list management code 88/12488/1
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 15 Nov 2013 13:31:40 +0000 (22:31 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 15 Nov 2013 13:31:40 +0000 (22:31 +0900)
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: I880dba72602dd287e3814d28e7113aba8708519b

packaging/org.tizen.data-provider-slave.spec
src/lb.c

index d19e6ad..b5c042b 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: org.tizen.data-provider-slave
 Summary: Plugin type livebox service provider
-Version: 0.12.17
+Version: 0.12.18
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 1d52bff..3eccfa5 100644 (file)
--- 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);
                                }