static struct info {
Eina_List *item_list;
+ Eina_List *force_update_list;
Eina_List *update_list;
Eina_List *pending_list;
Eina_List *hidden_list;
+ Ecore_Timer *force_update_timer;
Ecore_Timer *pending_timer;
Eina_List *pd_open_pending_list;
Ecore_Timer *pd_open_pending_timer;
int pending_timer_freezed;
} s_info = {
.item_list = NULL,
+ .force_update_list = NULL,
.update_list = NULL,
.pending_list = NULL,
.hidden_list = NULL,
+ .force_update_timer = NULL,
.pending_timer = NULL,
.pd_open_pending_list = NULL,
.pd_open_pending_timer = NULL,
};
static Eina_Bool updator_cb(void *data);
+static inline void update_monitor_del(const char *id, struct item *item);
static void pending_timer_freeze(void)
{
return ECORE_CALLBACK_CANCEL;
}
+static Eina_Bool force_update_cb(void *data)
+{
+ struct item *item;
+
+ item = eina_list_nth(s_info.force_update_list, 0);
+ if (!item) {
+ goto cleanout;
+ }
+
+ if (eina_list_data_find(s_info.update_list, item) || pd_is_opened(item->inst->item->pkgname) < 0) {
+ return ECORE_CALLBACK_RENEW;
+ }
+
+ s_info.force_update_list = eina_list_remove(s_info.force_update_list, item);
+ if (updator_cb(item) == ECORE_CALLBACK_CANCEL) {
+ }
+
+ if (s_info.force_update_list) {
+ return ECORE_CALLBACK_RENEW;
+ }
+
+cleanout:
+ s_info.force_update_timer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static inline __attribute__((always_inline)) int activate_force_update_consumer(void)
+{
+ if (s_info.force_update_timer) {
+ return LB_STATUS_SUCCESS;
+ }
+
+ s_info.force_update_timer = ecore_timer_add(0.000001f, force_update_cb, NULL);
+ if (!s_info.force_update_timer) {
+ ErrPrint("Failed to add a new force update timer\n");
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ DbgPrint("Force update timer is registered\n");
+
+ return LB_STATUS_SUCCESS;
+}
+
+static inline void deactivate_force_update_consumer(void)
+{
+ if (!s_info.force_update_timer) {
+ return;
+ }
+
+ ecore_timer_del(s_info.force_update_timer);
+ s_info.force_update_timer = NULL;
+
+ DbgPrint("Force update timer is deleted\n");
+}
+
static Eina_Bool pended_cmd_consumer_cb(void *data)
{
struct item *item;
static inline __attribute__((always_inline)) int activate_pending_consumer(void)
{
if (s_info.pending_timer) {
- return 0;
+ return LB_STATUS_SUCCESS;
}
s_info.pending_timer = ecore_timer_add(0.000001f, pended_cmd_consumer_cb, NULL);
ecore_timer_freeze(s_info.pending_timer);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline void deactivate_pending_consumer(void)
return 0;
}
+static int append_force_update_list(struct item *item)
+{
+ if (item->deleteme) {
+ DbgPrint("Item will be deleted, ignore force update request: %s\n", item->inst->id);
+ return LB_STATUS_ERROR_BUSY;
+ }
+
+ if (!IS_LB_SHOWN(item)) {
+ if (eina_list_data_find(s_info.hidden_list, item) == item) {
+ DbgPrint("Already in hidden list - %s\n", item->inst->id);
+ return LB_STATUS_ERROR_EXIST;
+ }
+
+ s_info.hidden_list = eina_list_append(s_info.hidden_list, item);
+
+ DbgPrint("forced item is moved to hidden_list - %s\n", item->inst->id);
+ return LB_STATUS_SUCCESS;
+ }
+
+ if (eina_list_data_find(s_info.force_update_list, item)) {
+ DbgPrint("Already in force update list\n");
+ return LB_STATUS_SUCCESS;
+ }
+
+ if (activate_force_update_consumer() < 0) {
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ s_info.force_update_list = eina_list_append(s_info.force_update_list, item);
+ return LB_STATUS_SUCCESS;
+}
+
+static inline int clear_from_force_update_list(struct item *item)
+{
+ Eina_List *l;
+ struct item *tmp;
+
+ EINA_LIST_FOREACH(s_info.force_update_list, l, tmp) {
+ if (tmp != item) {
+ continue;
+ }
+
+ s_info.force_update_list = eina_list_remove_list(s_info.force_update_list, l);
+ if (!s_info.force_update_list) {
+ deactivate_force_update_consumer();
+ }
+
+ return LB_STATUS_SUCCESS;
+ }
+
+ return LB_STATUS_ERROR_NOT_EXIST;
+}
+
static inline void migrate_to_pending_list_from_hidden_list(struct item *item)
{
if (!eina_list_data_find(s_info.hidden_list, item)) {
return NULL;
}
+static int desc_updated_cb(const char *filename, void *data, int over)
+{
+ struct item *item;
+
+ if (over) {
+ WarnPrint("Event Q overflow\n");
+ }
+
+ item = data;
+
+ DbgPrint("DESC %s is updated\n", filename);
+ if (item->is_pd_show) {
+ provider_send_desc_updated(item->inst->item->pkgname, item->inst->id, filename);
+ } else {
+ ErrPrint("But PD is not opened, Ignore this update (%s)\n", item->inst->id);
+ }
+ return EXIT_SUCCESS;
+}
+
static inline int output_handler(struct item *item)
{
int invalid = 0;
s_info.update_list = eina_list_remove(s_info.update_list, item);
if (item->deleteme) {
+ update_monitor_del(item->inst->id, item);
provider_send_deleted(item->inst->item->pkgname, item->inst->id);
(void)so_destroy(item->inst);
free(item);
return EXIT_SUCCESS;
}
-static int desc_updated_cb(const char *filename, void *data, int over)
-{
- struct item *item;
-
- if (over) {
- WarnPrint("Event Q overflow\n");
- }
-
- item = data;
-
- DbgPrint("DESC %s is updated\n", filename);
- if (item->is_pd_show) {
- provider_send_desc_updated(item->inst->item->pkgname, item->inst->id, filename);
- } else {
- ErrPrint("But PD is not opened, Ignore this update (%s)\n", item->inst->id);
- }
- return EXIT_SUCCESS;
-}
-
static int file_updated_cb(const char *filename, void *data, int over)
{
struct item *item;
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
/*!
* \NOTE
(void)append_pending_list(item);
}
+ if (create_ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Returns NEED_TO_FORCE_UPDATE\n", pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (create_ret & OUTPUT_UPDATED) {
update_monitor_cnt(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);
+ clear_from_force_update_list(item);
if (item->timer) {
ecore_timer_del(item->timer);
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
update_monitor_cnt(item);
}
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
update_monitor_cnt(item);
}
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
update_monitor_cnt(item);
}
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
update_monitor_cnt(item);
}
(void)append_pending_list(item);
}
+ if (ret & FORCE_TO_SCHEDULE) {
+ DbgPrint("%s Return NEED_TO_FORCE_SCHEDULE\n", item->inst->item->pkgname);
+ (void)append_force_update_list(item);
+ }
+
if (ret & OUTPUT_UPDATED) {
update_monitor_cnt(item);
}