cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a13752dcc707c46faeea8a63bd0d8a168a0412a8

commit a13752dcc707c46faeea8a63bd0d8a168a0412a8
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Jan 25 16:29:36 2016 -0800

    edje: switch to use per window animator.
---
 src/lib/edje/edje_callbacks.c | 101 ++++++++++++++++++------------------------
 src/lib/edje/edje_load.c      |   9 ++--
 src/lib/edje/edje_main.c      |  16 -------
 src/lib/edje/edje_private.h   |   5 +--
 src/lib/edje/edje_program.c   |  34 +++++++-------
 5 files changed, 67 insertions(+), 98 deletions(-)

diff --git a/src/lib/edje/edje_callbacks.c b/src/lib/edje/edje_callbacks.c
index ec60ba9..1d97f58 100644
--- a/src/lib/edje/edje_callbacks.c
+++ b/src/lib/edje/edje_callbacks.c
@@ -374,78 +374,65 @@ _edje_mouse_wheel_signal_cb(void *data, Eo *obj, const 
Eo_Event_Description *des
 }
 
 Eina_Bool
-_edje_timer_cb(void *data EINA_UNUSED)
+_edje_timer_cb(void *data,
+               Eo *obj EINA_UNUSED,
+               const Eo_Event_Description *desc EINA_UNUSED,
+               void *event_info EINA_UNUSED) // FIXME: figure out how to use 
event_info
 {
    double t;
    Eina_List *l;
-   Eina_List *animl = NULL;
-   Edje *ed;
+   Eina_List *newl = NULL;
+   Edje *ed = data;
 
    t = ecore_loop_time_get();
-   EINA_LIST_FOREACH(_edje_animators, l, ed)
-     {
-        _edje_ref(ed);
-        animl = eina_list_append(animl, ed);
-     }
-   while (animl)
+   _edje_ref(ed);
+
+   _edje_block(ed);
+   _edje_util_freeze(ed);
+   if ((!ed->paused) && (!ed->delete_me))
      {
-        Eina_List *newl = NULL;
+        const void *tmp;
 
-        ed = eina_list_data_get(animl);
-        _edje_block(ed);
-        _edje_util_freeze(ed);
-        animl = eina_list_remove(animl, eina_list_data_get(animl));
-        if ((!ed->paused) && (!ed->delete_me))
+        ed->walking_actions = EINA_TRUE;
+        EINA_LIST_FOREACH(ed->actions, l, tmp)
+          newl = eina_list_append(newl, tmp);
+        while (newl)
           {
-             const void *tmp;
+             Edje_Running_Program *runp;
 
-             ed->walking_actions = EINA_TRUE;
-             EINA_LIST_FOREACH(ed->actions, l, tmp)
-               newl = eina_list_append(newl, tmp);
-             while (newl)
+             runp = eina_list_data_get(newl);
+             newl = eina_list_remove(newl, eina_list_data_get(newl));
+             if (!runp->delete_me)
+               _edje_program_run_iterate(runp, t);
+             if (_edje_block_break(ed))
                {
-                  Edje_Running_Program *runp;
-
-                  runp = eina_list_data_get(newl);
-                  newl = eina_list_remove(newl, eina_list_data_get(newl));
-                  if (!runp->delete_me)
-                    _edje_program_run_iterate(runp, t);
-                  if (_edje_block_break(ed))
-                    {
-                       eina_list_free(newl);
-                       newl = NULL;
-                       goto break_prog;
-                    }
+                  eina_list_free(newl);
+                  newl = NULL;
+                  goto break_prog;
                }
-             EINA_LIST_FOREACH(ed->actions, l, tmp)
-               newl = eina_list_append(newl, tmp);
-             while (newl)
-               {
-                  Edje_Running_Program *runp;
+          }
+        EINA_LIST_FOREACH(ed->actions, l, tmp)
+          newl = eina_list_append(newl, tmp);
+        while (newl)
+          {
+             Edje_Running_Program *runp;
 
-                  runp = eina_list_data_get(newl);
-                  newl = eina_list_remove(newl, eina_list_data_get(newl));
-                  if (runp->delete_me)
-                    {
-                       _edje_anim_count--;
-                       runp->edje->actions =
-                         eina_list_remove(runp->edje->actions, runp);
-                       if (!runp->edje->actions)
-                         _edje_animators =
-                           eina_list_remove(_edje_animators, runp->edje);
-                       free(runp);
-                    }
+             runp = eina_list_data_get(newl);
+             newl = eina_list_remove(newl, eina_list_data_get(newl));
+             if (runp->delete_me)
+               {
+                  _edje_program_run_cleanup(ed, runp);
+                  free(runp);
                }
-             ed->walking_actions = EINA_FALSE;
           }
-break_prog:
-        _edje_unblock(ed);
-        _edje_util_thaw(ed);
-        _edje_unref(ed);
+        ed->walking_actions = EINA_FALSE;
      }
-   if (_edje_anim_count > 0) return ECORE_CALLBACK_RENEW;
-   _edje_timer = NULL;
-   return ECORE_CALLBACK_CANCEL;
+break_prog:
+   _edje_unblock(ed);
+   _edje_util_thaw(ed);
+   _edje_unref(ed);
+
+   return EO_CALLBACK_CONTINUE;
 }
 
 Eina_Bool
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index 8c6b6c1..06f783c 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1641,17 +1641,18 @@ _edje_file_del(Edje *ed)
         _edje_cache_file_unref(ed->file);
         ed->file = NULL;
      }
