forked from enlightenment/efl
Compare commits
9 Commits
master
...
devs/avilo
Author | SHA1 | Date |
---|---|---|
|
d8c44ee7f6 | |
|
3f7c4978f3 | |
|
c7b50e597e | |
|
af71da5bec | |
|
d21634f9f8 | |
|
de066fc0b5 | |
|
b38b2df9a3 | |
|
24296c6527 | |
|
5c78c1b415 |
|
@ -21,11 +21,57 @@ typedef struct
|
||||||
Eina_Inlist *generic_data;
|
Eina_Inlist *generic_data;
|
||||||
Eo ***wrefs;
|
Eo ***wrefs;
|
||||||
|
|
||||||
Eo_Callback_Description *callbacks;
|
Eina_Inarray *callbacks;
|
||||||
unsigned short walking_list;
|
unsigned short walking_list;
|
||||||
unsigned short event_freeze_count;
|
unsigned short event_freeze_count;
|
||||||
Eina_Bool deletions_waiting : 1;
|
Eina_Bool deletions_waiting : 1;
|
||||||
|
|
||||||
|
//clock_t call_updated;
|
||||||
|
|
||||||
|
//for benchmark start
|
||||||
|
unsigned int called_counter;
|
||||||
|
unsigned int callbacks_counter;
|
||||||
|
unsigned int called_loop_counter;
|
||||||
|
unsigned int called_inner_loop_counter;
|
||||||
|
unsigned int arrays_counter;
|
||||||
|
clock_t called_sum_clocks ;
|
||||||
|
|
||||||
|
unsigned int events_counter;
|
||||||
|
unsigned long long int have_events;
|
||||||
|
|
||||||
|
//for benchmar endk
|
||||||
|
|
||||||
|
|
||||||
} Eo_Base_Data;
|
} Eo_Base_Data;
|
||||||
|
//for benchmark start
|
||||||
|
|
||||||
|
static unsigned int called_counter=0;
|
||||||
|
static unsigned int callbacks_counter=0;
|
||||||
|
static unsigned int called_loop_counter=0;
|
||||||
|
static unsigned int called_inner_loop_counter=0;
|
||||||
|
|
||||||
|
static unsigned int arrays_counter=0;
|
||||||
|
static unsigned int objects_counter=0;
|
||||||
|
|
||||||
|
static clock_t called_sum_clocks =0;
|
||||||
|
static clock_t start_clock =0;
|
||||||
|
|
||||||
|
static unsigned int events_counter=0;
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned legacy_events_inserted=0;
|
||||||
|
static unsigned regular_events_inserted=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//for benchmark end
|
||||||
|
//static clock_t call_updated=0;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const Eo_Event_Description *event;
|
||||||
|
Eina_Stringshare *event_name;
|
||||||
|
Eo_Callback_Description *callbacks;
|
||||||
|
}Eo_Event_Callbacks;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -436,27 +482,29 @@ _legacy_events_hash_free_cb(void *_desc)
|
||||||
struct _Eo_Callback_Description
|
struct _Eo_Callback_Description
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *next;
|
Eo_Callback_Description *next;
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
Eo_Callback_Array_Item item;
|
Eo_Callback_Array_Item item;
|
||||||
const Eo_Callback_Array_Item *item_array;
|
const Eo_Callback_Array_Item *item_array;
|
||||||
} items;
|
} items;
|
||||||
|
const Eo_Callback_Array_Item *item_array;
|
||||||
void *func_data;
|
void *func_data;
|
||||||
Eo_Callback_Priority priority;
|
Eo_Callback_Priority priority;
|
||||||
|
|
||||||
Eina_Bool delete_me : 1;
|
Eina_Bool delete_me : 1;
|
||||||
Eina_Bool func_array : 1;
|
Eina_Bool func_array : 1;
|
||||||
|
Eina_Bool is_legacy_counter : 1;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Actually remove, doesn't care about walking list, or delete_me */
|
/* Actually remove, doesn't care about walking list, or delete_me */
|
||||||
static void
|
static void
|
||||||
_eo_callback_remove(Eo_Base_Data *pd, Eo_Callback_Description *cb)
|
_eo_callback_remove(Eo_Event_Callbacks *ec, Eo_Callback_Description *cb)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *itr, *pitr = NULL;
|
Eo_Callback_Description *itr, *pitr = NULL;
|
||||||
|
|
||||||
itr = pd->callbacks;
|
|
||||||
|
itr = ec->callbacks;
|
||||||
|
|
||||||
for ( ; itr; )
|
for ( ; itr; )
|
||||||
{
|
{
|
||||||
|
@ -471,29 +519,32 @@ _eo_callback_remove(Eo_Base_Data *pd, Eo_Callback_Description *cb)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pd->callbacks = titr->next;
|
ec->callbacks = titr->next;
|
||||||
}
|
}
|
||||||
free(titr);
|
free(titr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pitr = titr;
|
pitr = titr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually remove, doesn't care about walking list, or delete_me */
|
/* Actually remove, doesn't care about walking list, or delete_me */
|
||||||
static void
|
static void
|
||||||
_eo_callback_remove_all(Eo_Base_Data *pd)
|
_eo_callback_remove_all(Eo_Base_Data *pd)
|
||||||
{
|
{
|
||||||
while (pd->callbacks)
|
Eo_Event_Callbacks *cbs;
|
||||||
|
|
||||||
|
EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *next = pd->callbacks->next;
|
while (cbs->callbacks)
|
||||||
free(pd->callbacks);
|
{
|
||||||
pd->callbacks = next;
|
Eo_Callback_Description *next = cbs->callbacks->next;
|
||||||
|
free(cbs->callbacks);
|
||||||
|
cbs->callbacks = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_eo_callbacks_clear(Eo_Base_Data *pd)
|
_eo_callbacks_clear(Eo_Base_Data *pd)
|
||||||
{
|
{
|
||||||
|
@ -508,24 +559,28 @@ _eo_callbacks_clear(Eo_Base_Data *pd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pd->deletions_waiting = EINA_FALSE;
|
pd->deletions_waiting = EINA_FALSE;
|
||||||
|
Eo_Event_Callbacks *cbs;
|
||||||
|
|
||||||
for (cb = pd->callbacks; cb; )
|
EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *titr = cb;
|
for (cb = cbs->callbacks; cb; )
|
||||||
cb = cb->next;
|
|
||||||
|
|
||||||
if (titr->delete_me)
|
|
||||||
{
|
{
|
||||||
_eo_callback_remove(pd, titr);
|
Eo_Callback_Description *titr = cb;
|
||||||
|
cb = cb->next;
|
||||||
|
|
||||||
|
if (titr->delete_me)
|
||||||
|
{
|
||||||
|
_eo_callback_remove(cbs, titr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_eo_callbacks_sorted_insert(Eo_Base_Data *pd, Eo_Callback_Description *cb)
|
_eo_callbacks_list_sorted_insert( Eo_Event_Callbacks *ec, Eo_Callback_Description *cb)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *itr, *itrp = NULL;
|
Eo_Callback_Description *itr, *itrp = NULL;
|
||||||
for (itr = pd->callbacks; itr && (itr->priority < cb->priority);
|
for (itr = ec->callbacks; itr && (itr->priority < cb->priority);
|
||||||
itr = itr->next)
|
itr = itr->next)
|
||||||
{
|
{
|
||||||
itrp = itr;
|
itrp = itr;
|
||||||
|
@ -538,17 +593,87 @@ _eo_callbacks_sorted_insert(Eo_Base_Data *pd, Eo_Callback_Description *cb)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cb->next = pd->callbacks;
|
cb->next = ec->callbacks;
|
||||||
pd->callbacks = cb;
|
ec->callbacks = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int
|
||||||
|
_eo_base_event_compare( const void* e1 , const void* e2){
|
||||||
|
|
||||||
EOLIAN static void
|
if( ((Eo_Event_Callbacks*)e1)->event_name == ((Eo_Event_Callbacks*)e2)->event_name)
|
||||||
_eo_base_event_callback_priority_add(Eo *obj, Eo_Base_Data *pd,
|
return 0;
|
||||||
const Eo_Event_Description *desc,
|
|
||||||
Eo_Callback_Priority priority,
|
|
||||||
Eo_Event_Cb func,
|
if( ((Eo_Event_Callbacks*)e1)->event_name > ((Eo_Event_Callbacks*)e2)->event_name)
|
||||||
const void *user_data)
|
return 1;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
_eo_callbacks_sorted_insert(Eo_Base_Data *pd, Eo_Callback_Description *cb, const Eo_Event_Description *desc)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!desc)
|
||||||
|
{
|
||||||
|
DBG("sorted insert NULL event!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
//adding to events conter - statistics
|
||||||
|
unsigned int index = ((unsigned long long int )desc)%63;
|
||||||
|
if( (pd->have_events & (1<<index) )==0){
|
||||||
|
pd->events_counter++;
|
||||||
|
pd->have_events |= 1<<index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pd->callbacks_counter++;//avi debug
|
||||||
|
|
||||||
|
Eina_Stringshare *event_name;
|
||||||
|
if (desc->doc != _legacy_event_desc)
|
||||||
|
{
|
||||||
|
legacy_events_inserted++;
|
||||||
|
event_name = eina_stringshare_add(desc->name);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event_name = desc->name;
|
||||||
|
regular_events_inserted++;
|
||||||
|
}
|
||||||
|
Eo_Event_Callbacks *cbs;
|
||||||
|
Eo_Event_Callbacks ec = { desc, event_name , cb };
|
||||||
|
|
||||||
|
cb->next=NULL;
|
||||||
|
int index = eina_inarray_search_sorted ( pd->callbacks, &ec , _eo_base_event_compare );
|
||||||
|
/* EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
|
{
|
||||||
|
// if(_cb_desc_match(desc, cbs->event))
|
||||||
|
if(event_name == cbs->event_name)
|
||||||
|
{
|
||||||
|
_eo_callbacks_list_sorted_insert(cbs, cb);
|
||||||
|
if (desc->doc != _legacy_event_desc)
|
||||||
|
eina_stringshare_del(event_name);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(index !=-1){
|
||||||
|
cbs =eina_inarray_nth(pd->callbacks , index );
|
||||||
|
_eo_callbacks_list_sorted_insert(cbs, cb);
|
||||||
|
if (desc->doc != _legacy_event_desc)
|
||||||
|
eina_stringshare_del(event_name);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// eina_inarray_push(pd->callbacks, &ec);
|
||||||
|
eina_inarray_insert_sorted(pd->callbacks , &ec , _eo_base_event_compare );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void _eo_base_event_callback_priority_add(Eo *obj, Eo_Base_Data *pd,
|
||||||
|
const Eo_Event_Description *desc, Eo_Callback_Priority priority, Eo_Event_Cb func, const void *data)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *cb;
|
Eo_Callback_Description *cb;
|
||||||
|
|
||||||
|
@ -556,9 +681,12 @@ _eo_base_event_callback_priority_add(Eo *obj, Eo_Base_Data *pd,
|
||||||
if (!cb) return;
|
if (!cb) return;
|
||||||
cb->items.item.desc = desc;
|
cb->items.item.desc = desc;
|
||||||
cb->items.item.func = func;
|
cb->items.item.func = func;
|
||||||
cb->func_data = (void *) user_data;
|
cb->func_data = (void *) data;
|
||||||
cb->priority = priority;
|
cb->priority = priority;
|
||||||
_eo_callbacks_sorted_insert(pd, cb);
|
cb->func_array = EINA_FALSE;
|
||||||
|
|
||||||
|
cb->delete_me = EINA_FALSE;
|
||||||
|
_eo_callbacks_sorted_insert(pd, cb, desc);
|
||||||
|
|
||||||
{
|
{
|
||||||
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
||||||
|
@ -568,24 +696,30 @@ _eo_base_event_callback_priority_add(Eo *obj, Eo_Base_Data *pd,
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_eo_base_event_callback_del(Eo *obj, Eo_Base_Data *pd,
|
_eo_base_event_callback_del(Eo *obj, Eo_Base_Data *pd,
|
||||||
const Eo_Event_Description *desc,
|
const Eo_Event_Description *desc,
|
||||||
Eo_Event_Cb func,
|
Eo_Event_Cb func,
|
||||||
const void *user_data)
|
const void *user_data)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *cb;
|
Eo_Callback_Description *cb;
|
||||||
|
|
||||||
for (cb = pd->callbacks; cb; cb = cb->next)
|
Eo_Event_Callbacks *cbs;
|
||||||
{
|
|
||||||
if ((cb->items.item.desc == desc) && (cb->items.item.func == func) &&
|
|
||||||
(cb->func_data == user_data))
|
|
||||||
{
|
|
||||||
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
|
||||||
|
|
||||||
cb->delete_me = EINA_TRUE;
|
EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
pd->deletions_waiting = EINA_TRUE;
|
{
|
||||||
_eo_callbacks_clear(pd);
|
for (cb = cbs->callbacks; cb; cb = cb->next)
|
||||||
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)arr); );
|
|
||||||
return;
|
{
|
||||||
|
if ((cb->items.item.desc == desc) && (cb->items.item.func == func) &&
|
||||||
|
(cb->func_data == user_data))
|
||||||
|
{
|
||||||
|
const Eo_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
||||||
|
|
||||||
|
cb->delete_me = EINA_TRUE;
|
||||||
|
pd->deletions_waiting = EINA_TRUE;
|
||||||
|
_eo_callbacks_clear(pd);
|
||||||
|
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)arr); );
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,18 +732,28 @@ _eo_base_event_callback_array_priority_add(Eo *obj, Eo_Base_Data *pd,
|
||||||
Eo_Callback_Priority priority,
|
Eo_Callback_Priority priority,
|
||||||
const void *user_data)
|
const void *user_data)
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *cb;
|
const Eo_Callback_Array_Item *it;
|
||||||
|
|
||||||
|
for (it = array; it->func; it++)
|
||||||
|
{
|
||||||
|
Eo_Callback_Description *cb;
|
||||||
|
|
||||||
|
cb = calloc(1, sizeof(*cb));
|
||||||
|
if (!cb) return;
|
||||||
|
cb->items.item.desc = it->desc;
|
||||||
|
cb->items.item.func = it->func;
|
||||||
|
|
||||||
|
cb->func_data = (void *) user_data;
|
||||||
|
cb->priority = priority;
|
||||||
|
cb->item_array = array;
|
||||||
|
cb->func_array = EINA_TRUE;
|
||||||
|
cb->delete_me = EINA_FALSE;
|
||||||
|
_eo_callbacks_sorted_insert(pd, cb,it->desc);
|
||||||
|
}
|
||||||
|
|
||||||
cb = calloc(1, sizeof(*cb));
|
|
||||||
if (!cb) return;
|
|
||||||
cb->func_data = (void *) user_data;
|
|
||||||
cb->priority = priority;
|
|
||||||
cb->items.item_array = array;
|
|
||||||
cb->func_array = EINA_TRUE;
|
|
||||||
_eo_callbacks_sorted_insert(pd, cb);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)array); );
|
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_ADD, (void *)array) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,108 +764,118 @@ _eo_base_event_callback_array_del(Eo *obj, Eo_Base_Data *pd,
|
||||||
{
|
{
|
||||||
Eo_Callback_Description *cb;
|
Eo_Callback_Description *cb;
|
||||||
|
|
||||||
for (cb = pd->callbacks; cb; cb = cb->next)
|
Eo_Event_Callbacks *cbs;
|
||||||
|
int count = 0;
|
||||||
|
if (!pd->callbacks) goto end;
|
||||||
|
EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
{
|
{
|
||||||
if ((cb->items.item_array == array) && (cb->func_data == user_data))
|
for (cb = cbs->callbacks; cb; cb = cb->next)
|
||||||
{
|
{
|
||||||
cb->delete_me = EINA_TRUE;
|
if ((cb->item_array == array) && (cb->func_data == user_data))
|
||||||
pd->deletions_waiting = EINA_TRUE;
|
{
|
||||||
_eo_callbacks_clear(pd);
|
cb->delete_me = EINA_TRUE;
|
||||||
|
pd->deletions_waiting = EINA_TRUE;
|
||||||
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)array); );
|
count++;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
_eo_callbacks_clear(pd);
|
||||||
|
eo_do(obj, eo_event_callback_call(EO_EV_CALLBACK_DEL, (void *)array) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
end:
|
||||||
DBG("Callback of object %p with function array %p and data %p not found.", obj, array, user_data);
|
DBG("Callback of object %p with function array %p and data %p not found.", obj, array, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_cb_desc_match(const Eo_Event_Description *a, const Eo_Event_Description *b)
|
|
||||||
{
|
|
||||||
if (!a)
|
|
||||||
return EINA_FALSE;
|
|
||||||
|
|
||||||
/* If either is legacy, fallback to string comparison. */
|
|
||||||
if ((a->doc == _legacy_event_desc) || (b->doc == _legacy_event_desc))
|
|
||||||
{
|
|
||||||
/* Take stringshare shortcut if both are legacy */
|
|
||||||
if (a->doc == b->doc)
|
|
||||||
{
|
|
||||||
return (a->name == b->name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return !strcmp(a->name, b->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (a == b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_eo_base_event_callback_call(Eo *obj_id, Eo_Base_Data *pd,
|
_eo_base_event_callback_call(Eo *obj_id, Eo_Base_Data *pd,
|
||||||
const Eo_Event_Description *desc,
|
const Eo_Event_Description *desc,
|
||||||
void *event_info)
|
void *event_info)
|
||||||
{
|
{
|
||||||
Eina_Bool ret;
|
Eina_Bool ret;
|
||||||
Eo_Callback_Description *cb;
|
Eo_Callback_Description *cb;
|
||||||
|
|
||||||
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_FALSE);
|
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_FALSE);
|
||||||
|
|
||||||
|
if(!desc){
|
||||||
|
printf("call bad event!");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pd->called_counter++;//avi debug
|
||||||
|
|
||||||
|
clock_t start_time = clock();
|
||||||
|
|
||||||
|
Eo_Event_Callbacks *cbs;
|
||||||
|
Eina_Bool found = EINA_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
Eina_Stringshare *event_name;
|
||||||
|
if (desc->doc != _legacy_event_desc)
|
||||||
|
{
|
||||||
|
|
||||||
|
event_name = eina_stringshare_add(desc->name);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
event_name = desc->name;
|
||||||
|
}
|
||||||
|
Eo_Event_Callbacks ec = { desc,event_name , NULL };
|
||||||
|
if( pd->callbacks->len < 7 ){ //if small array simple search will be faster
|
||||||
|
EINA_INARRAY_FOREACH(pd->callbacks, cbs)
|
||||||
|
{
|
||||||
|
pd->called_loop_counter++;//avi debug
|
||||||
|
// if(_cb_desc_match(desc, cbs->event))
|
||||||
|
if(event_name == cbs->event_name)
|
||||||
|
{
|
||||||
|
found = EINA_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found==EINA_FALSE) {pd->called_sum_clocks +=clock()-start_time;//avi dbg
|
||||||
|
return EINA_FALSE;}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
int index = eina_inarray_search_sorted ( pd->callbacks, &ec , _eo_base_event_compare );
|
||||||
|
|
||||||
|
if(index==-1) {pd->called_sum_clocks +=clock()-start_time;//avi dbg
|
||||||
|
return EINA_FALSE;}
|
||||||
|
|
||||||
|
cbs =eina_inarray_nth(pd->callbacks , index );
|
||||||
|
}
|
||||||
ret = EINA_TRUE;
|
ret = EINA_TRUE;
|
||||||
|
|
||||||
_eo_ref(obj);
|
_eo_ref(obj);
|
||||||
pd->walking_list++;
|
pd->walking_list++;
|
||||||
|
|
||||||
for (cb = pd->callbacks; cb; cb = cb->next)
|
for (cb = cbs->callbacks; cb; cb = cb->next)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
pd->called_loop_counter++;//avi debug
|
||||||
if (!cb->delete_me)
|
if (!cb->delete_me)
|
||||||
{
|
{
|
||||||
if (cb->func_array)
|
|
||||||
|
if (( !cb->items.item.desc->unfreezable) &&
|
||||||
|
(event_freeze_count || pd->event_freeze_count))
|
||||||
|
continue;
|
||||||
|
unsigned int before_func=clock();
|
||||||
|
/* Abort callback calling if the func says so. */
|
||||||
|
if (!cb->items.item.func((void *) cb->func_data, obj_id, desc,
|
||||||
|
(void *) event_info))
|
||||||
{
|
{
|
||||||
const Eo_Callback_Array_Item *it;
|
ret = EINA_FALSE;
|
||||||
|
start_time+=clock()-before_func;
|
||||||
for (it = cb->items.item_array; it->func; it++)
|
goto end;
|
||||||
{
|
|
||||||
if (!_cb_desc_match(it->desc, desc))
|
|
||||||
continue;
|
|
||||||
if (!it->desc->unfreezable &&
|
|
||||||
(event_freeze_count || pd->event_freeze_count))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Abort callback calling if the func says so. */
|
|
||||||
if (!it->func((void *) cb->func_data, obj_id, desc,
|
|
||||||
(void *) event_info))
|
|
||||||
{
|
|
||||||
ret = EINA_FALSE;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!_cb_desc_match(cb->items.item.desc, desc))
|
|
||||||
continue;
|
|
||||||
if ((!cb->items.item.desc
|
|
||||||
|| !cb->items.item.desc->unfreezable) &&
|
|
||||||
(event_freeze_count || pd->event_freeze_count))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Abort callback calling if the func says so. */
|
|
||||||
if (!cb->items.item.func((void *) cb->func_data, obj_id, desc,
|
|
||||||
(void *) event_info))
|
|
||||||
{
|
|
||||||
ret = EINA_FALSE;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
start_time+=clock()-before_func;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
pd->called_sum_clocks +=clock()-start_time;//avi dbg
|
||||||
|
|
||||||
pd->walking_list--;
|
pd->walking_list--;
|
||||||
_eo_callbacks_clear(pd);
|
_eo_callbacks_clear(pd);
|
||||||
_eo_unref(obj);
|
_eo_unref(obj);
|
||||||
|
@ -965,11 +1119,36 @@ EAPI const Eina_Value_Type *EO_DBG_INFO_TYPE = &_EO_DBG_INFO_TYPE;
|
||||||
/* EO_BASE_CLASS stuff */
|
/* EO_BASE_CLASS stuff */
|
||||||
#define MY_CLASS EO_BASE_CLASS
|
#define MY_CLASS EO_BASE_CLASS
|
||||||
|
|
||||||
|
static __attribute__((destructor)) void finish(void)
|
||||||
|
{
|
||||||
|
printf("calbacks stats-All objects!: num objects=%u total time=%f \
|
||||||
|
called cal times= %u called loops=%u called clocks=%f called sec=%f \
|
||||||
|
callbacks count=%u events counter=%u legacy_events_inserted=%u regular_events_inserted=%u \n",
|
||||||
|
objects_counter,(double)(clock()-start_clock)/CLOCKS_PER_SEC, called_counter,
|
||||||
|
called_loop_counter,(double)called_sum_clocks,
|
||||||
|
(double)called_sum_clocks/CLOCKS_PER_SEC, callbacks_counter ,
|
||||||
|
events_counter, legacy_events_inserted, regular_events_inserted
|
||||||
|
);//avi debug
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_eo_base_constructor(Eo *obj, Eo_Base_Data *pd EINA_UNUSED)
|
_eo_base_constructor(Eo *obj, Eo_Base_Data *pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
|
DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
|
||||||
|
|
||||||
|
pd->callbacks = eina_inarray_new(sizeof(Eo_Event_Callbacks), 10 );//added by avi
|
||||||
|
|
||||||
|
pd->called_counter=0;
|
||||||
|
pd->callbacks_counter=0;
|
||||||
|
pd-> called_loop_counter=0;
|
||||||
|
|
||||||
|
pd-> called_loop_counter=0;
|
||||||
|
|
||||||
|
pd-> called_sum_clocks =0;
|
||||||
|
pd->events_counter=0;
|
||||||
|
pd->have_events = 0;
|
||||||
|
|
||||||
_eo_condtor_done(obj);
|
_eo_condtor_done(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,14 +1158,30 @@ _eo_base_destructor(Eo *obj, Eo_Base_Data *pd)
|
||||||
Eo *child;
|
Eo *child;
|
||||||
|
|
||||||
DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
|
DBG("%p - %s.", obj, eo_class_name_get(MY_CLASS));
|
||||||
|
if( pd->callbacks_counter>0 ){//only with atleast one calllbacks
|
||||||
|
|
||||||
|
called_counter+=pd->called_counter;
|
||||||
|
callbacks_counter+=pd->callbacks_counter;
|
||||||
|
called_loop_counter+= pd->called_loop_counter;
|
||||||
|
arrays_counter+=pd->arrays_counter;
|
||||||
|
called_inner_loop_counter+=pd->called_inner_loop_counter;
|
||||||
|
called_sum_clocks+=pd-> called_sum_clocks;
|
||||||
|
events_counter+=pd->events_counter;
|
||||||
|
|
||||||
|
objects_counter++;
|
||||||
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(pd->children, child)
|
EINA_LIST_FREE(pd->children, child)
|
||||||
eo_do(child, eo_parent_set(NULL));
|
eo_do(child, eo_parent_set(NULL));
|
||||||
|
|
||||||
|
|
||||||
_eo_generic_data_del_all(pd);
|
_eo_generic_data_del_all(pd);
|
||||||
_wref_destruct(pd);
|
_wref_destruct(pd);
|
||||||
_eo_callback_remove_all(pd);
|
_eo_callback_remove_all(pd);
|
||||||
|
|
||||||
|
eina_inarray_free(pd->callbacks);//added by avi
|
||||||
|
pd->callbacks = NULL;
|
||||||
|
|
||||||
_eo_condtor_done(obj);
|
_eo_condtor_done(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue