summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-12-06 11:27:37 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-12-06 12:02:32 +0900
commit10eb4c9a6b62558fb0b7d61d6c0442acad672278 (patch)
treeaf6d096feb81b4ac374d54be34f9240852df1b49 /src/lib/eldbus
parent092f1919b1bb94d0879a152f5e896bb1001fab8d (diff)
eldbus: change to idle_enterer from idler
Summary: This patch set changes eldbus to use idle_enterer from idler. If an application does not give idle time, then the eldbus cannot have chance to work. Reviewers: raster, cedric Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D4443
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_core.c47
-rw-r--r--src/lib/eldbus/eldbus_private_types.h6
-rw-r--r--src/lib/eldbus/eldbus_service.c46
3 files changed, 53 insertions, 46 deletions
diff --git a/src/lib/eldbus/eldbus_core.c b/src/lib/eldbus/eldbus_core.c
index 6ab6a03a8a..91a4021010 100644
--- a/src/lib/eldbus/eldbus_core.c
+++ b/src/lib/eldbus/eldbus_core.c
@@ -45,7 +45,7 @@ typedef struct _Eldbus_Connection_Context_NOC_Cb
45 Eldbus_Name_Owner_Changed_Cb cb; 45 Eldbus_Name_Owner_Changed_Cb cb;
46 const void *cb_data; 46 const void *cb_data;
47 Eina_Bool deleted : 1; 47 Eina_Bool deleted : 1;
48 Ecore_Idler *idler; 48 Ecore_Idle_Enterer *idle_enterer;
49 Eina_Bool allow_initial : 1; 49 Eina_Bool allow_initial : 1;
50} Eldbus_Connection_Context_NOC_Cb; 50} Eldbus_Connection_Context_NOC_Cb;
51 51
@@ -760,7 +760,7 @@ cb_timeout_toggle(DBusTimeout *timeout, void *data EINA_UNUSED)
760} 760}
761 761
762static Eina_Bool 762static Eina_Bool
763eldbus_idler(void *data) 763eldbus_idle_enterer(void *data)
764{ 764{
765 Eldbus_Connection *conn = data; 765 Eldbus_Connection *conn = data;
766 766
@@ -770,15 +770,22 @@ eldbus_idler(void *data)
770 if (dbus_connection_get_dispatch_status(conn->dbus_conn) == 770 if (dbus_connection_get_dispatch_status(conn->dbus_conn) ==
771 DBUS_DISPATCH_COMPLETE) 771 DBUS_DISPATCH_COMPLETE)
772 { 772 {
773 DBG("Connection@%p: Dispatch complete, idler@%p finishing", 773 DBG("Connection@%p: Dispatch complete, idle_enterer@%p finishing",
774 conn, conn->idler); 774 conn, conn->idle_enterer);
775 conn->idler = NULL; 775 conn->idle_enterer = NULL;
776 return ECORE_CALLBACK_CANCEL; 776 return ECORE_CALLBACK_CANCEL;
777 } 777 }
778 DBG("Connection@%p: Dispatching", conn); 778 DBG("Connection@%p: Dispatching", conn);
779 eldbus_init(); 779 eldbus_init();
780 eldbus_connection_ref(conn); 780 eldbus_connection_ref(conn);
781 dbus_connection_dispatch(conn->dbus_conn); 781
782 DBusDispatchStatus status;
783 do
784 {
785 status = dbus_connection_dispatch(conn->dbus_conn);
786 }
787 while(status == DBUS_DISPATCH_DATA_REMAINS);
788
782 eldbus_connection_unref(conn); 789 eldbus_connection_unref(conn);
783 eldbus_shutdown(); 790 eldbus_shutdown();
784 return ECORE_CALLBACK_RENEW; 791 return ECORE_CALLBACK_RENEW;
@@ -797,19 +804,19 @@ cb_dispatch_status(DBusConnection *dbus_conn EINA_UNUSED, DBusDispatchStatus new
797 804
798 DBG("Connection@%p: Dispatch status: %d", conn, new_status); 805 DBG("Connection@%p: Dispatch status: %d", conn, new_status);
799 806
800 if ((new_status == DBUS_DISPATCH_DATA_REMAINS) && (!conn->idler)) 807 if ((new_status == DBUS_DISPATCH_DATA_REMAINS) && (!conn->idle_enterer))
801 { 808 {
802 conn->idler = ecore_idler_add(eldbus_idler, conn); 809 conn->idle_enterer = ecore_idle_enterer_add(eldbus_idle_enterer, conn);
803 DBG("Connection@%p: Adding idler@%p to handle remaining dispatch data", 810 DBG("Connection@%p: Adding idle_enterer@%p to handle remaining dispatch data",
804 conn, conn->idler); 811 conn, conn->idle_enterer);
805 } 812 }
806 else if ((new_status != DBUS_DISPATCH_DATA_REMAINS) && (conn->idler)) 813 else if ((new_status != DBUS_DISPATCH_DATA_REMAINS) && (conn->idle_enterer))
807 { 814 {
808 DBG("Connection@%p: No remaining dispatch data, clearing idler@%p", 815 DBG("Connection@%p: No remaining dispatch data, clearing idle_enterer@%p",
809 conn, conn->idler); 816 conn, conn->idle_enterer);
810 817
811 ecore_idler_del(conn->idler); 818 ecore_idle_enterer_del(conn->idle_enterer);
812 conn->idler = NULL; 819 conn->idle_enterer = NULL;
813 } 820 }
814} 821}
815 822
@@ -1245,7 +1252,7 @@ _eldbus_connection_free(Eldbus_Connection *conn)
1245 1252
1246 eldbus_data_del_all(&conn->data); 1253 eldbus_data_del_all(&conn->data);
1247 1254
1248 if (conn->idler) ecore_idler_del(conn->idler); 1255 if (conn->idle_enterer) ecore_idle_enterer_del(conn->idle_enterer);
1249 if (conn->type && conn->shared) 1256 if (conn->type && conn->shared)
1250 { 1257 {
1251 if (conn->type == ELDBUS_CONNECTION_TYPE_ADDRESS) 1258 if (conn->type == ELDBUS_CONNECTION_TYPE_ADDRESS)
@@ -1343,7 +1350,7 @@ dispach_name_owner_cb(void *context)
1343 dispatch_name_owner_data *data = context; 1350 dispatch_name_owner_data *data = context;
1344 data->ctx->cb((void *)data->ctx->cb_data, data->cn->name, "", 1351 data->ctx->cb((void *)data->ctx->cb_data, data->cn->name, "",
1345 data->cn->unique_id); 1352 data->cn->unique_id);
1346 data->ctx->idler = NULL; 1353 data->ctx->idle_enterer = NULL;
1347 free(data); 1354 free(data);
1348 return ECORE_CALLBACK_CANCEL; 1355 return ECORE_CALLBACK_CANCEL;
1349} 1356}
@@ -1375,7 +1382,7 @@ eldbus_name_owner_changed_callback_add(Eldbus_Connection *conn, const char *bus,
1375 EINA_SAFETY_ON_NULL_RETURN(dispatch_data); 1382 EINA_SAFETY_ON_NULL_RETURN(dispatch_data);
1376 dispatch_data->cn = cn; 1383 dispatch_data->cn = cn;
1377 dispatch_data->ctx = ctx; 1384 dispatch_data->ctx = ctx;
1378 ctx->idler = ecore_idler_add(dispach_name_owner_cb, dispatch_data); 1385 ctx->idle_enterer = ecore_idle_enterer_add(dispach_name_owner_cb, dispatch_data);
1379 } 1386 }
1380 return; 1387 return;
1381 1388
@@ -1418,10 +1425,10 @@ eldbus_name_owner_changed_callback_del(Eldbus_Connection *conn, const char *bus,
1418 1425
1419 cn->event_handlers.list = eina_inlist_remove(cn->event_handlers.list, 1426 cn->event_handlers.list = eina_inlist_remove(cn->event_handlers.list,
1420 EINA_INLIST_GET(found)); 1427 EINA_INLIST_GET(found));
1421 if (found->idler) 1428 if (found->idle_enterer)
1422 { 1429 {
1423 dispatch_name_owner_data *data; 1430 dispatch_name_owner_data *data;
1424 data = ecore_idler_del(found->idler); 1431 data = ecore_idle_enterer_del(found->idle_enterer);
1425 free(data); 1432 free(data);
1426 } 1433 }
1427 free(found); 1434 free(found);
diff --git a/src/lib/eldbus/eldbus_private_types.h b/src/lib/eldbus/eldbus_private_types.h
index 7af94263db..05dfee8338 100644
--- a/src/lib/eldbus/eldbus_private_types.h
+++ b/src/lib/eldbus/eldbus_private_types.h
@@ -54,7 +54,7 @@ struct _Eldbus_Connection
54 Eina_Inlist *pendings; 54 Eina_Inlist *pendings;
55 Eina_Inlist *fd_handlers; 55 Eina_Inlist *fd_handlers;
56 Eina_Inlist *timeouts; 56 Eina_Inlist *timeouts;
57 Ecore_Idler *idler; 57 Ecore_Idle_Enterer *idle_enterer;
58 Eldbus_Connection_Context_Event event_handlers[ELDBUS_CONNECTION_EVENT_LAST]; 58 Eldbus_Connection_Context_Event event_handlers[ELDBUS_CONNECTION_EVENT_LAST];
59 Eina_Inlist *root_objs;//service_object 59 Eina_Inlist *root_objs;//service_object
60 Eldbus_Proxy *fdo_proxy; 60 Eldbus_Proxy *fdo_proxy;
@@ -153,7 +153,7 @@ struct _Eldbus_Service_Object
153 Eldbus_Service_Interface *objmanager; 153 Eldbus_Service_Interface *objmanager;
154 Eina_List *iface_added; 154 Eina_List *iface_added;
155 Eina_List *iface_removed; 155 Eina_List *iface_removed;
156 Ecore_Idler *idler_iface_changed; 156 Ecore_Idle_Enterer *idle_enterer_iface_changed;
157}; 157};
158 158
159struct _Eldbus_Service_Interface 159struct _Eldbus_Service_Interface
@@ -167,7 +167,7 @@ struct _Eldbus_Service_Interface
167 Eina_Hash *properties; 167 Eina_Hash *properties;
168 Eldbus_Property_Set_Cb set_func; 168 Eldbus_Property_Set_Cb set_func;
169 Eldbus_Property_Get_Cb get_func; 169 Eldbus_Property_Get_Cb get_func;
170 Ecore_Idler *idler_propschanged; 170 Ecore_Idle_Enterer *idle_enterer_propschanged;
171 Eina_Array *props_changed; 171 Eina_Array *props_changed;
172 Eina_Array *prop_invalidated; 172 Eina_Array *prop_invalidated;
173}; 173};
diff --git a/src/lib/eldbus/eldbus_service.c b/src/lib/eldbus/eldbus_service.c
index 9fdcdd5a6b..39f2a29573 100644
--- a/src/lib/eldbus/eldbus_service.c
+++ b/src/lib/eldbus/eldbus_service.c
@@ -784,7 +784,7 @@ _object_manager_changes_process(void *data)
784 Eldbus_Service_Object *obj = data; 784 Eldbus_Service_Object *obj = data;
785 Eldbus_Service_Object *parent = _object_manager_parent_find(obj); 785 Eldbus_Service_Object *parent = _object_manager_parent_find(obj);
786 786
787 obj->idler_iface_changed = NULL; 787 obj->idle_enterer_iface_changed = NULL;
788 788
789 if (!parent) 789 if (!parent)
790 { 790 {
@@ -823,8 +823,8 @@ _eldbus_service_interface_add(Eldbus_Service_Object *obj, const char *interface)
823 iface->obj = obj; 823 iface->obj = obj;
824 eina_hash_add(obj->interfaces, iface->name, iface); 824 eina_hash_add(obj->interfaces, iface->name, iface);
825 825
826 if (!obj->idler_iface_changed) 826 if (!obj->idle_enterer_iface_changed)
827 obj->idler_iface_changed = ecore_idler_add(_object_manager_changes_process, 827 obj->idle_enterer_iface_changed = ecore_idle_enterer_add(_object_manager_changes_process,
828 obj); 828 obj);
829 obj->iface_added = eina_list_append(obj->iface_added, iface); 829 obj->iface_added = eina_list_append(obj->iface_added, iface);
830 830
@@ -1016,7 +1016,7 @@ eldbus_service_interface_fallback_register2(Eldbus_Connection *conn, const char
1016} 1016}
1017 1017
1018static Eina_Bool 1018static Eina_Bool
1019_idler_propschanged(void *data) 1019_idle_enterer_propschanged(void *data)
1020{ 1020{
1021 Eldbus_Service_Interface *iface = data; 1021 Eldbus_Service_Interface *iface = data;
1022 Eldbus_Message *msg; 1022 Eldbus_Message *msg;
@@ -1024,7 +1024,7 @@ _idler_propschanged(void *data)
1024 Eina_Hash *added = NULL; 1024 Eina_Hash *added = NULL;
1025 Property *prop; 1025 Property *prop;
1026 1026
1027 iface->idler_propschanged = NULL; 1027 iface->idle_enterer_propschanged = NULL;
1028 1028
1029 added = eina_hash_string_small_new(NULL); 1029 added = eina_hash_string_small_new(NULL);
1030 msg = eldbus_message_signal_new(iface->obj->path, properties_iface->name, 1030 msg = eldbus_message_signal_new(iface->obj->path, properties_iface->name,
@@ -1128,10 +1128,10 @@ _interface_free(Eldbus_Service_Interface *interface)
1128 /** 1128 /**
1129 * flush props changes before remove interface 1129 * flush props changes before remove interface
1130 */ 1130 */
1131 if (interface->idler_propschanged) 1131 if (interface->idle_enterer_propschanged)
1132 { 1132 {
1133 ecore_idler_del(interface->idler_propschanged); 1133 ecore_idle_enterer_del(interface->idle_enterer_propschanged);
1134 _idler_propschanged(interface); 1134 _idle_enterer_propschanged(interface);
1135 } 1135 }
1136 1136
1137 eina_hash_free(interface->methods); 1137 eina_hash_free(interface->methods);
@@ -1151,17 +1151,17 @@ _interface_free(Eldbus_Service_Interface *interface)
1151 /* Adding and removing the interface in the same main loop iteration. 1151 /* Adding and removing the interface in the same main loop iteration.
1152 * Let's not send any signal */ 1152 * Let's not send any signal */
1153 obj->iface_added = eina_list_remove_list(obj->iface_added, l); 1153 obj->iface_added = eina_list_remove_list(obj->iface_added, l);
1154 if (!obj->iface_added && !obj->iface_removed && obj->idler_iface_changed) 1154 if (!obj->iface_added && !obj->iface_removed && obj->idle_enterer_iface_changed)
1155 { 1155 {
1156 ecore_idler_del(obj->idler_iface_changed); 1156 ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
1157 obj->idler_iface_changed = NULL; 1157 obj->idle_enterer_iface_changed = NULL;
1158 } 1158 }
1159 } 1159 }
1160 else 1160 else
1161 { 1161 {
1162 if (!obj->idler_iface_changed) 1162 if (!obj->idle_enterer_iface_changed)
1163 { 1163 {
1164 obj->idler_iface_changed = ecore_idler_add( 1164 obj->idle_enterer_iface_changed = ecore_idle_enterer_add(
1165 _object_manager_changes_process, obj); 1165 _object_manager_changes_process, obj);
1166 } 1166 }
1167 1167
@@ -1188,9 +1188,9 @@ static void _children_ifaces_add_removed_flush(Eldbus_Service_Object *obj)
1188 _children_ifaces_add_removed_flush(children); 1188 _children_ifaces_add_removed_flush(children);
1189 } 1189 }
1190 1190
1191 if (obj->idler_iface_changed) 1191 if (obj->idle_enterer_iface_changed)
1192 { 1192 {
1193 ecore_idler_del(obj->idler_iface_changed); 1193 ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
1194 _object_manager_changes_process(obj); 1194 _object_manager_changes_process(obj);
1195 } 1195 }
1196} 1196}
@@ -1221,9 +1221,9 @@ _object_free(Eldbus_Service_Object *obj)
1221 * Flush our iface_add/removed if this object are 1221 * Flush our iface_add/removed if this object are
1222 * children of some other path with ObjectManager 1222 * children of some other path with ObjectManager
1223 */ 1223 */
1224 if (obj->idler_iface_changed) 1224 if (obj->idle_enterer_iface_changed)
1225 { 1225 {
1226 ecore_idler_del(obj->idler_iface_changed); 1226 ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
1227 _object_manager_changes_process(obj); 1227 _object_manager_changes_process(obj);
1228 } 1228 }
1229 1229
@@ -1482,8 +1482,8 @@ eldbus_service_property_changed(const Eldbus_Service_Interface *interface, const
1482 prop = eina_hash_find(iface->properties, name); 1482 prop = eina_hash_find(iface->properties, name);
1483 EINA_SAFETY_ON_NULL_RETURN_VAL(prop, EINA_FALSE); 1483 EINA_SAFETY_ON_NULL_RETURN_VAL(prop, EINA_FALSE);
1484 1484
1485 if (!iface->idler_propschanged) 1485 if (!iface->idle_enterer_propschanged)
1486 iface->idler_propschanged = ecore_idler_add(_idler_propschanged, iface); 1486 iface->idle_enterer_propschanged = ecore_idle_enterer_add(_idle_enterer_propschanged, iface);
1487 if (!iface->props_changed) 1487 if (!iface->props_changed)
1488 iface->props_changed = eina_array_new(1); 1488 iface->props_changed = eina_array_new(1);
1489 1489
@@ -1507,8 +1507,8 @@ eldbus_service_property_invalidate_set(const Eldbus_Service_Interface *interface
1507 1507
1508 prop->is_invalidate = is_invalidate; 1508 prop->is_invalidate = is_invalidate;
1509 1509
1510 if (!iface->idler_propschanged) 1510 if (!iface->idle_enterer_propschanged)
1511 iface->idler_propschanged = ecore_idler_add(_idler_propschanged, iface); 1511 iface->idle_enterer_propschanged = ecore_idle_enterer_add(_idle_enterer_propschanged, iface);
1512 1512
1513 if (is_invalidate) 1513 if (is_invalidate)
1514 { 1514 {
@@ -1546,8 +1546,8 @@ eldbus_service_object_manager_attach(Eldbus_Service_Interface *iface)
1546 * with path equal to our path rather than from the previous 1546 * with path equal to our path rather than from the previous
1547 * ObjectManager 1547 * ObjectManager
1548 */ 1548 */
1549 if (obj->idler_iface_changed) 1549 if (obj->idle_enterer_iface_changed)
1550 ecore_idler_del(obj->idler_iface_changed); 1550 ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
1551 _object_manager_changes_process(obj); 1551 _object_manager_changes_process(obj);
1552 1552
1553 obj->objmanager = objmanager; 1553 obj->objmanager = objmanager;