From d8edf70c327258975503cf81ff5e633bcab05d48 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 28 Feb 2017 11:01:09 -0800 Subject: [PATCH] ecore: improve debugging of animator. --- src/lib/ecore/ecore.c | 1 + src/lib/ecore/ecore_anim.c | 49 +++++++++++++++++++++++++++++++++++ src/lib/ecore/ecore_private.h | 2 +- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index e531c1ca81..99ba1dd2f0 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -234,6 +234,7 @@ ecore_init(void) EINA_LOG_ERR("Ecore was unable to create a log domain."); goto shutdown_log_dom; } + _ecore_animator_init(); _ecore_pfx = eina_prefix_new(NULL, ecore_init, "ECORE", "ecore", "checkme", diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index 5ce277523e..44bd1f2cf2 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c @@ -59,6 +59,33 @@ struct _Ecore_Animator Eina_Bool just_added : 1; }; +static int _ecore_anim_log_dom = -1; + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_anim_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_anim_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_anim_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_anim_log_dom, __VA_ARGS__) + +#ifdef CRI +# undef CRI +#endif +#define CRI(...) EINA_LOG_DOM_CRIT(_ecore_anim_log_dom, __VA_ARGS__) + static Eina_Bool _do_tick(void); static Eina_Bool _ecore_animator_run(void *data); @@ -427,10 +454,12 @@ _begin_tick(void) switch (src) { case ECORE_ANIMATOR_SOURCE_TIMER: + DBG("General animator registered with timer source."); _timer_tick_begin(); break; case ECORE_ANIMATOR_SOURCE_CUSTOM: + DBG("General animator registered with custom source."); if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data); break; @@ -446,6 +475,8 @@ _end_tick(void) eina_evlog("just_added = EINA_FALSE; @@ -865,6 +897,10 @@ ecore_animator_source_set(Ecore_Animator_Source source) EINA_MAIN_LOOP_CHECK_RETURN; _end_tick(); src = source; + DBG("New source set to %s.", + source == ECORE_ANIMATOR_SOURCE_TIMER ? "TIMER" : + source == ECORE_ANIMATOR_SOURCE_CUSTOM ? "CUSTOM" : + "UNKNOW"); if (_have_animators()) _begin_tick(); } @@ -921,6 +957,9 @@ _ecore_animator_shutdown(void) (EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); free(animator); } + + eina_log_domain_unregister(_ecore_anim_log_dom); + _ecore_anim_log_dom = -1; } void @@ -988,3 +1027,13 @@ _ecore_animator_flush(void) } return EINA_TRUE; } + +void +_ecore_animator_init(void) +{ + _ecore_anim_log_dom = eina_log_domain_register("ecore animator", ECORE_DEFAULT_LOG_COLOR); + if (_ecore_anim_log_dom < 0) + { + EINA_LOG_ERR("Ecore was unable to create a log domain."); + } +} diff --git a/src/lib/ecore/ecore_private.h b/src/lib/ecore/ecore_private.h index 0197c8df08..f810c6c129 100644 --- a/src/lib/ecore/ecore_private.h +++ b/src/lib/ecore/ecore_private.h @@ -245,6 +245,7 @@ void _ecore_exe_event_del_free(void *data, void *ev); #endif +void _ecore_animator_init(void); void _ecore_animator_shutdown(void); void _ecore_animator_run_reset(void); Eina_Bool _ecore_animator_run_get(void); @@ -275,7 +276,6 @@ void _ecore_throttle(void); void _ecore_main_call_flush(void); - static inline Eina_Bool _ecore_call_task_cb(Ecore_Task_Cb func, void *data)