forked from enlightenment/efl
Eolian: Integration of Ecore Idle Exiter
This commit is contained in:
parent
3536123886
commit
b05a323877
|
@ -11,7 +11,9 @@ BUILT_SOURCES += \
|
|||
lib/ecore/ecore_idler.eo.c \
|
||||
lib/ecore/ecore_idler.eo.h \
|
||||
lib/ecore/ecore_idle_enterer.eo.c \
|
||||
lib/ecore/ecore_idle_enterer.eo.h
|
||||
lib/ecore/ecore_idle_enterer.eo.h \
|
||||
lib/ecore/ecore_idle_exiter.eo.c \
|
||||
lib/ecore/ecore_idle_exiter.eo.h
|
||||
|
||||
ecoreeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
||||
ecoreeolianfiles_DATA = \
|
||||
|
@ -19,7 +21,8 @@ ecoreeolianfiles_DATA = \
|
|||
lib/ecore/ecore_poll.eo \
|
||||
lib/ecore/ecore_job.eo \
|
||||
lib/ecore/ecore_idler.eo \
|
||||
lib/ecore/ecore_idle_enterer.eo
|
||||
lib/ecore/ecore_idle_enterer.eo \
|
||||
lib/ecore/ecore_idle_exiter.eo
|
||||
|
||||
EXTRA_DIST += \
|
||||
${ecoreeolianfiles_DATA}
|
||||
|
@ -39,7 +42,8 @@ nodist_installed_ecoremainheaders_DATA = \
|
|||
lib/ecore/ecore_poll.eo.h \
|
||||
lib/ecore/ecore_job.eo.h \
|
||||
lib/ecore/ecore_idler.eo.h \
|
||||
lib/ecore/ecore_idle_enterer.eo.h
|
||||
lib/ecore/ecore_idle_enterer.eo.h \
|
||||
lib/ecore/ecore_idle_exiter.eo.h
|
||||
|
||||
lib_ecore_libecore_la_SOURCES = \
|
||||
lib/ecore/ecore.c \
|
||||
|
|
|
@ -315,6 +315,8 @@ enum
|
|||
/**
|
||||
*
|
||||
*/
|
||||
#include "ecore_idle_exiter.eo.h"
|
||||
#if 0
|
||||
|
||||
#define ECORE_IDLE_EXITER_CLASS ecore_idle_exiter_class_get()
|
||||
const Eo_Class *ecore_idle_exiter_class_get(void) EINA_CONST;
|
||||
|
@ -341,6 +343,7 @@ enum
|
|||
*/
|
||||
#define ecore_idle_exiter_constructor(func, data) ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data)
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
|
||||
#define MY_CLASS_NAME "Ecore_Idle_Exiter"
|
||||
|
||||
EAPI Eo_Op ECORE_IDLE_EXITER_BASE_ID = EO_NOOP;
|
||||
|
||||
struct _Ecore_Idle_Exiter_Private_Data
|
||||
struct _Ecore_Idle_Exiter_Data
|
||||
{
|
||||
EINA_INLIST;
|
||||
Ecore_Idle_Exiter *obj;
|
||||
|
@ -25,10 +23,10 @@ struct _Ecore_Idle_Exiter_Private_Data
|
|||
Eina_Bool delete_me : 1;
|
||||
};
|
||||
|
||||
typedef struct _Ecore_Idle_Exiter_Private_Data Ecore_Idle_Exiter_Private_Data;
|
||||
typedef struct _Ecore_Idle_Exiter_Data Ecore_Idle_Exiter_Data;
|
||||
|
||||
static Ecore_Idle_Exiter_Private_Data *idle_exiters = NULL;
|
||||
static Ecore_Idle_Exiter_Private_Data *idle_exiter_current = NULL;
|
||||
static Ecore_Idle_Exiter_Data *idle_exiters = NULL;
|
||||
static Ecore_Idle_Exiter_Data *idle_exiter_current = NULL;
|
||||
static int idle_exiters_delete_me = 0;
|
||||
|
||||
static void *
|
||||
|
@ -59,12 +57,9 @@ ecore_idle_exiter_add(Ecore_Task_Cb func,
|
|||
return ie;
|
||||
}
|
||||
|
||||
static void
|
||||
_idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_ecore_idle_exiter_constructor(Eo *obj, Ecore_Idle_Exiter_Data *ie, Ecore_Task_Cb func, const void *data)
|
||||
{
|
||||
Ecore_Task_Cb func = va_arg(*list, Ecore_Task_Cb);
|
||||
const void *data = va_arg(*list, const void *);
|
||||
|
||||
_ecore_lock();
|
||||
if (EINA_UNLIKELY(!eina_main_loop_is()))
|
||||
{
|
||||
|
@ -72,7 +67,6 @@ _idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
EINA_MAIN_LOOP_CHECK_RETURN;
|
||||
}
|
||||
|
||||
Ecore_Idle_Exiter_Private_Data *ie = _pd;
|
||||
|
||||
ie->obj = obj;
|
||||
eo_do_super(obj, MY_CLASS, eo_constructor());
|
||||
|
@ -88,12 +82,12 @@ _idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
ie->func = func;
|
||||
ie->data = (void *)data;
|
||||
|
||||
idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
_ecore_unlock();
|
||||
}
|
||||
|
||||
static void
|
||||
_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_ecore_idle_exiter_eo_base_constructor(Eo *obj, Ecore_Idle_Exiter_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
eo_error_set(obj);
|
||||
ERR("only custom constructor can be used with '%s' class", MY_CLASS_NAME);
|
||||
|
@ -125,7 +119,7 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
|
|||
static void *
|
||||
_ecore_idle_exiter_del(Ecore_Idle_Exiter *obj)
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *idle_exiter = eo_data_scope_get(obj, MY_CLASS);
|
||||
Ecore_Idle_Exiter_Data *idle_exiter = eo_data_scope_get(obj, MY_CLASS);
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
|
||||
idle_exiter->delete_me = 1;
|
||||
idle_exiters_delete_me = 1;
|
||||
|
@ -133,10 +127,9 @@ _ecore_idle_exiter_del(Ecore_Idle_Exiter *obj)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
_destructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
||||
EOLIAN static void
|
||||
_ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter)
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *idle_exiter = _pd;
|
||||
|
||||
idle_exiter->delete_me = 1;
|
||||
idle_exiters_delete_me = 1;
|
||||
|
@ -147,10 +140,10 @@ _destructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
|
|||
void
|
||||
_ecore_idle_exiter_shutdown(void)
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *ie;
|
||||
Ecore_Idle_Exiter_Data *ie;
|
||||
while ((ie = idle_exiters))
|
||||
{
|
||||
idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
|
||||
eo_do(ie->obj, eo_parent_set(NULL));
|
||||
if (eo_destructed_is(ie->obj))
|
||||
|
@ -174,12 +167,12 @@ _ecore_idle_exiter_call(void)
|
|||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
(Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
}
|
||||
|
||||
while (idle_exiter_current)
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *ie = (Ecore_Idle_Exiter_Private_Data *)idle_exiter_current;
|
||||
Ecore_Idle_Exiter_Data *ie = (Ecore_Idle_Exiter_Data *)idle_exiter_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
|
@ -191,18 +184,18 @@ _ecore_idle_exiter_call(void)
|
|||
}
|
||||
if (idle_exiter_current) /* may have changed in recursive main loops */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
(Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
}
|
||||
if (idle_exiters_delete_me)
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *l;
|
||||
Ecore_Idle_Exiter_Data *l;
|
||||
int deleted_idler_exiters_in_use = 0;
|
||||
|
||||
for (l = idle_exiters; l; )
|
||||
{
|
||||
Ecore_Idle_Exiter_Private_Data *ie = l;
|
||||
Ecore_Idle_Exiter_Data *ie = l;
|
||||
|
||||
l = (Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(l)->next;
|
||||
l = (Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
|
@ -211,7 +204,7 @@ _ecore_idle_exiter_call(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
|
||||
eo_do(ie->obj, eo_parent_set(NULL));
|
||||
if (eo_destructed_is(ie->obj))
|
||||
|
@ -232,34 +225,4 @@ _ecore_idle_exiter_exist(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eo_Class *klass)
|
||||
{
|
||||
const Eo_Op_Func_Description func_desc[] = {
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
|
||||
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
|
||||
|
||||
EO_OP_FUNC(ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), _idle_exiter_constructor),
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
||||
eo_class_funcs_set(klass, func_desc);
|
||||
}
|
||||
|
||||
static const Eo_Op_Description op_desc[] = {
|
||||
EO_OP_DESCRIPTION(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR, "Add an idle exiter handler."),
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ECORE_IDLE_EXITER_BASE_ID, op_desc, ECORE_IDLE_EXITER_SUB_ID_LAST),
|
||||
NULL,
|
||||
sizeof(Ecore_Idle_Exiter_Private_Data),
|
||||
_class_constructor,
|
||||
NULL
|
||||
};
|
||||
|
||||
EO_DEFINE_CLASS(ecore_idle_exiter_class_get, &class_desc, EO_BASE_CLASS, NULL)
|
||||
#include "ecore_idle_exiter.eo.c"
|
|
@ -0,0 +1,17 @@
|
|||
class Ecore_Idle_Exiter (Eo_Base)
|
||||
{
|
||||
eo_prefix: ecore_idle_exiter;
|
||||
constructors {
|
||||
constructor {
|
||||
/*@ Contructor. */
|
||||
params {
|
||||
@in Ecore_Task_Cb func;
|
||||
@in const void *data;
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Eo_Base::constructor;
|
||||
Eo_Base::destructor;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue