zmike pushed a commit to branch master.

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

commit b1a2d82417e5c1bbd89835c63b84c500e313df5b
Author: Mike Blumenkrantz <zm...@samsung.com>
Date:   Mon Oct 14 09:29:50 2019 -0400

    edje: block "recalc" event emission if it isn't being subscribed to
    
    Summary:
    this gets called a ton
    
    ref T8321
    Depends on D10356
    
    Reviewers: bu5hm4n, cedric
    
    Reviewed By: bu5hm4n, cedric
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8321
    
    Differential Revision: https://phab.enlightenment.org/D10357
---
 src/lib/edje/edje_calc.c    |  2 +-
 src/lib/edje/edje_private.h |  1 +
 src/lib/edje/edje_smart.c   | 24 ++++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 174033c925..091a27e3ad 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -1043,7 +1043,7 @@ _edje_recalc_do(Edje *ed)
 #endif
    if (!ed->calc_only)
      {
-        if (ed->recalc_call)
+        if (ed->recalc_call && ed->has_recalc_event_cb)
           efl_event_callback_legacy_call(ed->obj, EFL_LAYOUT_EVENT_RECALC, 
NULL);
      }
    else
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index eeee3487f2..6893dd36df 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1802,6 +1802,7 @@ struct _Edje
    Eina_Bool          need_map_update : 1;
    Eina_Bool          canvas_animator : 1;
    Eina_Bool          has_state_clip : 1;
+   Eina_Bool          has_recalc_event_cb : 1;
 };
 
 struct _Edje_Calc_Params_Map
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index de2575c6a6..ff023f8cb7 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -601,9 +601,33 @@ _efl_canvas_layout_efl_player_playback_speed_get(const Eo 
*obj EINA_UNUSED, Edje
 }
 
 /* Internal EO APIs and hidden overrides */
+EOLIAN static Eina_Bool
+_efl_canvas_layout_efl_object_event_callback_priority_add(Eo *obj, Edje *pd, 
const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb 
func, const void *user_data)
+{
+  if (desc == EFL_LAYOUT_EVENT_RECALC)
+    {
+       pd->has_recalc_event_cb = EINA_TRUE;
+    }
+
+  return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, 
priority, func, user_data);
+}
 
+EOLIAN static Eina_Bool
+_efl_canvas_layout_efl_object_event_callback_array_priority_add(Eo *obj, Edje 
*pd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, 
const void *user_data)
+{
+   for (int i = 0; array[i].desc; ++i)
+     {
+        if (array[i].desc == EFL_LAYOUT_EVENT_RECALC)
+          {
+             pd->has_recalc_event_cb = EINA_TRUE;
+          }
+     }
+   return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), 
array, priority, user_data);
+}
 #define EFL_CANVAS_LAYOUT_EXTRA_OPS \
    EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_canvas_layout), \
+   EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, 
_efl_canvas_layout_efl_object_event_callback_priority_add), \
+   EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, 
_efl_canvas_layout_efl_object_event_callback_array_priority_add), \
    EFL_OBJECT_OP_FUNC(efl_dbg_info_get, 
_efl_canvas_layout_efl_object_dbg_info_get)
 
 #include "efl_canvas_layout.eo.c"

-- 


Reply via email to