From b3d56820d53897958379aaf9061378fc6df7b078 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 3 Jun 2016 16:01:08 -0700 Subject: [PATCH] ecore: Efl.Timer should be Efl.Loop.Timer for coherence. As we add more object in the main loop, they can't live in the top namespace as they make little sense there (Efl.Fd !). For coherence, everyone should in the loop namespace, so move timer there. --- src/Makefile_Ecore.am | 2 +- src/lib/ecore/Ecore_Eo.h | 2 +- src/lib/ecore/Ecore_Legacy.h | 2 +- src/lib/ecore/ecore.c | 2 +- src/lib/ecore/ecore_main.c | 58 +++---- src/lib/ecore/ecore_private.h | 14 +- src/lib/ecore/ecore_timer.c | 164 +++++++++--------- .../ecore/{efl_timer.eo => efl_loop_timer.eo} | 2 +- 8 files changed, 123 insertions(+), 123 deletions(-) rename src/lib/ecore/{efl_timer.eo => efl_loop_timer.eo} (98%) diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am index 1f544c6549..83f5407668 100644 --- a/src/Makefile_Ecore.am +++ b/src/Makefile_Ecore.am @@ -4,7 +4,7 @@ ecore_eolian_files_legacy = \ lib/ecore/ecore_poller.eo \ lib/ecore/ecore_exe.eo \ - lib/ecore/efl_timer.eo + lib/ecore/efl_loop_timer.eo ecore_eolian_files = \ lib/ecore/efl_loop.eo \ diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h index 5214680b9d..c2a1311aa3 100644 --- a/src/lib/ecore/Ecore_Eo.h +++ b/src/lib/ecore/Ecore_Eo.h @@ -23,7 +23,7 @@ extern "C" { * @{ */ -#include "efl_timer.eo.h" +#include "efl_loop_timer.eo.h" /** * @} diff --git a/src/lib/ecore/Ecore_Legacy.h b/src/lib/ecore/Ecore_Legacy.h index ecf6a695bf..ca47e0784f 100644 --- a/src/lib/ecore/Ecore_Legacy.h +++ b/src/lib/ecore/Ecore_Legacy.h @@ -235,7 +235,7 @@ EAPI Eina_Bool ecore_timer_freeze_get(Ecore_Timer *timer); EAPI void ecore_timer_thaw(Ecore_Timer *timer); -#include "efl_timer.eo.legacy.h" +#include "efl_loop_timer.eo.legacy.h" /** * @} diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index 6c533335be..389355cdba 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -406,7 +406,7 @@ ecore_shutdown(void) #ifndef HAVE_EXOTIC _ecore_exe_shutdown(); #endif - _efl_timer_shutdown(); + _efl_loop_timer_shutdown(); _ecore_event_shutdown(); _ecore_main_shutdown(); _ecore_signal_shutdown(); diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 38d888f264..01b7875d48 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -460,7 +460,7 @@ _ecore_main_uv_poll_cb(uv_poll_t* handle, int status, int events) _ecore_signal_received_process(); _ecore_event_call(); _ecore_main_fd_handlers_cleanup(); - _efl_timer_expired_timers_call(_ecore_time_loop_time); + _efl_loop_timer_expired_timers_call(_ecore_time_loop_time); } static int @@ -704,7 +704,7 @@ _ecore_main_gsource_prepare(GSource *source EINA_UNUSED, if (!ecore_idling && !_ecore_glib_idle_enterer_called) { _ecore_time_loop_time = ecore_time_get(); - _efl_timer_expired_timers_call(_ecore_time_loop_time); + _efl_loop_timer_expired_timers_call(_ecore_time_loop_time); _ecore_idle_enterer_call(_mainloop_singleton); _ecore_throttle(); @@ -722,10 +722,10 @@ _ecore_main_gsource_prepare(GSource *source EINA_UNUSED, /* only set idling state in dispatch */ if (ecore_idling && !_ecore_idler_exist(_mainloop_singleton) && !_ecore_event_exist()) { - if (_efl_timers_exists()) + if (_efl_loop_timers_exists()) { int r = -1; - double t = _efl_timer_next_get(); + double t = _efl_loop_timer_next_get(); if (timer_fd >= 0 && t > 0.0) { struct itimerspec ts; @@ -821,8 +821,8 @@ _ecore_main_gsource_check(GSource *source EINA_UNUSED) ret = TRUE; /* check timers after updating loop time */ - if (!ret && _efl_timers_exists()) - ret = (0.0 == _efl_timer_next_get()); + if (!ret && _efl_loop_timers_exists()) + ret = (0.0 == _efl_loop_timer_next_get()); in_main_loop--; @@ -839,11 +839,11 @@ _ecore_main_gsource_dispatch(GSource *source EINA_UNUSED, double next_time; _ecore_time_loop_time = ecore_time_get(); - _efl_timer_enable_new(); - next_time = _efl_timer_next_get(); + _efl_loop_timer_enable_new(); + next_time = _efl_loop_timer_next_get(); events_ready = _ecore_event_exist(); - timers_ready = _efl_timers_exists() && (0.0 == next_time); + timers_ready = _efl_loop_timers_exists() && (0.0 == next_time); idlers_ready = _ecore_idler_exist(_mainloop_singleton); in_main_loop++; @@ -886,7 +886,7 @@ _ecore_main_gsource_dispatch(GSource *source EINA_UNUSED, _ecore_event_call(); _ecore_main_fd_handlers_cleanup(); - _efl_timer_expired_timers_call(_ecore_time_loop_time); + _efl_loop_timer_expired_timers_call(_ecore_time_loop_time); _ecore_idle_enterer_call(_mainloop_singleton); _ecore_throttle(); @@ -1019,7 +1019,7 @@ _ecore_main_loop_uv_check(uv_check_t* handle EINA_UNUSED) _ecore_signal_received_process(); _ecore_event_call(); _ecore_main_fd_handlers_cleanup(); - _efl_timer_expired_timers_call(_ecore_time_loop_time); + _efl_loop_timer_expired_timers_call(_ecore_time_loop_time); } while(fd_handlers_to_call); quit: @@ -2110,7 +2110,7 @@ _ecore_main_loop_uv_prepare(uv_prepare_t* handle EINA_UNUSED) t = -1; _ecore_time_loop_time = ecore_time_get(); - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); goto done; } @@ -2118,10 +2118,10 @@ _ecore_main_loop_uv_prepare(uv_prepare_t* handle EINA_UNUSED) assert(!fd_handlers_to_call); _ecore_time_loop_time = ecore_time_get(); - _efl_timer_enable_new(); - if (_efl_timers_exists() || t >= 0) + _efl_loop_timer_enable_new(); + if (_efl_loop_timers_exists() || t >= 0) { - double t1 = _efl_timer_next_get(); + double t1 = _efl_loop_timer_next_get(); if(t < 0 || (t1 >= 0 && t1 < t)) t = t1; DBG("Should awake after %f", t); @@ -2181,7 +2181,7 @@ _ecore_main_loop_spin_no_timers(void) if (action != SPIN_MORE) return action; /* if an idler has added a timer then we need to go through * the start of the spin cycle again to handle cases properly */ - if (_efl_timers_exists()) return SPIN_RESTART; + if (_efl_loop_timers_exists()) return SPIN_RESTART; } /* just contiune handling events etc. */ return LOOP_CONTINUE; @@ -2199,7 +2199,7 @@ _ecore_main_loop_spin_timers(void) /* if next timer expires now or in the past - stop spinning and * continue the mainloop walk as our "select" timeout has * expired now */ - if (_efl_timer_next_get() <= 0.0) return LOOP_CONTINUE; + if (_efl_loop_timer_next_get() <= 0.0) return LOOP_CONTINUE; } /* just contiune handling events etc. */ return LOOP_CONTINUE; @@ -2227,7 +2227,7 @@ _ecore_main_loop_iterate_internal(int once_only) in_main_loop++; /* expire any timers */ - _efl_timer_expired_timers_call(_ecore_time_loop_time); + _efl_loop_timer_expired_timers_call(_ecore_time_loop_time); /* process signals into events .... */ _ecore_signal_received_process(); @@ -2241,7 +2241,7 @@ _ecore_main_loop_iterate_internal(int once_only) /* now quickly poll to see which input fd's are active */ _ecore_main_select(0.0); /* allow newly queued timers to expire from now on */ - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); /* go straight to processing the events we had queued */ goto process_all; } @@ -2254,7 +2254,7 @@ _ecore_main_loop_iterate_internal(int once_only) * merged together */ if (_ecore_main_select(0.0) | _ecore_signal_count_get()) { - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); goto process_all; } } @@ -2274,7 +2274,7 @@ _ecore_main_loop_iterate_internal(int once_only) if (_ecore_event_exist()) { _ecore_main_select(0.0); - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); goto process_all; } @@ -2283,7 +2283,7 @@ _ecore_main_loop_iterate_internal(int once_only) /* in once_only mode enter idle here instead and then return */ _ecore_idle_enterer_call(_mainloop_singleton); _ecore_throttle(); - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); goto done; } @@ -2292,17 +2292,17 @@ _ecore_main_loop_iterate_internal(int once_only) /* start of the sleeping or looping section */ start_loop: /*-*************************************************************/ /* any timers re-added as a result of these are allowed to go */ - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); /* if we have been asked to quit the mainloop then exit at this point */ if (do_quit) { - _efl_timer_enable_new(); + _efl_loop_timer_enable_new(); goto done; } if (!_ecore_event_exist()) { /* init flags */ - next_time = _efl_timer_next_get(); + next_time = _efl_loop_timer_next_get(); /* no idlers */ if (!_ecore_idler_exist(_mainloop_singleton)) { @@ -2807,7 +2807,7 @@ struct _Efl_Internal_Promise { union { Ecore_Job *job; - Efl_Timer *timer; + Efl_Loop_Timer *timer; } u; Eina_Promise_Owner *promise; @@ -2930,7 +2930,7 @@ _efl_loop_timeout_force_cancel_cb(void *data, const Eo_Event *event EINA_UNUSED) } EO_CALLBACKS_ARRAY_DEFINE(timeout, - { EFL_TIMER_EVENT_TICK, _efl_loop_timeout_cb }, + { EFL_LOOP_TIMER_EVENT_TICK, _efl_loop_timeout_cb }, { EO_EVENT_DEL, _efl_loop_timeout_force_cancel_cb }); static Eina_Promise * @@ -2946,8 +2946,8 @@ _efl_loop_timeout(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED, double time, const voi if (!t) goto on_error; t->job_is = EINA_FALSE; - t->u.timer = eo_add(EFL_TIMER_CLASS, obj, - efl_timer_interval_set(eo_self, time), + t->u.timer = eo_add(EFL_LOOP_TIMER_CLASS, obj, + efl_loop_timer_interval_set(eo_self, time), eo_event_callback_array_add(eo_self, timeout(), t)); if (!t->u.timer) goto on_error; diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h index d1572f0389..37303f4f3d 100644 --- a/src/lib/ecore/ecore_private.h +++ b/src/lib/ecore/ecore_private.h @@ -150,14 +150,14 @@ EAPI void _ecore_magic_fail(const void *d, void _ecore_time_init(void); -void *_efl_timer_del(Ecore_Timer *timer); -void _efl_timer_shutdown(void); -void _efl_timer_enable_new(void); -double _efl_timer_next_get(void); -void _efl_timer_expired_timers_call(double when); -int _efl_timers_exists(void); +void *_efl_loop_timer_del(Ecore_Timer *timer); +void _efl_loop_timer_shutdown(void); +void _efl_loop_timer_enable_new(void); +double _efl_loop_timer_next_get(void); +void _efl_loop_timer_expired_timers_call(double when); +int _efl_loop_timers_exists(void); -int _efl_timer_expired_call(double when); +int _efl_loop_timer_expired_call(double when); Ecore_Factorized_Idle *_ecore_factorized_idle_add(const Eo_Callback_Array_Item*desc, Ecore_Task_Cb func, diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c index 15d80cb91e..39cba76852 100644 --- a/src/lib/ecore/ecore_timer.c +++ b/src/lib/ecore/ecore_timer.c @@ -10,14 +10,14 @@ #include "Ecore.h" #include "ecore_private.h" -#define MY_CLASS EFL_TIMER_CLASS -#define MY_CLASS_NAME "Efl_Timer" +#define MY_CLASS EFL_LOOP_TIMER_CLASS +#define MY_CLASS_NAME "Efl_Loop_Timer" #define ECORE_TIMER_CHECK(obj) \ if (!eo_isa((obj), MY_CLASS)) \ return -struct _Efl_Timer_Data +struct _Efl_Loop_Timer_Data { EINA_INLIST; @@ -34,19 +34,19 @@ struct _Efl_Timer_Data unsigned char initialized : 1; }; -typedef struct _Efl_Timer_Data Efl_Timer_Data; +typedef struct _Efl_Loop_Timer_Data Efl_Loop_Timer_Data; -static void _efl_timer_util_delay(Efl_Timer_Data *timer, - double add); -static void _efl_timer_util_instanciate(Efl_Timer_Data *timer); -static void _efl_timer_set(Efl_Timer_Data *timer, - double at, - double in); +static void _efl_loop_timer_util_delay(Efl_Loop_Timer_Data *timer, + double add); +static void _efl_loop_timer_util_instanciate(Efl_Loop_Timer_Data *timer); +static void _efl_loop_timer_set(Efl_Loop_Timer_Data *timer, + double at, + double in); static Eina_Inlist *timers = NULL; static Eina_Inlist *suspended = NULL; -static Efl_Timer_Data *timer_current = NULL; +static Efl_Loop_Timer_Data *timer_current = NULL; static int timers_added = 0; @@ -77,15 +77,15 @@ static Eina_Bool _check_timer_event_catcher_add(void *data, const Eo_Event *event) { const Eo_Callback_Array_Item *array = event->info; - Efl_Timer_Data *timer = data; + Efl_Loop_Timer_Data *timer = data; int i; for (i = 0; array[i].desc != NULL; i++) { - if (array[i].desc == EFL_TIMER_EVENT_TICK) + if (array[i].desc == EFL_LOOP_TIMER_EVENT_TICK) { if (timer->listening++ > 0) return EO_CALLBACK_CONTINUE; - _efl_timer_util_instanciate(timer); + _efl_loop_timer_util_instanciate(timer); // No need to walk more than once per array as you can not del // a partial array return EO_CALLBACK_CONTINUE; @@ -99,15 +99,15 @@ static Eina_Bool _check_timer_event_catcher_del(void *data, const Eo_Event *event) { const Eo_Callback_Array_Item *array = event->info; - Efl_Timer_Data *timer = data; + Efl_Loop_Timer_Data *timer = data; int i; for (i = 0; array[i].desc != NULL; i++) { - if (array[i].desc == EFL_TIMER_EVENT_TICK) + if (array[i].desc == EFL_LOOP_TIMER_EVENT_TICK) { if ((--timer->listening) > 0) return EO_CALLBACK_CONTINUE; - _efl_timer_util_instanciate(timer); + _efl_loop_timer_util_instanciate(timer); return EO_CALLBACK_CONTINUE; } } @@ -120,7 +120,7 @@ EO_CALLBACKS_ARRAY_DEFINE(timer_watch, { EO_EVENT_CALLBACK_DEL, _check_timer_event_catcher_del }); EOLIAN static Eo * -_efl_timer_eo_base_constructor(Eo *obj, Efl_Timer_Data *timer) +_efl_loop_timer_eo_base_constructor(Eo *obj, Efl_Loop_Timer_Data *timer) { eo_constructor(eo_super(obj, MY_CLASS)); @@ -136,9 +136,9 @@ _efl_timer_eo_base_constructor(Eo *obj, Efl_Timer_Data *timer) EOLIAN static Eo * -_efl_timer_eo_base_finalize(Eo *obj, Efl_Timer_Data *pd) +_efl_loop_timer_eo_base_finalize(Eo *obj, Efl_Loop_Timer_Data *pd) { - _efl_timer_util_instanciate(pd); + _efl_loop_timer_util_instanciate(pd); return eo_finalize(eo_super(obj, MY_CLASS)); } @@ -178,7 +178,7 @@ _ecore_timer_legacy_tick(void *data, const Eo_Event *event) } EO_CALLBACKS_ARRAY_DEFINE(legacy_timer, - { EFL_TIMER_EVENT_TICK, _ecore_timer_legacy_tick }, + { EFL_LOOP_TIMER_EVENT_TICK, _ecore_timer_legacy_tick }, { EO_EVENT_DEL, _ecore_timer_legacy_del }); EAPI Ecore_Timer * @@ -197,7 +197,7 @@ ecore_timer_add(double in, timer = eo_add(MY_CLASS, ecore_main_loop_get(), eo_event_callback_array_add(eo_self, legacy_timer(), legacy), eo_key_data_set(eo_self, "_legacy", legacy), - efl_timer_interval_set(eo_self, in)); + efl_loop_timer_interval_set(eo_self, in)); return timer; } @@ -218,8 +218,8 @@ ecore_timer_loop_add(double in, timer = eo_add(MY_CLASS, ecore_main_loop_get(), eo_event_callback_array_add(eo_self, legacy_timer(), legacy), eo_key_data_set(eo_self, "_legacy", legacy), - efl_timer_loop_reset(eo_self), - efl_timer_interval_set(eo_self, in)); + efl_loop_timer_loop_reset(eo_self), + efl_loop_timer_interval_set(eo_self, in)); return timer; } @@ -245,7 +245,7 @@ ecore_timer_del(Ecore_Timer *timer) } EOLIAN static void -_efl_timer_interval_set(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer, double in) +_efl_loop_timer_interval_set(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer, double in) { EINA_MAIN_LOOP_CHECK_RETURN; if (in < 0.0) in = 0.0; @@ -253,11 +253,11 @@ _efl_timer_interval_set(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer, double in) timer->in = in; if (!timer->initialized) - _efl_timer_set(timer, timer->at + in, in); + _efl_loop_timer_set(timer, timer->at + in, in); } EOLIAN static double -_efl_timer_interval_get(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_interval_get(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { double ret = -1.0; @@ -268,15 +268,15 @@ _efl_timer_interval_get(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) } EOLIAN static void -_efl_timer_delay(Eo *obj EINA_UNUSED, Efl_Timer_Data *pd, double add) +_efl_loop_timer_delay(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *pd, double add) { EINA_MAIN_LOOP_CHECK_RETURN; - _efl_timer_util_delay(pd, add); + _efl_loop_timer_util_delay(pd, add); } EOLIAN static void -_efl_timer_reset(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_reset(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { double now, add; EINA_MAIN_LOOP_CHECK_RETURN; @@ -293,11 +293,11 @@ _efl_timer_reset(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) add = timer->pending; else add = timer->at - now; - _efl_timer_util_delay(timer, timer->in - add); + _efl_loop_timer_util_delay(timer, timer->in - add); } EOLIAN static void -_efl_timer_loop_reset(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_loop_reset(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { double now, add; EINA_MAIN_LOOP_CHECK_RETURN; @@ -314,11 +314,11 @@ _efl_timer_loop_reset(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) add = timer->pending; else add = timer->at - now; - _efl_timer_util_delay(timer, timer->in - add); + _efl_loop_timer_util_delay(timer, timer->in - add); } EOLIAN static double -_efl_timer_pending_get(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_pending_get(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { double now; double ret = 0.0; @@ -343,7 +343,7 @@ ecore_timer_freeze(Ecore_Timer *timer) } EOLIAN static void -_efl_timer_eo_base_event_freeze(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_eo_base_event_freeze(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { double now; @@ -361,7 +361,7 @@ _efl_timer_eo_base_event_freeze(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) timer->at = 0.0; timer->frozen = 1; - _efl_timer_util_instanciate(timer); + _efl_loop_timer_util_instanciate(timer); } EAPI Eina_Bool @@ -374,7 +374,7 @@ ecore_timer_freeze_get(Ecore_Timer *timer) } EOLIAN static int -_efl_timer_eo_base_event_freeze_count_get(Eo *obj EINA_UNUSED, Efl_Timer_Data *timer) +_efl_loop_timer_eo_base_event_freeze_count_get(Eo *obj EINA_UNUSED, Efl_Loop_Timer_Data *timer) { EINA_MAIN_LOOP_CHECK_RETURN_VAL(0); @@ -389,7 +389,7 @@ ecore_timer_thaw(Ecore_Timer *timer) } EOLIAN static void -_efl_timer_eo_base_event_thaw(Eo *obj, Efl_Timer_Data *timer) +_efl_loop_timer_eo_base_event_thaw(Eo *obj, Efl_Loop_Timer_Data *timer) { double now; @@ -404,7 +404,7 @@ _efl_timer_eo_base_event_thaw(Eo *obj, Efl_Timer_Data *timer) suspended = eina_inlist_remove(suspended, EINA_INLIST_GET(timer)); now = ecore_time_get(); - _efl_timer_set(timer, timer->pending + now, timer->in); + _efl_loop_timer_set(timer, timer->pending + now, timer->in); } EAPI char * @@ -414,9 +414,9 @@ ecore_timer_dump(void) } static void -_efl_timer_util_instanciate(Efl_Timer_Data *timer) +_efl_loop_timer_util_instanciate(Efl_Loop_Timer_Data *timer) { - Efl_Timer_Data *t2; + Efl_Loop_Timer_Data *t2; Eina_Inlist *first; // Remove the timer from all possible pending list @@ -447,8 +447,8 @@ _efl_timer_util_instanciate(Efl_Timer_Data *timer) } static void -_efl_timer_util_delay(Efl_Timer_Data *timer, - double add) +_efl_loop_timer_util_delay(Efl_Loop_Timer_Data *timer, + double add) { if (timer->frozen) { @@ -456,17 +456,17 @@ _efl_timer_util_delay(Efl_Timer_Data *timer, return ; } - _efl_timer_set(timer, timer->at + add, timer->in); + _efl_loop_timer_set(timer, timer->at + add, timer->in); } EOLIAN static void -_efl_timer_eo_base_destructor(Eo *obj, Efl_Timer_Data *pd) +_efl_loop_timer_eo_base_destructor(Eo *obj, Efl_Loop_Timer_Data *pd) { Eina_Inlist *first; // Check if we are the current timer, if so move along if (timer_current == pd) - timer_current = (Efl_Timer_Data *)EINA_INLIST_GET(pd)->next; + timer_current = (Efl_Loop_Timer_Data *)EINA_INLIST_GET(pd)->next; // Remove the timer from all possible pending list first = eina_inlist_first(EINA_INLIST_GET(pd)); @@ -479,9 +479,9 @@ _efl_timer_eo_base_destructor(Eo *obj, Efl_Timer_Data *pd) } void -_efl_timer_shutdown(void) +_efl_loop_timer_shutdown(void) { - Efl_Timer_Data *timer; + Efl_Loop_Timer_Data *timer; EINA_INLIST_FREE(timers, timer) eo_del(timer->object); @@ -493,9 +493,9 @@ _efl_timer_shutdown(void) } void -_efl_timer_enable_new(void) +_efl_loop_timer_enable_new(void) { - Efl_Timer_Data *timer; + Efl_Loop_Timer_Data *timer; if (!timers_added) return; timers_added = 0; @@ -503,15 +503,15 @@ _efl_timer_enable_new(void) } int -_efl_timers_exists(void) +_efl_loop_timers_exists(void) { return !!timers; } static inline Ecore_Timer * -_efl_timer_first_get(void) +_efl_loop_timer_first_get(void) { - Efl_Timer_Data *timer; + Efl_Loop_Timer_Data *timer; EINA_INLIST_FOREACH(timers, timer) if (!timer->just_added) return timer->object; @@ -519,11 +519,11 @@ _efl_timer_first_get(void) return NULL; } -static inline Efl_Timer_Data * -_efl_timer_after_get(Efl_Timer_Data *base) +static inline Efl_Loop_Timer_Data * +_efl_loop_timer_after_get(Efl_Loop_Timer_Data *base) { - Efl_Timer_Data *timer; - Efl_Timer_Data *valid_timer = base; + Efl_Loop_Timer_Data *timer; + Efl_Loop_Timer_Data *valid_timer = base; double maxtime = base->at + precision; EINA_INLIST_FOREACH(EINA_INLIST_GET(base)->next, timer) @@ -537,17 +537,17 @@ _efl_timer_after_get(Efl_Timer_Data *base) } double -_efl_timer_next_get(void) +_efl_loop_timer_next_get(void) { Ecore_Timer *object; - Efl_Timer_Data *first; + Efl_Loop_Timer_Data *first; double now; double in; - object = _efl_timer_first_get(); + object = _efl_loop_timer_first_get(); if (!object) return -1; - first = _efl_timer_after_get(eo_data_scope_get(object, MY_CLASS)); + first = _efl_loop_timer_after_get(eo_data_scope_get(object, MY_CLASS)); now = ecore_loop_time_get(); in = first->at - now; @@ -556,7 +556,7 @@ _efl_timer_next_get(void) } static inline void -_efl_timer_reschedule(Efl_Timer_Data *timer, +_efl_loop_timer_reschedule(Efl_Loop_Timer_Data *timer, double when) { if (timer->frozen) return; @@ -573,25 +573,25 @@ _efl_timer_reschedule(Efl_Timer_Data *timer, * really slow within the main loop. */ if ((timer->at + timer->in) < (when - 15.0)) - _efl_timer_set(timer, when + timer->in, timer->in); + _efl_loop_timer_set(timer, when + timer->in, timer->in); else - _efl_timer_set(timer, timer->at + timer->in, timer->in); + _efl_loop_timer_set(timer, timer->at + timer->in, timer->in); } void -_efl_timer_expired_timers_call(double when) +_efl_loop_timer_expired_timers_call(double when) { /* call the first expired timer until no expired timers exist */ - while (_efl_timer_expired_call(when)) ; + while (_efl_loop_timer_expired_call(when)) ; } int -_efl_timer_expired_call(double when) +_efl_loop_timer_expired_call(double when) { if (!timers) return 0; if (last_check > when) { - Efl_Timer_Data *timer; + Efl_Loop_Timer_Data *timer; /* User set time backwards */ EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when); } @@ -600,20 +600,20 @@ _efl_timer_expired_call(double when) if (!timer_current) { /* regular main loop, start from head */ - timer_current = (Efl_Timer_Data *)timers; + timer_current = (Efl_Loop_Timer_Data *)timers; } else { /* recursive main loop, continue from where we were */ - Efl_Timer_Data *timer_old = timer_current; + Efl_Loop_Timer_Data *timer_old = timer_current; - timer_current = (Efl_Timer_Data *)EINA_INLIST_GET(timer_current)->next; - _efl_timer_reschedule(timer_old, when); + timer_current = (Efl_Loop_Timer_Data *)EINA_INLIST_GET(timer_current)->next; + _efl_loop_timer_reschedule(timer_old, when); } while (timer_current) { - Efl_Timer_Data *timer = timer_current; + Efl_Loop_Timer_Data *timer = timer_current; if (timer->at > when) { @@ -623,30 +623,30 @@ _efl_timer_expired_call(double when) if (timer->just_added) { - timer_current = (Efl_Timer_Data *)EINA_INLIST_GET(timer_current)->next; + timer_current = (Efl_Loop_Timer_Data *)EINA_INLIST_GET(timer_current)->next; continue; } eo_ref(timer->object); eina_evlog("+timer", timer, 0.0, NULL); - eo_event_callback_call(timer->object, EFL_TIMER_EVENT_TICK, NULL); + eo_event_callback_call(timer->object, EFL_LOOP_TIMER_EVENT_TICK, NULL); eina_evlog("-timer", timer, 0.0, NULL); /* may have changed in recursive main loops */ /* this current timer can not die yet as we hold a reference on it */ if (timer_current) - timer_current = (Efl_Timer_Data *)EINA_INLIST_GET(timer_current)->next; + timer_current = (Efl_Loop_Timer_Data *)EINA_INLIST_GET(timer_current)->next; - _efl_timer_reschedule(timer, when); + _efl_loop_timer_reschedule(timer, when); eo_unref(timer->object); } return 0; } static void -_efl_timer_set(Efl_Timer_Data *timer, - double at, - double in) +_efl_loop_timer_set(Efl_Loop_Timer_Data *timer, + double at, + double in) { timers_added = 1; timer->at = at; @@ -656,7 +656,7 @@ _efl_timer_set(Efl_Timer_Data *timer, timer->frozen = 0; timer->pending = 0.0; - _efl_timer_util_instanciate(timer); + _efl_loop_timer_util_instanciate(timer); } -#include "efl_timer.eo.c" +#include "efl_loop_timer.eo.c" diff --git a/src/lib/ecore/efl_timer.eo b/src/lib/ecore/efl_loop_timer.eo similarity index 98% rename from src/lib/ecore/efl_timer.eo rename to src/lib/ecore/efl_loop_timer.eo index 10bcbefb80..7b69ce485e 100644 --- a/src/lib/ecore/efl_timer.eo +++ b/src/lib/ecore/efl_loop_timer.eo @@ -1,6 +1,6 @@ import ecore_types; -class Efl.Timer (Efl.Loop_User) +class Efl.Loop.Timer (Efl.Loop_User) { [[Timers are objects that will call a given callback at some point in the future and repeat that tick at a given interval.