summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-24 14:47:34 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-04-24 14:47:34 -0300
commit586d5601d211c68a9619b1ae83969c39701059bd (patch)
tree10a8a0cc3da5a5dfced72ef8957875dac0eb8fd8
parent44ae5646bb584d00619df20317afb20f67beb629 (diff)
eo: minor optimization yet to be profiled WIP
-rw-r--r--src/lib/eo/eo.c4
-rw-r--r--src/lib/eo/eo_base_class.c6
-rw-r--r--src/lib/eo/eo_private.h1
3 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 3ce21695de..770ac00dc5 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -1933,7 +1933,7 @@ efl_ref(const Eo *obj_id)
1933 ++(obj->user_refcount); 1933 ++(obj->user_refcount);
1934 if (EINA_UNLIKELY(obj->user_refcount == 1)) 1934 if (EINA_UNLIKELY(obj->user_refcount == 1))
1935 _efl_ref(obj); 1935 _efl_ref(obj);
1936 else if (!obj->auto_unref && obj->user_refcount == 2) 1936 else if (obj->ownership_track && !obj->auto_unref && obj->user_refcount == 2)
1937 efl_event_callback_call((Eo *) obj_id, EFL_EVENT_OWNERSHIP_SHARED, NULL); 1937 efl_event_callback_call((Eo *) obj_id, EFL_EVENT_OWNERSHIP_SHARED, NULL);
1938 1938
1939#ifdef EO_DEBUG 1939#ifdef EO_DEBUG
@@ -1994,7 +1994,7 @@ efl_unref(const Eo *obj_id)
1994 } 1994 }
1995 _efl_unref(obj); 1995 _efl_unref(obj);
1996 } 1996 }
1997 else if (obj->user_refcount == 1) 1997 else if (obj->ownership_track && obj->user_refcount == 1)
1998 { 1998 {
1999 efl_event_callback_call((Eo *) obj_id, EFL_EVENT_OWNERSHIP_UNIQUE, NULL); 1999 efl_event_callback_call((Eo *) obj_id, EFL_EVENT_OWNERSHIP_UNIQUE, NULL);
2000 } 2000 }
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 2dc5efcec5..62a1caf9a2 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -1179,6 +1179,12 @@ _special_event_count_inc(Eo *obj_id, Efl_Object_Data *pd, const Efl_Callback_Arr
1179 } 1179 }
1180 else if (it->desc == EFL_EVENT_DESTRUCT) 1180 else if (it->desc == EFL_EVENT_DESTRUCT)
1181 pd->has_destroyed_event_cb = EINA_TRUE; 1181 pd->has_destroyed_event_cb = EINA_TRUE;
1182 else if (it->desc == EFL_EVENT_OWNERSHIP_SHARED || it->desc == EFL_EVENT_OWNERSHIP_UNIQUE)
1183 {
1184 EO_OBJ_POINTER_RETURN(obj_id, obj);
1185 obj->ownership_track = EINA_TRUE;
1186 EO_OBJ_DONE(obj_id);
1187 }
1182} 1188}
1183 1189
1184static inline void 1190static inline void
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 3b046bb302..c64dee5f5e 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -126,6 +126,7 @@ struct _Eo_Object
126 Eina_Bool destructed:1; 126 Eina_Bool destructed:1;
127 Eina_Bool manual_free:1; 127 Eina_Bool manual_free:1;
128 unsigned char auto_unref : 1; // unref after 1 call - hack for parts 128 unsigned char auto_unref : 1; // unref after 1 call - hack for parts
129 Eina_Bool ownership_track:1;
129}; 130};
130 131
131/* How we search and store the implementations in classes. */ 132/* How we search and store the implementations in classes. */