static void bench_efl_add_jump_by_2(int request) { int i; Eo **objs = calloc(request, sizeof(Eo *)); for (i = 0 ; i < request ; i++) objs[i] = efl_add_ref(SIMPLE_CLASS, NULL); for (i = 0 ; i < request ; i += 2) efl_unref(objs[i]); for (i = 0 ; i < request ; i += 2) objs[i] = efl_add_ref(SIMPLE_CLASS, NULL); for (i = 0 ; i < request ; i++) efl_unref(objs[i]); free(objs); }
static void _efl_model_composite_boolean_children_efl_object_destructor(Eo *obj, Efl_Model_Composite_Boolean_Children_Data *pd) { if (pd->properties_names) _properties_names_array_free(pd->properties_names); if (pd->composite_child) efl_unref(pd->composite_child); efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS)); }
static void bench_eo_callbacks_add(int request) { int i; Eo *obj = efl_add_ref(SIMPLE_CLASS, NULL); for (i = 0 ; i < request ; i++) { efl_event_callback_priority_add(obj, SIMPLE_FOO, (short) i, _cb, NULL); } efl_unref(obj); }
int main(int argc, char *argv[]) { (void) argc; (void) argv; efl_object_init(); Eo *obj = efl_add(SIMPLE_CLASS, NULL); simple_a_set(obj, 1); simple_b_set(obj, 2); int a = 0, b = 0, sum = 0; a = simple_a_get(obj); b = simple_b_get(obj); sum = mixin_ab_sum_get(obj); fail_if(sum != a + b + 2); /* 2 for the two mixins... */ sum = mixin_ab_sum_get(obj); sum = mixin_ab_sum_get(obj); Mixin2_Public_Data *pd2 = efl_data_scope_get(obj, MIXIN2_CLASS); fail_if(pd2->count != 6); Mixin3_Public_Data *pd3 = efl_data_scope_get(obj, MIXIN3_CLASS); fail_if(pd3->count != 9); efl_unref(obj); obj = efl_add(INHERIT_CLASS, NULL); simple_a_set(obj, 5); a = simple_a_get(obj); printf("%d\n", a); fail_if(a != 5); efl_unref(obj); efl_object_shutdown(); return 0; }
static void bench_eo_callbacks_call(int request) { /* Distribution of calls per amount of callbacks in an object as recorded by running the genlist elementary_test test. */ const double distribution[] = { 0.2920468197, 0.2073086496, 0.217699456, 0.0207158285, 0.019707134, 0.0359433565, 0.0324896742, 0.0104299639, 0.028989003, 0.0082496801, 0.123214227, 0.0001331351, 0.0030730724 }; const int len = EINA_C_ARRAY_LENGTH(distribution); int i, j; Eo *obj[len]; for (i = 0 ; i < len ; i++) { obj[i] = efl_add_ref(SIMPLE_CLASS, NULL); for (j = 0 ; j < i ; j++) { efl_event_callback_priority_add(obj[i], SIMPLE_FOO, (short) j, _cb, NULL); } } for (i = 0 ; i < len ; i++) { for (j = 0 ; j < (int) (distribution[i] * request) ; j++) { /* Miss finding the callbacks on purpose, so we measure worst case scenario. */ efl_event_callback_call(obj[i], SIMPLE_BAR, NULL); } } for (i = 0 ; i < len ; i++) { efl_unref(obj[i]); } }
static void _teardown(void) { efl_unref(object); check_shutdown(); }
static Eina_Error _efl_net_socket_windows_operation_done(Efl_Net_Socket_Windows_Operation *op, DWORD win32err, DWORD used_size) { Efl_Net_Socket_Windows_Data *pd; Eina_Error err = 0; if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) { char *msg = _efl_net_windows_error_msg_get(win32err); DBG("op=%p (socket=%p) success_cb=%p failure_cb=%p data=%p error=%s used_size=%lu", op, op->o, op->success_cb, op->failure_cb, op->data, msg, used_size); free(msg); } op->deleting = EINA_TRUE; efl_ref(op->o); pd = efl_data_scope_get(op->o, EFL_NET_SOCKET_WINDOWS_CLASS); if (pd) pd->pending_ops = eina_list_remove(pd->pending_ops, op); if (win32err) err = op->failure_cb((void *)op->data, op->o, win32err); else op->success_cb((void *)op->data, op->o, used_size); if (op->event_handler) { if (WaitForSingleObject(pd->handle, 0) != WAIT_OBJECT_0) { DWORD used_size = 0; if (GetOverlappedResult(pd->handle, &op->base, &used_size, FALSE)) { DBG("op=%p (socket=%p) success_cb=%p failure_cb=%p data=%p GetOverlappedResult(%p, %p, &size=%lu, FALSE)", op, op->o, op->success_cb, op->failure_cb, op->data, pd->handle, &op->base, used_size); } else { win32err = GetLastError(); if (eina_log_domain_level_check(_ecore_con_log_dom, EINA_LOG_LEVEL_DBG)) { char *msg = _efl_net_windows_error_msg_get(win32err); DBG("op=%p (socket=%p) success_cb=%p failure_cb=%p data=%p GetOverlappedResult(%p, %p, &size=%lu, TRUE)=%s", op, op->o, op->success_cb, op->failure_cb, op->data, pd->handle, &op->base, used_size, msg); free(msg); } if (win32err == ERROR_IO_INCOMPLETE) { DBG("op=%p (socket=%p) success_cb=%p failure_cb=%p data=%p: still pending I/O...", op, op->o, op->success_cb, op->failure_cb, op->data); efl_unref(op->o); op->o = NULL; return 0; } } } ecore_main_win32_handler_del(op->event_handler); } #ifndef ERROR_HANDLES_CLOSED #define ERROR_HANDLES_CLOSED 676 #endif if ((win32err == ERROR_HANDLES_CLOSED) && !efl_io_closer_closed_get(op->o)) efl_io_closer_close(op->o); efl_unref(op->o); CloseHandle(op->base.hEvent); free(op); return err; }
static inline void _efl_input_pointer_free(Efl_Input_Pointer_Data *pd) { free(pd->legacy); efl_unref(pd->device); }