Consuming pended update request.
authorSung-jae Park <nicesj.park@samsung.com>
Mon, 18 Nov 2013 04:22:18 +0000 (13:22 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 18 Nov 2013 04:23:33 +0000 (13:23 +0900)
When it gets resume event, if it exceed the update period,
consuming the pended update request and update the box.

Change-Id: Ie733da7b4675d3d96ba771696efa8726ab26e4fc

CMakeLists.txt
packaging/com.samsung.data-provider-slave.spec
src/lb.c

index 578b232..45b02e7 100644 (file)
@@ -53,6 +53,7 @@ ADD_DEFINITIONS("-DNDEBUG")
 ADD_DEFINITIONS("-DLOG_TAG=\"DATA_PROVIDER_SLAVE\"")
 ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 #ADD_DEFINITIONS("-D_LOOP_DETECTOR")
+#ADD_DEFINITIONS("-D_ESTIMATE_PERF")
 
 ADD_DEFINITIONS(${pkg_CFLAGS})
 
index 4f9d342..db3791e 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: com.samsung.data-provider-slave
 Summary: Plugin type livebox service provider
-Version: 0.12.19
+Version: 0.12.20
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 3eccfa5..0a5c960 100644 (file)
--- a/src/lb.c
+++ b/src/lb.c
 #include "fault.h"
 #include "util.h"
 
+#if defined(_ESTIMATE_PERF)
+#define ESTIMATE_START(id)     DbgPrint("%s START\n", id);
+#define ESTIMATE_END(id)       DbgPrint("%s END\n", id);
+#else
+#define ESTIMATE_START(id)
+#define ESTIMATE_END(id)
+#endif
+
 #define IS_LB_SHOWN(itm) (!(itm)->inst->item->has_livebox_script || ((itm)->inst->item->has_livebox_script && (itm)->is_lb_show))
 
 int errno;
@@ -377,6 +385,26 @@ static inline void migrate_to_pending_list_from_hidden_list(struct item *item)
        append_pending_list(item);
 }
 
+static inline int clear_from_pending_list(struct item *item)
+{
+       Eina_List *l;
+       struct item *tmp;
+
+       EINA_LIST_FOREACH(s_info.pending_list, l, tmp) {
+               if (tmp != item) {
+                       continue;
+               }
+
+               s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
+               if (!s_info.pending_list) {
+                       deactivate_pending_consumer();
+               }
+               return LB_STATUS_SUCCESS;
+       }
+
+       return LB_STATUS_ERROR_NOT_EXIST;
+}
+
 /*!
  * \brief
  *   This function can call the update callback
@@ -408,6 +436,13 @@ static inline int timer_thaw(struct item *item)
        item->sleep_at = 0.0f;
 
        if (sleep_time > pending) {
+
+               /*!
+                * Before do updating forcely, clear it from the pending list.
+                * We will consume it from here now.
+                */
+               (void)clear_from_pending_list(item);
+
                if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
                        /* item is destroyed */
                        return UPDATE_ITEM_DELETED;
@@ -629,26 +664,6 @@ static inline int clear_from_pd_open_pending_list(struct item *item)
        return LB_STATUS_ERROR_NOT_EXIST;
 }
 
-static inline int clear_from_pending_list(struct item *item)
-{
-       Eina_List *l;
-       struct item *tmp;
-
-       EINA_LIST_FOREACH(s_info.pending_list, l, tmp) {
-               if (tmp != item) {
-                       continue;
-               }
-
-               s_info.pending_list = eina_list_remove_list(s_info.pending_list, l);
-               if (!s_info.pending_list) {
-                       deactivate_pending_consumer();
-               }
-               return LB_STATUS_SUCCESS;
-       }
-
-       return LB_STATUS_ERROR_NOT_EXIST;
-}
-
 static Eina_Bool update_timeout_cb(void *data)
 {
        struct item *item;
@@ -1212,7 +1227,9 @@ HAPI int lb_resize(const char *pkgname, const char *id, int w, int h)
 
        item = eina_list_data_get(l);
 
+       ESTIMATE_START(id);
        ret = so_resize(inst, w, h);
+       ESTIMATE_END(id);
        if (ret < 0) {
                return ret;
        }
@@ -1309,7 +1326,9 @@ HAPI int lb_clicked(const char *pkgname, const char *id, const char *event, doub
 
        item = eina_list_data_get(l);
 
+       ESTIMATE_START(id);
        ret = so_clicked(inst, event, timestamp, x, y);
+       ESTIMATE_END(id);
        if (ret < 0) {
                return ret;
        }
@@ -1376,7 +1395,9 @@ HAPI int lb_script_event(const char *pkgname, const char *id, const char *emissi
                }
        }
 
+       ESTIMATE_START(id);
        ret = so_script_event(inst, emission, source, event_info);
+       ESTIMATE_END(id);
        if (ret < 0) {
                return ret;
        }