forked from enlightenment/efl
edje: reduce parts walk during load time of Edje file.
SVN revision: 66281
This commit is contained in:
parent
3e46832708
commit
186db4e496
|
@ -242,3 +242,4 @@
|
|||
2011-12-16 Cedric Bail
|
||||
|
||||
* Fix wrong call to free() in edje_load.
|
||||
* Reduce parts walk to the strict minimum.
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
Edje 1.1.0
|
||||
|
||||
Changes since Edje 1.1.0:
|
||||
|
||||
Improvements:
|
||||
* speedup load time of Edje file.
|
||||
|
||||
Changes since Edje 1.0.0:
|
||||
-------------------------
|
||||
|
||||
|
|
|
@ -262,6 +262,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
{
|
||||
Edje *ed;
|
||||
Evas *tev;
|
||||
Edje_Real_Part *rp;
|
||||
Eina_List *textblocks = NULL;
|
||||
Eina_List *sources = NULL;
|
||||
Eina_List *externals = NULL;
|
||||
Eina_List *old_swallows;
|
||||
unsigned int n;
|
||||
Eina_List *parts = NULL;
|
||||
|
@ -323,7 +327,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
else
|
||||
{
|
||||
unsigned int i;
|
||||
int errors = 0;
|
||||
|
||||
/* colorclass stuff */
|
||||
for (i = 0; i < ed->collection->parts_count; ++i)
|
||||
|
@ -333,8 +336,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
|
||||
ep = ed->collection->parts[i];
|
||||
|
||||
if (errors)
|
||||
break;
|
||||
/* Register any color classes in this parts descriptions. */
|
||||
if ((ep->default_desc) && (ep->default_desc->color_class))
|
||||
_edje_color_class_member_add(ed, ep->default_desc->color_class);
|
||||
|
@ -353,12 +354,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
for (n = 0; n < ed->collection->parts_count; n++)
|
||||
{
|
||||
Edje_Part *ep;
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
ep = ed->collection->parts[n];
|
||||
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
|
||||
if (!rp)
|
||||
{
|
||||
/* FIXME: destroy all allocated ressource, need to have a common exit point */
|
||||
ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
||||
evas_event_thaw(tev);
|
||||
evas_event_thaw_eval(tev);
|
||||
|
@ -407,9 +408,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
rp->object = evas_object_text_add(ed->base.evas);
|
||||
evas_object_text_font_source_set(rp->object, ed->path);
|
||||
break;
|
||||
case EDJE_PART_TYPE_SWALLOW:
|
||||
case EDJE_PART_TYPE_GROUP:
|
||||
sources = eina_list_append(sources, rp);
|
||||
case EDJE_PART_TYPE_SWALLOW:
|
||||
case EDJE_PART_TYPE_EXTERNAL:
|
||||
if (ep->type == EDJE_PART_TYPE_EXTERNAL)
|
||||
externals = eina_list_append(externals, rp);
|
||||
rp->object = evas_object_rectangle_add(ed->base.evas);
|
||||
evas_object_color_set(rp->object, 0, 0, 0, 0);
|
||||
evas_object_pass_events_set(rp->object, 1);
|
||||
|
@ -417,13 +421,16 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
_edje_callbacks_focus_add(rp->object, ed, rp);
|
||||
break;
|
||||
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||
textblocks = eina_list_append(textblocks, rp);
|
||||
rp->object = evas_object_textblock_add(ed->base.evas);
|
||||
break;
|
||||
case EDJE_PART_TYPE_BOX:
|
||||
sources = eina_list_append(sources, rp);
|
||||
rp->object = evas_object_box_add(ed->base.evas);
|
||||
rp->anim = _edje_box_layout_anim_new(rp->object);
|
||||
break;
|
||||
case EDJE_PART_TYPE_TABLE:
|
||||
sources = eina_list_append(sources, rp);
|
||||
rp->object = evas_object_table_add(ed->base.evas);
|
||||
break;
|
||||
case EDJE_PART_TYPE_GRADIENT:
|
||||
|
@ -463,7 +470,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
}
|
||||
if (n > 0)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
Eina_List *l;
|
||||
|
||||
ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
|
||||
|
@ -587,8 +593,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
_edje_var_init(ed);
|
||||
for (i = 0; i < ed->table_parts_size; i++)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
rp = ed->table_parts[i];
|
||||
evas_object_show(rp->object);
|
||||
if (_edje_block_break(ed)) break;
|
||||
|
@ -608,9 +612,26 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
evas_object_show(ed->base.clipper);
|
||||
|
||||
/* instantiate 'internal swallows' */
|
||||
for (i = 0; i < ed->table_parts_size; i++)
|
||||
EINA_LIST_FREE(externals, rp)
|
||||
{
|
||||
Edje_Part_Description_External *external;
|
||||
Evas_Object *child_obj;
|
||||
|
||||
external = (Edje_Part_Description_External *) rp->part->default_desc;
|
||||
child_obj = _edje_external_type_add(rp->part->source,
|
||||
evas_object_evas_get(ed->obj), ed->obj,
|
||||
external->external_params, rp->part->name);
|
||||
if (child_obj)
|
||||
{
|
||||
_edje_real_part_swallow(rp, child_obj, EINA_TRUE);
|
||||
rp->param1.external_params = _edje_external_params_parse(child_obj,
|
||||
external->external_params);
|
||||
_edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
|
||||
}
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(sources, rp)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
/* XXX: curr_item and pack_it don't require to be NULL since
|
||||
* XXX: they are just used when source != NULL and type == BOX,
|
||||
* XXX: and they're always set in this case, but GCC fails to
|
||||
|
@ -621,8 +642,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
Edje_Pack_Element *pack_it = NULL;
|
||||
const char *source = NULL;
|
||||
|
||||
rp = ed->table_parts[i];
|
||||
|
||||
switch (rp->part->type)
|
||||
{
|
||||
case EDJE_PART_TYPE_GROUP:
|
||||
|
@ -643,25 +662,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
}
|
||||
}
|
||||
break;
|
||||
case EDJE_PART_TYPE_EXTERNAL:
|
||||
{
|
||||
Edje_Part_Description_External *external;
|
||||
Evas_Object *child_obj;
|
||||
|
||||
external = (Edje_Part_Description_External *) rp->part->default_desc;
|
||||
child_obj = _edje_external_type_add(rp->part->source,
|
||||
evas_object_evas_get(ed->obj), ed->obj,
|
||||
external->external_params, rp->part->name);
|
||||
if (child_obj)
|
||||
{
|
||||
_edje_real_part_swallow(rp, child_obj, EINA_TRUE);
|
||||
rp->param1.external_params = _edje_external_params_parse(child_obj,
|
||||
external->external_params);
|
||||
_edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
/* This list should only be filled by group, box or table, nothing else. */
|
||||
abort();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -682,6 +685,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
{
|
||||
if (data == group_path_entry)
|
||||
{
|
||||
textblocks = eina_list_free(textblocks);
|
||||
externals = eina_list_free(externals);
|
||||
sources = eina_list_free(sources);
|
||||
_edje_thaw(ed);
|
||||
_edje_unblock(ed);
|
||||
_edje_unref(ed);
|
||||
|
@ -708,6 +714,9 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
|
||||
if (!_edje_object_file_set_internal(child_obj, file, source, rp->part->name, group_path))
|
||||
{
|
||||
textblocks = eina_list_free(textblocks);
|
||||
externals = eina_list_free(externals);
|
||||
sources = eina_list_free(sources);
|
||||
_edje_thaw(ed);
|
||||
_edje_unblock(ed);
|
||||
_edje_unref(ed);
|
||||
|
@ -812,14 +821,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
_edje_unref(ed);
|
||||
ed->load_error = EDJE_LOAD_ERROR_NONE;
|
||||
_edje_emit(ed, "load", NULL);
|
||||
/* instantiate 'internal swallows' */
|
||||
for (i = 0; i < ed->table_parts_size; i++)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
rp = ed->table_parts[i];
|
||||
if ((rp->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
||||
(rp->part->default_desc))
|
||||
/* instantiate 'internal textblock style' */
|
||||
EINA_LIST_FREE(textblocks, rp)
|
||||
if (rp->part->default_desc)
|
||||
{
|
||||
Edje_Part_Description_Text *text;
|
||||
Edje_Style *stl = NULL;
|
||||
|
@ -844,7 +849,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_edje_entry_init(ed);
|
||||
evas_event_thaw(tev);
|
||||
evas_event_thaw_eval(tev);
|
||||
|
|
Loading…
Reference in New Issue