ecore: improve debugging of animator.

This commit is contained in:
Cedric BAIL 2017-02-28 11:01:09 -08:00
parent b4381fd2d5
commit d8edf70c32
3 changed files with 51 additions and 1 deletions

View File

@ -234,6 +234,7 @@ ecore_init(void)
EINA_LOG_ERR("Ecore was unable to create a log domain."); EINA_LOG_ERR("Ecore was unable to create a log domain.");
goto shutdown_log_dom; goto shutdown_log_dom;
} }
_ecore_animator_init();
_ecore_pfx = eina_prefix_new(NULL, ecore_init, _ecore_pfx = eina_prefix_new(NULL, ecore_init,
"ECORE", "ecore", "checkme", "ECORE", "ecore", "checkme",

View File

@ -59,6 +59,33 @@ struct _Ecore_Animator
Eina_Bool just_added : 1; 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 _do_tick(void);
static Eina_Bool _ecore_animator_run(void *data); static Eina_Bool _ecore_animator_run(void *data);
@ -427,10 +454,12 @@ _begin_tick(void)
switch (src) switch (src)
{ {
case ECORE_ANIMATOR_SOURCE_TIMER: case ECORE_ANIMATOR_SOURCE_TIMER:
DBG("General animator registered with timer source.");
_timer_tick_begin(); _timer_tick_begin();
break; break;
case ECORE_ANIMATOR_SOURCE_CUSTOM: case ECORE_ANIMATOR_SOURCE_CUSTOM:
DBG("General animator registered with custom source.");
if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data); if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data);
break; break;
@ -446,6 +475,8 @@ _end_tick(void)
eina_evlog("<animator", NULL, 0.0, NULL); eina_evlog("<animator", NULL, 0.0, NULL);
ticking = 0; ticking = 0;
DBG("General animator unregistered.");
_timer_tick_end(); _timer_tick_end();
if ((src == ECORE_ANIMATOR_SOURCE_CUSTOM) && end_tick_cb) if ((src == ECORE_ANIMATOR_SOURCE_CUSTOM) && end_tick_cb)
@ -458,6 +489,7 @@ _do_tick(void)
Ecore_Animator *animator; Ecore_Animator *animator;
Eina_Inlist *tmp; Eina_Inlist *tmp;
DBG("General animator tick.");
EINA_INLIST_FOREACH(animators, animator) EINA_INLIST_FOREACH(animators, animator)
{ {
animator->just_added = EINA_FALSE; animator->just_added = EINA_FALSE;
@ -865,6 +897,10 @@ ecore_animator_source_set(Ecore_Animator_Source source)
EINA_MAIN_LOOP_CHECK_RETURN; EINA_MAIN_LOOP_CHECK_RETURN;
_end_tick(); _end_tick();
src = source; 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(); if (_have_animators()) _begin_tick();
} }
@ -921,6 +957,9 @@ _ecore_animator_shutdown(void)
(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); (EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
free(animator); free(animator);
} }
eina_log_domain_unregister(_ecore_anim_log_dom);
_ecore_anim_log_dom = -1;
} }
void void
@ -988,3 +1027,13 @@ _ecore_animator_flush(void)
} }
return EINA_TRUE; 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.");
}
}

View File

@ -245,6 +245,7 @@ void _ecore_exe_event_del_free(void *data,
void *ev); void *ev);
#endif #endif
void _ecore_animator_init(void);
void _ecore_animator_shutdown(void); void _ecore_animator_shutdown(void);
void _ecore_animator_run_reset(void); void _ecore_animator_run_reset(void);
Eina_Bool _ecore_animator_run_get(void); Eina_Bool _ecore_animator_run_get(void);
@ -275,7 +276,6 @@ void _ecore_throttle(void);
void _ecore_main_call_flush(void); void _ecore_main_call_flush(void);
static inline Eina_Bool static inline Eina_Bool
_ecore_call_task_cb(Ecore_Task_Cb func, _ecore_call_task_cb(Ecore_Task_Cb func,
void *data) void *data)