summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubhransu Mohanty <smohantty@gmail.com>2020-06-17 06:28:44 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-06-17 08:56:14 +0200
commit18b0abf62f91fc4992ade39efb756a9f74bbe616 (patch)
tree84f1f89b283be74c3978d1310561aa1d601a1fb4
parent95eb621c15462e54ba9b092bca6ceec2a0fb3a1a (diff)
elementary/perf: reduce number of efl_isa() call. in elementary test application efl_isa() shows up as hotsport during profiling so refactored the code to reduce redundant efl_isa() calls.
in genlist testcase the number of calls reduced by 30000. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Reviewed-by: Hermet Park <<hermetpark@gmail.com>> Reviewed-by: Youngbok Shin <youngb.shin@samsung.com> Differential Revision: https://phab.enlightenment.org/D11984
-rw-r--r--src/lib/elementary/efl_ui_widget.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index c2a0af7ce7..0b6ea105a9 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -186,8 +186,6 @@ _on_sub_obj_del(void *data, const Efl_Event *event);
186static void _propagate_event(void *data, const Efl_Event *eo_event); 186static void _propagate_event(void *data, const Efl_Event *eo_event);
187static void _elm_widget_shadow_update(Efl_Ui_Widget *obj); 187static void _elm_widget_shadow_update(Efl_Ui_Widget *obj);
188 188
189EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks,
190 { EFL_EVENT_DEL, _on_sub_obj_del });
191EFL_CALLBACKS_ARRAY_DEFINE(efl_subitems_callbacks, 189EFL_CALLBACKS_ARRAY_DEFINE(efl_subitems_callbacks,
192 { EFL_EVENT_DEL, _on_sub_obj_del }); 190 { EFL_EVENT_DEL, _on_sub_obj_del });
193EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, 191EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks,
@@ -198,27 +196,13 @@ EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks,
198static inline void 196static inline void
199_callbacks_add(Eo *widget, void *data) 197_callbacks_add(Eo *widget, void *data)
200{ 198{
201 if (_elm_widget_is(widget)) 199 efl_event_callback_array_add(widget, efl_subitems_callbacks(), data);
202 {
203 efl_event_callback_array_add(widget, elm_widget_subitems_callbacks(), data);
204 }
205 else
206 {
207 efl_event_callback_array_add(widget, efl_subitems_callbacks(), data);
208 }
209} 200}
210 201
211static inline void 202static inline void
212_callbacks_del(Eo *widget, void *data) 203_callbacks_del(Eo *widget, void *data)
213{ 204{
214 if (_elm_widget_is(widget)) 205 efl_event_callback_array_del(widget, efl_subitems_callbacks(), data);
215 {
216 efl_event_callback_array_del(widget, elm_widget_subitems_callbacks(), data);
217 }
218 else
219 {
220 efl_event_callback_array_del(widget, efl_subitems_callbacks(), data);
221 }
222} 206}
223 207
224void 208void
@@ -1532,12 +1516,14 @@ EOLIAN static Eina_Bool
1532_efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) 1516_efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj)
1533{ 1517{
1534 Efl_Ui_Widget *parent; 1518 Efl_Ui_Widget *parent;
1519 Eina_Bool is_widget;
1535 1520
1536 EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(sobj, EFL_GFX_ENTITY_INTERFACE), EINA_FALSE); 1521 EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(sobj, EFL_GFX_ENTITY_INTERFACE), EINA_FALSE);
1537 EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); 1522 EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE);
1538 1523
1524 is_widget = elm_widget_is(sobj);
1539 //first make sure that we unregister the sobj from the parent 1525 //first make sure that we unregister the sobj from the parent
1540 if (elm_widget_is(sobj)) 1526 if (is_widget)
1541 parent = efl_ui_widget_parent_get(sobj); 1527 parent = efl_ui_widget_parent_get(sobj);
1542 else 1528 else
1543 parent = evas_object_data_get(sobj, "elm-parent"); 1529 parent = evas_object_data_get(sobj, "elm-parent");
@@ -1560,7 +1546,7 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
1560 1546
1561 //and if it is a widget, please set the correct parent on the widget itself 1547 //and if it is a widget, please set the correct parent on the widget itself
1562 //the parent set method will take care of the property syncing etc. 1548 //the parent set method will take care of the property syncing etc.
1563 if (elm_widget_is(sobj)) 1549 if (is_widget)
1564 efl_ui_widget_parent_set(sobj, obj); 1550 efl_ui_widget_parent_set(sobj, obj);
1565 1551
1566 return EINA_TRUE; 1552 return EINA_TRUE;
@@ -1569,13 +1555,17 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
1569EOLIAN static Eina_Bool 1555EOLIAN static Eina_Bool
1570_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) 1556_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj)
1571{ 1557{
1572 Evas_Object *sobj_parent; 1558 Evas_Object *sobj_parent = NULL;
1559 Eina_Bool is_widget;
1573 1560
1574 if (!sobj) return EINA_FALSE; 1561 if (!sobj) return EINA_FALSE;
1575 1562
1576 EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); 1563 EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE);
1577 1564
1578 sobj_parent = evas_object_data_del(sobj, "elm-parent"); 1565 is_widget = _elm_widget_is(sobj);
1566
1567 if (!is_widget) sobj_parent = evas_object_data_del(sobj, "elm-parent");
1568
1579 if (sobj_parent && sobj_parent != obj) 1569 if (sobj_parent && sobj_parent != obj)
1580 { 1570 {
1581 static int abort_on_warn = -1; 1571 static int abort_on_warn = -1;
@@ -1595,7 +1585,7 @@ _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob
1595 return EINA_FALSE; 1585 return EINA_FALSE;
1596 } 1586 }
1597 1587
1598 if (_elm_widget_is(sobj)) 1588 if (is_widget)
1599 { 1589 {
1600 if (_is_focused(sobj)) 1590 if (_is_focused(sobj))
1601 { 1591 {