forked from enlightenment/efl
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
This commit is contained in:
parent
092f1919b1
commit
10eb4c9a6b
|
@ -45,7 +45,7 @@ typedef struct _Eldbus_Connection_Context_NOC_Cb
|
||||||
Eldbus_Name_Owner_Changed_Cb cb;
|
Eldbus_Name_Owner_Changed_Cb cb;
|
||||||
const void *cb_data;
|
const void *cb_data;
|
||||||
Eina_Bool deleted : 1;
|
Eina_Bool deleted : 1;
|
||||||
Ecore_Idler *idler;
|
Ecore_Idle_Enterer *idle_enterer;
|
||||||
Eina_Bool allow_initial : 1;
|
Eina_Bool allow_initial : 1;
|
||||||
} Eldbus_Connection_Context_NOC_Cb;
|
} Eldbus_Connection_Context_NOC_Cb;
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ cb_timeout_toggle(DBusTimeout *timeout, void *data EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
eldbus_idler(void *data)
|
eldbus_idle_enterer(void *data)
|
||||||
{
|
{
|
||||||
Eldbus_Connection *conn = data;
|
Eldbus_Connection *conn = data;
|
||||||
|
|
||||||
|
@ -770,15 +770,22 @@ eldbus_idler(void *data)
|
||||||
if (dbus_connection_get_dispatch_status(conn->dbus_conn) ==
|
if (dbus_connection_get_dispatch_status(conn->dbus_conn) ==
|
||||||
DBUS_DISPATCH_COMPLETE)
|
DBUS_DISPATCH_COMPLETE)
|
||||||
{
|
{
|
||||||
DBG("Connection@%p: Dispatch complete, idler@%p finishing",
|
DBG("Connection@%p: Dispatch complete, idle_enterer@%p finishing",
|
||||||
conn, conn->idler);
|
conn, conn->idle_enterer);
|
||||||
conn->idler = NULL;
|
conn->idle_enterer = NULL;
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
DBG("Connection@%p: Dispatching", conn);
|
DBG("Connection@%p: Dispatching", conn);
|
||||||
eldbus_init();
|
eldbus_init();
|
||||||
eldbus_connection_ref(conn);
|
eldbus_connection_ref(conn);
|
||||||
dbus_connection_dispatch(conn->dbus_conn);
|
|
||||||
|
DBusDispatchStatus status;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
status = dbus_connection_dispatch(conn->dbus_conn);
|
||||||
|
}
|
||||||
|
while(status == DBUS_DISPATCH_DATA_REMAINS);
|
||||||
|
|
||||||
eldbus_connection_unref(conn);
|
eldbus_connection_unref(conn);
|
||||||
eldbus_shutdown();
|
eldbus_shutdown();
|
||||||
return ECORE_CALLBACK_RENEW;
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
@ -797,19 +804,19 @@ cb_dispatch_status(DBusConnection *dbus_conn EINA_UNUSED, DBusDispatchStatus new
|
||||||
|
|
||||||
DBG("Connection@%p: Dispatch status: %d", conn, new_status);
|
DBG("Connection@%p: Dispatch status: %d", conn, new_status);
|
||||||
|
|
||||||
if ((new_status == DBUS_DISPATCH_DATA_REMAINS) && (!conn->idler))
|
if ((new_status == DBUS_DISPATCH_DATA_REMAINS) && (!conn->idle_enterer))
|
||||||
{
|
{
|
||||||
conn->idler = ecore_idler_add(eldbus_idler, conn);
|
conn->idle_enterer = ecore_idle_enterer_add(eldbus_idle_enterer, conn);
|
||||||
DBG("Connection@%p: Adding idler@%p to handle remaining dispatch data",
|
DBG("Connection@%p: Adding idle_enterer@%p to handle remaining dispatch data",
|
||||||
conn, conn->idler);
|
conn, conn->idle_enterer);
|
||||||
}
|
}
|
||||||
else if ((new_status != DBUS_DISPATCH_DATA_REMAINS) && (conn->idler))
|
else if ((new_status != DBUS_DISPATCH_DATA_REMAINS) && (conn->idle_enterer))
|
||||||
{
|
{
|
||||||
DBG("Connection@%p: No remaining dispatch data, clearing idler@%p",
|
DBG("Connection@%p: No remaining dispatch data, clearing idle_enterer@%p",
|
||||||
conn, conn->idler);
|
conn, conn->idle_enterer);
|
||||||
|
|
||||||
ecore_idler_del(conn->idler);
|
ecore_idle_enterer_del(conn->idle_enterer);
|
||||||
conn->idler = NULL;
|
conn->idle_enterer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,7 +1252,7 @@ _eldbus_connection_free(Eldbus_Connection *conn)
|
||||||
|
|
||||||
eldbus_data_del_all(&conn->data);
|
eldbus_data_del_all(&conn->data);
|
||||||
|
|
||||||
if (conn->idler) ecore_idler_del(conn->idler);
|
if (conn->idle_enterer) ecore_idle_enterer_del(conn->idle_enterer);
|
||||||
if (conn->type && conn->shared)
|
if (conn->type && conn->shared)
|
||||||
{
|
{
|
||||||
if (conn->type == ELDBUS_CONNECTION_TYPE_ADDRESS)
|
if (conn->type == ELDBUS_CONNECTION_TYPE_ADDRESS)
|
||||||
|
@ -1343,7 +1350,7 @@ dispach_name_owner_cb(void *context)
|
||||||
dispatch_name_owner_data *data = context;
|
dispatch_name_owner_data *data = context;
|
||||||
data->ctx->cb((void *)data->ctx->cb_data, data->cn->name, "",
|
data->ctx->cb((void *)data->ctx->cb_data, data->cn->name, "",
|
||||||
data->cn->unique_id);
|
data->cn->unique_id);
|
||||||
data->ctx->idler = NULL;
|
data->ctx->idle_enterer = NULL;
|
||||||
free(data);
|
free(data);
|
||||||
return ECORE_CALLBACK_CANCEL;
|
return ECORE_CALLBACK_CANCEL;
|
||||||
}
|
}
|
||||||
|
@ -1375,7 +1382,7 @@ eldbus_name_owner_changed_callback_add(Eldbus_Connection *conn, const char *bus,
|
||||||
EINA_SAFETY_ON_NULL_RETURN(dispatch_data);
|
EINA_SAFETY_ON_NULL_RETURN(dispatch_data);
|
||||||
dispatch_data->cn = cn;
|
dispatch_data->cn = cn;
|
||||||
dispatch_data->ctx = ctx;
|
dispatch_data->ctx = ctx;
|
||||||
ctx->idler = ecore_idler_add(dispach_name_owner_cb, dispatch_data);
|
ctx->idle_enterer = ecore_idle_enterer_add(dispach_name_owner_cb, dispatch_data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1418,10 +1425,10 @@ eldbus_name_owner_changed_callback_del(Eldbus_Connection *conn, const char *bus,
|
||||||
|
|
||||||
cn->event_handlers.list = eina_inlist_remove(cn->event_handlers.list,
|
cn->event_handlers.list = eina_inlist_remove(cn->event_handlers.list,
|
||||||
EINA_INLIST_GET(found));
|
EINA_INLIST_GET(found));
|
||||||
if (found->idler)
|
if (found->idle_enterer)
|
||||||
{
|
{
|
||||||
dispatch_name_owner_data *data;
|
dispatch_name_owner_data *data;
|
||||||
data = ecore_idler_del(found->idler);
|
data = ecore_idle_enterer_del(found->idle_enterer);
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
free(found);
|
free(found);
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct _Eldbus_Connection
|
||||||
Eina_Inlist *pendings;
|
Eina_Inlist *pendings;
|
||||||
Eina_Inlist *fd_handlers;
|
Eina_Inlist *fd_handlers;
|
||||||
Eina_Inlist *timeouts;
|
Eina_Inlist *timeouts;
|
||||||
Ecore_Idler *idler;
|
Ecore_Idle_Enterer *idle_enterer;
|
||||||
Eldbus_Connection_Context_Event event_handlers[ELDBUS_CONNECTION_EVENT_LAST];
|
Eldbus_Connection_Context_Event event_handlers[ELDBUS_CONNECTION_EVENT_LAST];
|
||||||
Eina_Inlist *root_objs;//service_object
|
Eina_Inlist *root_objs;//service_object
|
||||||
Eldbus_Proxy *fdo_proxy;
|
Eldbus_Proxy *fdo_proxy;
|
||||||
|
@ -153,7 +153,7 @@ struct _Eldbus_Service_Object
|
||||||
Eldbus_Service_Interface *objmanager;
|
Eldbus_Service_Interface *objmanager;
|
||||||
Eina_List *iface_added;
|
Eina_List *iface_added;
|
||||||
Eina_List *iface_removed;
|
Eina_List *iface_removed;
|
||||||
Ecore_Idler *idler_iface_changed;
|
Ecore_Idle_Enterer *idle_enterer_iface_changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Eldbus_Service_Interface
|
struct _Eldbus_Service_Interface
|
||||||
|
@ -167,7 +167,7 @@ struct _Eldbus_Service_Interface
|
||||||
Eina_Hash *properties;
|
Eina_Hash *properties;
|
||||||
Eldbus_Property_Set_Cb set_func;
|
Eldbus_Property_Set_Cb set_func;
|
||||||
Eldbus_Property_Get_Cb get_func;
|
Eldbus_Property_Get_Cb get_func;
|
||||||
Ecore_Idler *idler_propschanged;
|
Ecore_Idle_Enterer *idle_enterer_propschanged;
|
||||||
Eina_Array *props_changed;
|
Eina_Array *props_changed;
|
||||||
Eina_Array *prop_invalidated;
|
Eina_Array *prop_invalidated;
|
||||||
};
|
};
|
||||||
|
|
|
@ -784,7 +784,7 @@ _object_manager_changes_process(void *data)
|
||||||
Eldbus_Service_Object *obj = data;
|
Eldbus_Service_Object *obj = data;
|
||||||
Eldbus_Service_Object *parent = _object_manager_parent_find(obj);
|
Eldbus_Service_Object *parent = _object_manager_parent_find(obj);
|
||||||
|
|
||||||
obj->idler_iface_changed = NULL;
|
obj->idle_enterer_iface_changed = NULL;
|
||||||
|
|
||||||
if (!parent)
|
if (!parent)
|
||||||
{
|
{
|
||||||
|
@ -823,8 +823,8 @@ _eldbus_service_interface_add(Eldbus_Service_Object *obj, const char *interface)
|
||||||
iface->obj = obj;
|
iface->obj = obj;
|
||||||
eina_hash_add(obj->interfaces, iface->name, iface);
|
eina_hash_add(obj->interfaces, iface->name, iface);
|
||||||
|
|
||||||
if (!obj->idler_iface_changed)
|
if (!obj->idle_enterer_iface_changed)
|
||||||
obj->idler_iface_changed = ecore_idler_add(_object_manager_changes_process,
|
obj->idle_enterer_iface_changed = ecore_idle_enterer_add(_object_manager_changes_process,
|
||||||
obj);
|
obj);
|
||||||
obj->iface_added = eina_list_append(obj->iface_added, iface);
|
obj->iface_added = eina_list_append(obj->iface_added, iface);
|
||||||
|
|
||||||
|
@ -1016,7 +1016,7 @@ eldbus_service_interface_fallback_register2(Eldbus_Connection *conn, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_idler_propschanged(void *data)
|
_idle_enterer_propschanged(void *data)
|
||||||
{
|
{
|
||||||
Eldbus_Service_Interface *iface = data;
|
Eldbus_Service_Interface *iface = data;
|
||||||
Eldbus_Message *msg;
|
Eldbus_Message *msg;
|
||||||
|
@ -1024,7 +1024,7 @@ _idler_propschanged(void *data)
|
||||||
Eina_Hash *added = NULL;
|
Eina_Hash *added = NULL;
|
||||||
Property *prop;
|
Property *prop;
|
||||||
|
|
||||||
iface->idler_propschanged = NULL;
|
iface->idle_enterer_propschanged = NULL;
|
||||||
|
|
||||||
added = eina_hash_string_small_new(NULL);
|
added = eina_hash_string_small_new(NULL);
|
||||||
msg = eldbus_message_signal_new(iface->obj->path, properties_iface->name,
|
msg = eldbus_message_signal_new(iface->obj->path, properties_iface->name,
|
||||||
|
@ -1128,10 +1128,10 @@ _interface_free(Eldbus_Service_Interface *interface)
|
||||||
/**
|
/**
|
||||||
* flush props changes before remove interface
|
* flush props changes before remove interface
|
||||||
*/
|
*/
|
||||||
if (interface->idler_propschanged)
|
if (interface->idle_enterer_propschanged)
|
||||||
{
|
{
|
||||||
ecore_idler_del(interface->idler_propschanged);
|
ecore_idle_enterer_del(interface->idle_enterer_propschanged);
|
||||||
_idler_propschanged(interface);
|
_idle_enterer_propschanged(interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_hash_free(interface->methods);
|
eina_hash_free(interface->methods);
|
||||||
|
@ -1151,17 +1151,17 @@ _interface_free(Eldbus_Service_Interface *interface)
|
||||||
/* Adding and removing the interface in the same main loop iteration.
|
/* Adding and removing the interface in the same main loop iteration.
|
||||||
* Let's not send any signal */
|
* Let's not send any signal */
|
||||||
obj->iface_added = eina_list_remove_list(obj->iface_added, l);
|
obj->iface_added = eina_list_remove_list(obj->iface_added, l);
|
||||||
if (!obj->iface_added && !obj->iface_removed && obj->idler_iface_changed)
|
if (!obj->iface_added && !obj->iface_removed && obj->idle_enterer_iface_changed)
|
||||||
{
|
{
|
||||||
ecore_idler_del(obj->idler_iface_changed);
|
ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
|
||||||
obj->idler_iface_changed = NULL;
|
obj->idle_enterer_iface_changed = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!obj->idler_iface_changed)
|
if (!obj->idle_enterer_iface_changed)
|
||||||
{
|
{
|
||||||
obj->idler_iface_changed = ecore_idler_add(
|
obj->idle_enterer_iface_changed = ecore_idle_enterer_add(
|
||||||
_object_manager_changes_process, obj);
|
_object_manager_changes_process, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1188,9 +1188,9 @@ static void _children_ifaces_add_removed_flush(Eldbus_Service_Object *obj)
|
||||||
_children_ifaces_add_removed_flush(children);
|
_children_ifaces_add_removed_flush(children);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->idler_iface_changed)
|
if (obj->idle_enterer_iface_changed)
|
||||||
{
|
{
|
||||||
ecore_idler_del(obj->idler_iface_changed);
|
ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
|
||||||
_object_manager_changes_process(obj);
|
_object_manager_changes_process(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1221,9 +1221,9 @@ _object_free(Eldbus_Service_Object *obj)
|
||||||
* Flush our iface_add/removed if this object are
|
* Flush our iface_add/removed if this object are
|
||||||
* children of some other path with ObjectManager
|
* children of some other path with ObjectManager
|
||||||
*/
|
*/
|
||||||
if (obj->idler_iface_changed)
|
if (obj->idle_enterer_iface_changed)
|
||||||
{
|
{
|
||||||
ecore_idler_del(obj->idler_iface_changed);
|
ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
|
||||||
_object_manager_changes_process(obj);
|
_object_manager_changes_process(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1482,8 +1482,8 @@ eldbus_service_property_changed(const Eldbus_Service_Interface *interface, const
|
||||||
prop = eina_hash_find(iface->properties, name);
|
prop = eina_hash_find(iface->properties, name);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(prop, EINA_FALSE);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(prop, EINA_FALSE);
|
||||||
|
|
||||||
if (!iface->idler_propschanged)
|
if (!iface->idle_enterer_propschanged)
|
||||||
iface->idler_propschanged = ecore_idler_add(_idler_propschanged, iface);
|
iface->idle_enterer_propschanged = ecore_idle_enterer_add(_idle_enterer_propschanged, iface);
|
||||||
if (!iface->props_changed)
|
if (!iface->props_changed)
|
||||||
iface->props_changed = eina_array_new(1);
|
iface->props_changed = eina_array_new(1);
|
||||||
|
|
||||||
|
@ -1507,8 +1507,8 @@ eldbus_service_property_invalidate_set(const Eldbus_Service_Interface *interface
|
||||||
|
|
||||||
prop->is_invalidate = is_invalidate;
|
prop->is_invalidate = is_invalidate;
|
||||||
|
|
||||||
if (!iface->idler_propschanged)
|
if (!iface->idle_enterer_propschanged)
|
||||||
iface->idler_propschanged = ecore_idler_add(_idler_propschanged, iface);
|
iface->idle_enterer_propschanged = ecore_idle_enterer_add(_idle_enterer_propschanged, iface);
|
||||||
|
|
||||||
if (is_invalidate)
|
if (is_invalidate)
|
||||||
{
|
{
|
||||||
|
@ -1546,8 +1546,8 @@ eldbus_service_object_manager_attach(Eldbus_Service_Interface *iface)
|
||||||
* with path equal to our path rather than from the previous
|
* with path equal to our path rather than from the previous
|
||||||
* ObjectManager
|
* ObjectManager
|
||||||
*/
|
*/
|
||||||
if (obj->idler_iface_changed)
|
if (obj->idle_enterer_iface_changed)
|
||||||
ecore_idler_del(obj->idler_iface_changed);
|
ecore_idle_enterer_del(obj->idle_enterer_iface_changed);
|
||||||
_object_manager_changes_process(obj);
|
_object_manager_changes_process(obj);
|
||||||
|
|
||||||
obj->objmanager = objmanager;
|
obj->objmanager = objmanager;
|
||||||
|
|
Loading…
Reference in New Issue