forked from enlightenment/efl
edje - replace eina list with eina inlist to save mem and performance
edje was keeping every edje object created in an eina list so it could access them later. not really great when every list node contains at least 4 pointers (data, next, prev and accounting, possibly magic too). also ever time an edje object is deleted it has to remove from this list which means... walking the list to where the obj is... not great. replace with an inlist which is just 3 ptrs, no extra pressure on list pool and removal os O(1) too. @optimize
This commit is contained in:
parent
d86f73f9e6
commit
749bc23231
|
@ -1628,6 +1628,8 @@ struct _Edje
|
|||
Evas_Object *clipper; // a big rect to clip this Edje to
|
||||
Evas *evas; // the Evas this Edje belongs to
|
||||
*/
|
||||
EINA_INLIST;
|
||||
|
||||
const char *path;
|
||||
const char *group;
|
||||
const char *parent;
|
||||
|
@ -2284,7 +2286,7 @@ EAPI extern Eet_Data_Descriptor *_edje_edd_edje_file;
|
|||
EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection;
|
||||
|
||||
extern Eina_List *_edje_animators;
|
||||
extern Eina_List *_edje_edjes;
|
||||
extern Eina_Inlist *_edje_edjes;
|
||||
|
||||
extern char *_edje_fontset_append;
|
||||
extern FLOAT_T _edje_scale;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define MY_CLASS_NAME "Edje"
|
||||
#define MY_CLASS_NAME_LEGACY "edje"
|
||||
|
||||
Eina_List *_edje_edjes = NULL;
|
||||
Eina_Inlist *_edje_edjes = NULL;
|
||||
|
||||
/************************** API Routines **************************/
|
||||
|
||||
|
@ -127,21 +127,7 @@ _edje_object_efl_canvas_group_group_add(Eo *obj, Edje *ed)
|
|||
|
||||
evas_object_geometry_get(obj, &(ed->x), &(ed->y), &(ed->w), &(ed->h));
|
||||
ed->obj = obj;
|
||||
_edje_edjes = eina_list_append(_edje_edjes, obj);
|
||||
/*
|
||||
{
|
||||
Eina_List *l;
|
||||
const void *data;
|
||||
|
||||
printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes));
|
||||
EINA_LIST_FOREACH(_edge_edges, l, data)
|
||||
{
|
||||
ed = _edje_fetch(data);
|
||||
printf("EDJE: %80s | %80s\n", ed->path, ed->part);
|
||||
}
|
||||
printf("--- EDJE DUMP [%i]\n", eina_list_count(_edje_edjes));
|
||||
}
|
||||
*/
|
||||
_edje_edjes = eina_inlist_append(_edje_edjes, EINA_INLIST_GET(ed));
|
||||
evas_event_thaw(tev);
|
||||
evas_event_thaw_eval(tev);
|
||||
}
|
||||
|
@ -151,7 +137,7 @@ _edje_object_efl_canvas_group_group_del(Eo *obj, Edje *ed)
|
|||
{
|
||||
_edje_block_violate(ed);
|
||||
ed->delete_me = 1;
|
||||
_edje_edjes = eina_list_remove(_edje_edjes, obj);
|
||||
_edje_edjes = eina_inlist_remove(_edje_edjes, EINA_INLIST_GET(ed));
|
||||
evas_object_smart_data_set(obj, NULL);
|
||||
if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
|
||||
#ifdef HAVE_EPHYSICS
|
||||
|
|
|
@ -278,11 +278,9 @@ edje_freeze(void)
|
|||
#else
|
||||
// FIXME: could just have a global freeze instead of per object
|
||||
// above i tried.. but this broke some things. notable e17's menus. why?
|
||||
Eina_List *l;
|
||||
Evas_Object *data;
|
||||
Edje *ed;
|
||||
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
||||
edje_object_freeze(data);
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed) edje_object_freeze(ed->obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -384,8 +382,7 @@ _edje_object_language_get(Eo *obj EINA_UNUSED, Edje *ed)
|
|||
EAPI void
|
||||
edje_language_set(const char *locale)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Eina_List *l;
|
||||
Edje *ed;
|
||||
const char *lookup;
|
||||
char *signal;
|
||||
char *loc;
|
||||
|
@ -402,14 +399,10 @@ edje_language_set(const char *locale)
|
|||
signal = alloca(length + 15);
|
||||
snprintf(signal, length + 15, "edje,language,%s", loc);
|
||||
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, obj)
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed)
|
||||
{
|
||||
Edje *ed = eo_data_scope_get(obj, EDJE_OBJECT_CLASS);
|
||||
|
||||
if (ed->language)
|
||||
continue;
|
||||
|
||||
_edje_language_signal_emit(ed, obj, signal);
|
||||
if (ed->language) continue;
|
||||
_edje_language_signal_emit(ed, ed->obj, signal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,14 +424,9 @@ edje_thaw(void)
|
|||
}
|
||||
}
|
||||
#else
|
||||
Evas_Object *data;
|
||||
Edje *ed;
|
||||
|
||||
// FIXME: could just have a global freeze instead of per object
|
||||
// comment as above.. why?
|
||||
Eina_List *l;
|
||||
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
||||
edje_object_thaw(data);
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed) edje_object_thaw(ed->obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -459,13 +447,11 @@ edje_fontset_append_get(void)
|
|||
EAPI void
|
||||
edje_scale_set(double scale)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *data;
|
||||
Edje *ed;
|
||||
|
||||
if (_edje_scale == FROM_DOUBLE(scale)) return;
|
||||
_edje_scale = FROM_DOUBLE(scale);
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
||||
edje_object_calc_force(data);
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed) edje_object_calc_force(ed->obj);
|
||||
}
|
||||
|
||||
EAPI double
|
||||
|
@ -5524,12 +5510,10 @@ edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Co
|
|||
}
|
||||
if (ps->global)
|
||||
{
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, o)
|
||||
{
|
||||
Edje *ed;
|
||||
Edje *ed;
|
||||
|
||||
ed = eo_data_scope_get(o, EDJE_OBJECT_CLASS);
|
||||
if (!ed) continue;
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed)
|
||||
{
|
||||
if (!ed->persp)
|
||||
{
|
||||
ed->dirty = EINA_TRUE;
|
||||
|
@ -5543,8 +5527,8 @@ edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Co
|
|||
EAPI void
|
||||
edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
|
||||
{
|
||||
Edje *ed;
|
||||
Evas_Object *o;
|
||||
Eina_List *l;
|
||||
|
||||
if (!ps) return;
|
||||
if (ps->global == global) return;
|
||||
|
@ -5558,12 +5542,8 @@ edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
|
|||
else
|
||||
evas_object_name_set(ps->obj, NULL);
|
||||
ps->global = global;
|
||||
EINA_LIST_FOREACH(_edje_edjes, l, o)
|
||||
EINA_INLIST_FOREACH(_edje_edjes, ed)
|
||||
{
|
||||
Edje *ed;
|
||||
|
||||
ed = eo_data_scope_get(o, EDJE_OBJECT_CLASS);
|
||||
if (!ed) continue;
|
||||
if (!ed->persp)
|
||||
{
|
||||
ed->dirty = EINA_TRUE;
|
||||
|
|
Loading…
Reference in New Issue