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 <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10815
This commit is contained in:
Cedric BAIL 2019-12-05 16:35:23 -08:00 committed by Marcel Hollerbach
parent 574d1192bb
commit 119cb085fa
1 changed files with 4 additions and 1 deletions

View File

@ -1677,10 +1677,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);