+
+   // Cleanup all animator
    if (ed->actions)
      {
         Edje_Running_Program *runp;
 
         EINA_LIST_FREE(ed->actions, runp)
-          {
-             _edje_anim_count--;
-             free(runp);
-          }
+          free(runp);
      }
    _edje_animators = eina_list_remove(_edje_animators, ed);
+   eo_do(ed->obj, eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, 
_edje_timer_cb, ed));
+
    if (ed->pending_actions)
      {
         Edje_Pending_Program *pp;
diff --git a/src/lib/edje/edje_main.c b/src/lib/edje/edje_main.c
index 8803320..8748a35 100644
--- a/src/lib/edje/edje_main.c
+++ b/src/lib/edje/edje_main.c
@@ -233,12 +233,6 @@ edje_shutdown(void)
    if (--_edje_init_count != 0)
      return _edje_init_count;
 
-   if (_edje_timer)
-     {
-        ecore_animator_del(_edje_timer);
-        _edje_timer = NULL;
-     }
-
    _edje_shutdown_core();
 
    return _edje_init_count;
@@ -248,8 +242,6 @@ edje_shutdown(void)
 void
 _edje_del(Edje *ed)
 {
-   Edje_Running_Program *runp;
-   Edje_Pending_Program *pp;
    Edje_Text_Insert_Filter_Callback *cb;
 
    if (ed->processing_messages)
@@ -265,14 +257,6 @@ _edje_del(Edje *ed)
    if (ed->parent) eina_stringshare_del(ed->parent);
    ed->path = NULL;
    ed->group = NULL;
-   if ((ed->actions) || (ed->pending_actions))
-     {
-        _edje_animators = eina_list_remove(_edje_animators, ed);
-     }
-   EINA_LIST_FREE(ed->actions, runp)
-     free(runp);
-   EINA_LIST_FREE(ed->pending_actions, pp)
-     free(pp);
    eina_hash_free(ed->color_classes);
    eina_hash_free(ed->text_classes);
    eina_hash_free(ed->size_classes);
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 95fb936..3dcca2f 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2220,8 +2220,6 @@ EAPI void _edje_edd_shutdown(void);
 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
 EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
 
-extern int              _edje_anim_count;
-extern Ecore_Animator  *_edje_timer;
 extern Eina_List       *_edje_animators;
 extern Eina_List       *_edje_edjes;
 
@@ -2279,7 +2277,7 @@ void  _edje_recalc_do(Edje *ed);
 int   _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, FLOAT_T *x, 
FLOAT_T *y);
 void  _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, FLOAT_T x, FLOAT_T 
y);
 
