From: Cedric BAIL Date: Fri, 6 Dec 2019 00:35:23 +0000 (-0800) Subject: evas: reduce useless allocation during destruction of image. X-Git-Tag: accepted/tizen/unified/20191212.123644~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72acaf9aa70e6dfe2cad9651b9a96849b6685722;p=platform%2Fupstream%2Fefl.git evas: reduce useless allocation during destruction of image. Evas image use a GC to reduce duplicated state accross multiple object. Still during shutdown we do clean it up and free it. There is no point to push that down the GC if we are to just free it after. Relying on the fact that dynamic content will avoid triggering the GC altogether as their content change to frequently and is expected to be uniq among other objects, we can avoid unecessary allocation during the destruction by just switching that early on during the destructor. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D10815 --- diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 9764db9..2dbcd99 100755 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -1704,10 +1704,13 @@ evas_object_image_init(Evas_Object *eo_obj) } EOLIAN static void -_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o EINA_UNUSED) +_efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o) { Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); + // To avoid unecessary GC storage triggered during shutdown, we mark the content as dynamic + o->content_hint = EFL_GFX_IMAGE_CONTENT_HINT_DYNAMIC; + if (obj->legacy.ctor) evas_object_image_video_surface_set(eo_obj, NULL); efl_gfx_image_stretch_region_set(eo_obj, NULL, NULL);