ecore: improve debugging of animator.
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 28 Feb 2017 19:01:09 +0000 (11:01 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 28 Feb 2017 19:04:34 +0000 (11:04 -0800)
src/lib/ecore/ecore.c
src/lib/ecore/ecore_anim.c
src/lib/ecore/ecore_private.h

index e531c1c..99ba1dd 100644 (file)
@@ -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",
index 5ce2775..44bd1f2 100644 (file)
@@ -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("<animator", NULL, 0.0, NULL);
    ticking = 0;
 
+   DBG("General animator unregistered.");
+
    _timer_tick_end();
 
    if ((src == ECORE_ANIMATOR_SOURCE_CUSTOM) && end_tick_cb)
@@ -458,6 +489,7 @@ _do_tick(void)
    Ecore_Animator *animator;
    Eina_Inlist *tmp;
 
+   DBG("General animator tick.");
    EINA_INLIST_FOREACH(animators, animator)
      {
         animator->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.");
+     }
+}
index 0197c8d..f810c6c 100644 (file)
@@ -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)