-Eina_Bool _edje_timer_cb(void *data);
+Eina_Bool _edje_timer_cb(void *data, Eo *obj, const Eo_Event_Description 
*desc, void *event_info);
 Eina_Bool _edje_pending_timer_cb(void *data);
 void  _edje_callbacks_add(Evas_Object *obj, Edje *ed, Edje_Real_Part *rp);
 void  _edje_callbacks_focus_add(Evas_Object *obj, Edje *ed, Edje_Real_Part 
*rp);
@@ -2322,6 +2320,7 @@ void  _edje_clean_objects(Edje *ed);
 void  _edje_ref(Edje *ed);
 void  _edje_unref(Edje *ed);
 
+void _edje_program_run_cleanup(Edje *ed, Edje_Running_Program *runp);
 Eina_Bool _edje_program_run_iterate(Edje_Running_Program *runp, double tim);
 void  _edje_program_end(Edje *ed, Edje_Running_Program *runp);
 void  _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const 
char *ssig, const char *ssrc);
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 1e59ab0..753de78 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -4,8 +4,6 @@ static void _edje_emit_cb(Edje *ed, const char *sig, const char 
*src, Edje_Messa
 static void _edje_param_copy(Edje *ed, Edje_Real_Part *src_part, const char 
*src_param, Edje_Real_Part *dst_part, const char *dst_param);
 static void _edje_param_set(Edje *ed, Edje_Real_Part *part, const char *param, 
const char *value);
 
-int _edje_anim_count = 0;
-Ecore_Animator *_edje_timer = NULL;
 Eina_List *_edje_animators = NULL;
 static double _edje_transition_duration_scale = 0;
 
@@ -421,6 +419,15 @@ _edje_object_animation_get(Eo *obj EINA_UNUSED, Edje *ed)
 }
 
 /* Private Routines */
+void
+_edje_program_run_cleanup(Edje *ed, Edje_Running_Program *runp)
+{
+   ed->actions = eina_list_remove(ed->actions, runp);
+   if (!ed->actions)
+     {
+        eo_do(ed->obj, 
eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, 
ed));
+     }
+}
 
 Eina_Bool
 _edje_program_run_iterate(Edje_Running_Program *runp, double tim)
@@ -486,12 +493,7 @@ _edje_program_run_iterate(Edje_Running_Program *runp, 
double tim)
         _edje_recalc(ed);
         runp->delete_me = EINA_TRUE;
         if (!ed->walking_actions)
-          {
-             _edje_anim_count--;
-             ed->actions = eina_list_remove(ed->actions, runp);
-             if (!ed->actions)
-               _edje_animators = eina_list_remove(_edje_animators, ed);
-          }
+          _edje_program_run_cleanup(ed, runp);
         //     _edje_emit(ed, "program,stop", runp->program->name);
         if (_edje_block_break(ed))
           {
@@ -568,13 +570,8 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp)
    //   pname = runp->program->name;
    if (!ed->walking_actions)
      {
-        _edje_anim_count--;
-        ed->actions = eina_list_remove(ed->actions, runp);
+        _edje_program_run_cleanup(ed, runp);
         free_runp = 1;
-        if (!ed->actions)
-          {
-             _edje_animators = eina_list_remove(_edje_animators, ed);
-          }
      }
    //   _edje_emit(ed, "program,stop", pname);
    _edje_util_thaw(ed);
@@ -726,15 +723,16 @@ low_mem_current:
                   ed->actions = eina_list_append(ed->actions, runp);
                   goto break_prog;
                }
+
              if (!ed->actions)
-               _edje_animators = eina_list_append(_edje_animators, ed);
+               {
+                  eo_do(ed->obj, 
eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _edje_timer_cb, 
ed));
+               }
              ed->actions = eina_list_append(ed->actions, runp);
+
              runp->start_time = ecore_loop_time_get();
              runp->edje = ed;
              runp->program = pr;
-             if (!_edje_timer)
-               _edje_timer = ecore_animator_add(_edje_timer_cb, NULL);
-             _edje_anim_count++;
           }
         else
           {

-- 


Reply via email to