evas_object_intercept: Reduce calls to efl_data_scope_get

Small patch to reduce the number of calls to efl_data_scope_get as per
mailing list discussion. Since the
EVAS_OBJECT_INTERCEPT_CALLBACK_DEFINE macro already retrieves the
protected data via efl_data_scope_get, we can just pass that
protected data directly to evas_object_intercept_init/deinit functions
without the need to refetch it.

Differential Revision: https://phab.enlightenment.org/D11449
This commit is contained in:
Christopher Michael 2020-03-05 08:24:46 -05:00 committed by Marcel Hollerbach
parent c2c2a4b04f
commit fc044b94e5
1 changed files with 6 additions and 11 deletions

View File

@ -9,25 +9,20 @@
/* local calls */
static void evas_object_intercept_init(Evas_Object *eo_obj);
static void evas_object_intercept_deinit(Evas_Object *eo_obj);
static void evas_object_intercept_init(Evas_Object_Protected_Data *obj);
static void evas_object_intercept_deinit(Evas_Object_Protected_Data *obj);
static void
evas_object_intercept_init(Evas_Object *eo_obj)
evas_object_intercept_init(Evas_Object_Protected_Data *obj)
{
Evas_Object_Protected_Data *obj;
obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (!obj) return;
if (!obj->interceptors)
obj->interceptors = calloc(1, sizeof(Evas_Intercept_Func));
}
static void
evas_object_intercept_deinit(Evas_Object *eo_obj)
evas_object_intercept_deinit(Evas_Object_Protected_Data *obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
if (!obj || !obj->interceptors) return;
if ((obj->interceptors->show.func) ||
(obj->interceptors->hide.func) ||
@ -270,7 +265,7 @@ _evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj,
MAGIC_CHECK_END(); \
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); \
if (!func) return; \
evas_object_intercept_init(eo_obj); \
evas_object_intercept_init(obj); \
if (!obj->interceptors) return; \
obj->interceptors->Lower_Type.func = func; \
obj->interceptors->Lower_Type.data = (void *)data; \
@ -291,7 +286,7 @@ _evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj,
obj->interceptors->Lower_Type.func = NULL; \
data = obj->interceptors->Lower_Type.data; \
obj->interceptors->Lower_Type.data = NULL; \
evas_object_intercept_deinit(eo_obj); \
evas_object_intercept_deinit(obj); \
return data; \
}