eo: fix efl_isa to work propertly with interfaces

mro only contains special interfaces, not in general all, in order to
have a working function, while NOT having a bad performance. In order to
achive that we just copy the code that is done on efl_isa for a object.
which is a linear walk of a list

ref D7857

Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7860
This commit is contained in:
Marcel Hollerbach 2019-02-01 11:08:34 +01:00
parent 0f40a43e53
commit 32a2268f46
2 changed files with 6 additions and 13 deletions

View File

@ -1760,24 +1760,14 @@ efl_isa(const Eo *eo_id, const Efl_Class *klass_id)
// Case where we are looking if eo_id is a class that contain klass_id
if (EINA_UNLIKELY(_eo_is_a_class(eo_id)))
{
const _Efl_Class **kls_itr;
EO_CLASS_POINTER_GOTO(klass_id, klass, err_class);
EO_CLASS_POINTER_GOTO(eo_id, lookinto, err_class0);
if (lookinto == klass) return EINA_TRUE;
const op_type_funcs *func = _vtable_func_get
(&lookinto->vtable, klass->base_id + klass->ops_count);
kls_itr = lookinto->mro;
if (!kls_itr) return EINA_FALSE;
while (*kls_itr)
{
if ((*kls_itr) == klass)
return EINA_TRUE;
kls_itr++;
}
return EINA_FALSE;
return (func && (func->func == _eo_class_isa_func));;
}
domain = ((Eo_Id)eo_id >> SHIFT_DOMAIN) & MASK_DOMAIN;

View File

@ -37,6 +37,9 @@ main(int argc, char *argv[])
fail_if(!efl_isa(obj, INTERFACE_CLASS));
fail_if(!efl_isa(obj, INTERFACE2_CLASS));
fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE_CLASS));
fail_if(!efl_isa(SIMPLE_CLASS, INTERFACE2_CLASS));
fail_if(efl_isa(INTERFACE_CLASS, INTERFACE2_CLASS));
efl_unref(obj);
efl_object_shutdown();