summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:29:57 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:29:57 -0400
commit78ea96af89b9178c01248f932fb093cb4b54b84b (patch)
tree333101a5904be16a857c0504c95c21cc08f5d288
parentb1a2d82417e5c1bbd89835c63b84c500e313df5b (diff)
evas/smart: inhibit smart member add/del callbacks when no subscribers exist
Summary: this is triggered a ton on app startup ref T8321 Depends on D10357 Reviewers: bu5hm4n, cedric Reviewed By: bu5hm4n, cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10358
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/lib/evas/canvas/evas_object_smart.c b/src/lib/evas/canvas/evas_object_smart.c
index f45f12e666..7f07d826e3 100644
--- a/src/lib/evas/canvas/evas_object_smart.c
+++ b/src/lib/evas/canvas/evas_object_smart.c
@@ -54,6 +54,8 @@ struct _Evas_Smart_Data
54 Eina_Bool cb_move : 1; /* has "move" cb added */ 54 Eina_Bool cb_move : 1; /* has "move" cb added */
55 Eina_Bool cb_resize : 1; /* has "resize" cb added */ 55 Eina_Bool cb_resize : 1; /* has "resize" cb added */
56 Eina_Bool cb_restack : 1; /* has "restack" cb added */ 56 Eina_Bool cb_restack : 1; /* has "restack" cb added */
57 Eina_Bool cb_member_added : 1; /* has "member,added" cb added */
58 Eina_Bool cb_member_removed : 1; /* has "member,removed" cb added */
57}; 59};
58 60
59typedef struct 61typedef struct
@@ -333,7 +335,8 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec
333 if (smart->smart.smart && smart->smart.smart->smart_class->member_add) 335 if (smart->smart.smart && smart->smart.smart->smart_class->member_add)
334 smart->smart.smart->smart_class->member_add(smart_obj, eo_obj); 336 smart->smart.smart->smart_class->member_add(smart_obj, eo_obj);
335 evas_object_update_bounding_box(eo_obj, obj, member_o); 337 evas_object_update_bounding_box(eo_obj, obj, member_o);
336 efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED, eo_obj); 338 if (o->cb_member_added)
339 efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED, eo_obj);
337} 340}
338 341
339EAPI void 342EAPI void
@@ -350,7 +353,7 @@ evas_object_smart_member_del(Evas_Object *eo_obj)
350} 353}
351 354
352EOLIAN static void 355EOLIAN static void
353_efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUSED, Evas_Object *eo_obj) 356_efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *sd, Evas_Object *eo_obj)
354{ 357{
355 Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 358 Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
356 Evas_Object_Protected_Data *smart; 359 Evas_Object_Protected_Data *smart;
@@ -360,7 +363,8 @@ _efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *_pd EINA_U
360 363
361 evas_object_async_block(obj); 364 evas_object_async_block(obj);
362 365
363 efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED, eo_obj); 366 if (sd->cb_member_removed)
367 efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED, eo_obj);
364 368
365 smart = efl_data_scope_get(smart_obj, EFL_CANVAS_OBJECT_CLASS); 369 smart = efl_data_scope_get(smart_obj, EFL_CANVAS_OBJECT_CLASS);
366 if (smart->smart.smart && smart->smart.smart->smart_class->member_del) 370 if (smart->smart.smart && smart->smart.smart->smart_class->member_del)
@@ -1920,7 +1924,37 @@ _efl_canvas_group_group_clipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *sd,
1920} 1924}
1921 1925
1922/* Internal EO APIs */ 1926/* Internal EO APIs */
1927EOLIAN static Eina_Bool
1928_efl_canvas_group_efl_object_event_callback_priority_add(Eo *obj, Evas_Smart_Data *sd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
1929{
1930 if (desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
1931 {
1932 sd->cb_member_added = EINA_TRUE;
1933 }
1934 else if (desc == EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED)
1935 {
1936 sd->cb_member_added = EINA_TRUE;
1937 }
1938
1939 return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
1940}
1923 1941
1942EOLIAN static Eina_Bool
1943_efl_canvas_group_efl_object_event_callback_array_priority_add(Eo *obj, Evas_Smart_Data *sd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
1944{
1945 for (int i = 0; array[i].desc; ++i)
1946 {
1947 if (array[i].desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
1948 {
1949 sd->cb_member_added = EINA_TRUE;
1950 }
1951 else if (array[i].desc == EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED)
1952 {
1953 sd->cb_member_removed = EINA_TRUE;
1954 }
1955 }
1956 return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
1957}
1924EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_add) 1958EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_add)
1925EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_del) 1959EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_del)
1926EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable) 1960EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable)
@@ -1928,6 +1962,8 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), E
1928#define EFL_CANVAS_GROUP_EXTRA_OPS \ 1962#define EFL_CANVAS_GROUP_EXTRA_OPS \
1929 EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _efl_canvas_group_group_add), \ 1963 EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _efl_canvas_group_group_add), \
1930 EFL_OBJECT_OP_FUNC(efl_canvas_group_del, _efl_canvas_group_group_del), \ 1964 EFL_OBJECT_OP_FUNC(efl_canvas_group_del, _efl_canvas_group_group_del), \
1965 EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_canvas_group_efl_object_event_callback_priority_add), \
1966 EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_canvas_group_efl_object_event_callback_array_priority_add), \
1931 EFL_OBJECT_OP_FUNC(efl_canvas_group_clipped_set, _efl_canvas_group_group_clipped_set) 1967 EFL_OBJECT_OP_FUNC(efl_canvas_group_clipped_set, _efl_canvas_group_group_clipped_set)
1932 1968
1933#include "canvas/efl_canvas_group.eo.c" 1969#include "canvas/efl_canvas_group.eo.c"