Fix the missed update event handling bug.
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 25 Jun 2013 05:44:49 +0000 (14:44 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 25 Jun 2013 05:44:49 +0000 (14:44 +0900)
[model] Redwood
[binary_type] AP
[customer] Docomo/Orange/Open
[issue#] N/A
[problem] While upating contents, if a user event occured (resize, click, etc, ..), the updating process is not completed successfully.
[cause] even though the content file is updated several times, the inotify event is occured only once.
[solution] While updating contents, even if a user events are occurred, merge them into A updated event.
[team] HomeTF
[request]
[horizontal_expansion]

Change-Id: Ib9af807b864c4e8c837d1ecae343b3b3ebb22eee

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

index 3ab9c74..f68e281 100644 (file)
@@ -2,7 +2,7 @@
 
 Name: com.samsung.data-provider-slave
 Summary: Plugin type livebox service provider.
-Version: 0.11.8
+Version: 0.11.9
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index cf11dfd..9f1fe3b 100644 (file)
--- a/src/lb.c
+++ b/src/lb.c
@@ -35,6 +35,8 @@
 #include "fault.h"
 #include "util.h"
 
+#define IS_LB_SHOWN(itm) (!(itm)->inst->item->has_livebox_script || ((itm)->inst->item->has_livebox_script && (itm)->is_lb_show))
+
 int errno;
 
 struct item {
@@ -388,10 +390,22 @@ static inline void update_monitor_cnt(struct item *item)
         * And handling this heavy updating from the
         * file update callback.
         */
-       if (interval >= MINIMUM_UPDATE_INTERVAL)
-               item->monitor_cnt++;
-       else
+       if (interval >= MINIMUM_UPDATE_INTERVAL) {
+               if (s_info.update == item) {
+                       /*!
+                        * \note
+                        * If already in updating mode,
+                        * reset the monitor_cnt to 1,
+                        * all updated event will be merged into A inotify event
+                        */
+                       DbgPrint("While waiting updated event, content is updated [%s]\n", item->inst->id);
+                       item->monitor_cnt = 1;
+               } else {
+                       item->monitor_cnt++;
+               }
+       } else {
                item->heavy_updating = 1;
+       }
 
        item->update_interval = now;
 }
@@ -425,6 +439,7 @@ static inline int output_handler(struct item *item)
                item->monitor_cnt = 0;
        }
 
+       DbgPrint("Monitor cnt(%s): %d\n", item->inst->id, item->monitor_cnt);
        if (item->monitor_cnt == 0) {
                if (!invalid)
                        fault_unmark_call(item->inst->item->pkgname, item->inst->id, "update,crashed", NO_ALARM);
@@ -493,12 +508,12 @@ static int file_updated_cb(const char *filename, void *data, int over)
                return EXIT_SUCCESS; /*!< To keep the callback */
        }
 
-       if (!item->inst->item->has_livebox_script || (item->inst->item->has_livebox_script && item->is_lb_show)) {
+       if (IS_LB_SHOWN(item)) {
                provider_send_updated(item->inst->item->pkgname, item->inst->id,
                                        item->inst->w, item->inst->h, item->inst->priority, content, title);
        } else {
-               DbgPrint("Livebox script is not ready yet\n");
                item->is_lb_updated++;
+               DbgPrint("Livebox script is not ready yet [%d]\n", item->is_lb_updated);
        }
 
        return output_handler(item);
@@ -570,6 +585,12 @@ static Eina_Bool updator_cb(void *data)
                return ECORE_CALLBACK_RENEW;
        }
 
+       if (!IS_LB_SHOWN(item)) {
+               DbgPrint("%s is not shown yet. delaying updates\n", item->inst->item->pkgname);
+               (void)append_pending_list(item);
+               return ECORE_CALLBACK_RENEW;
+       }
+
        ret = so_is_updated(item->inst);
        if (ret <= 0) {
                if (so_need_to_destroy(item->inst) == NEED_TO_DESTROY) {