summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2013-03-20 08:56:15 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2013-05-01 10:37:08 +0300
commitf6a37f88d26a4a00c50f38d078b4047c24992bcb (patch)
tree0c212f61728c0072a717f2feffd780e5ba5b82dc /doc
parentdee226221447fad70c8e847014f34789d207a549 (diff)
downloadefl-f6a37f88d26a4a00c50f38d078b4047c24992bcb.tar.gz
Eo: Add reference functions for objects data
We want to introduce a new mechanism concerning the data of the Eo objects. The goal is to improve the memory management by defragmenting the memory banks used by the Eo objects. The first phase has been done by raster and consists in allocating the objects into a separate memory region that the one used by malloc. So now, we know where our objects are located. Now, moving objects means moving data of objects. The issue we have here is that a lot of data pointers are stored into data of other objects, e.g Evas Object data into lists for rendering... We need a way to reference the data and eo_data_get doesn't provide us that. So we need to improve the API for data extraction by requesting from the developer if the data will be stored or not. Five functions are supplied: - eo_data_scope_get: no referencing, the data pointer is no more used after exiting the function. - eo_data_ref: reference the data of the object. It means that while the data is referenced, the object cannot be moved. - eo_data_xref: reference the data of the object but for debug purpose, we associate the objects that references. Same behavior as eo_data_ref for non-debug. - eo_data_unref: unreference the data of an object. - eo_data_xunref: unreference the data of an object previously referenced by another object. I deprecated the eo_data_get function. Most of the time, eo_data_scope_get needs to be used. In the next patches, I changed the eo_data_get to the corresponding functions, according to the usage of the data pointer. The next step is to find all the places in the code where the data is stored but not yet referenced. This will be done by: - requesting from every object to unreference all data to other objects. - moving all the objects from one region to another - requesting from every object to rerefenrence the data. - debugging by hunting the segmentation faults and other weird creatures.
Diffstat (limited to 'doc')
-rw-r--r--doc/eo_tutorial.dox23
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/eo_tutorial.dox b/doc/eo_tutorial.dox
index 364ff54151..333bdee907 100644
--- a/doc/eo_tutorial.dox
+++ b/doc/eo_tutorial.dox
@@ -55,10 +55,19 @@
* @endcode
*
* - Eo way:
+ * Two functions can be used to extract object data. The use depends if you want to store the data or not. If you just need to access data in the function (most of the time), just use eo_data_scope_get. If you need to store the data (for example in a list of objects data), you have to use eo_data_ref. This function references the data. If you don't need the referenced data anymore, call eo_data_unref.
+ * This reference mechanism will be used in the future to detect bad usage of objects, defragment the memory space used by the objects...
* @code
- * Evas_Object_Line *o = eo_data_get(obj, EVAS_OBJ_LINE_CLASS);
+ * Evas_Object_Line *o = eo_data_scope_get(obj, EVAS_OBJ_LINE_CLASS);
* if (!o) return;
* @endcode
+ * or
+ * @code
+ * Evas_Object_Line *o = eo_data_ref(obj, EVAS_OBJ_LINE_CLASS);
+ * if (!o) return;
+ * ...
+ * eo_data_unref(obj, o);
+ * @endcode
*
* - Call function of parent
* - Old way:
@@ -74,10 +83,12 @@
* @section Important to know
* - eo_do() is the function used to invoke functions of a specific class on an object.
*
- * - eo_data_get() receives an object and a class and returns the data of the given class for the object. The class must belong to the object class hierarchy.
- *
+ * - eo_data_scope_get() and eo_data_ref() receives an object and a class and returns the data of the given class for the object. The class must belong to the object class hierarchy.
+ *
+ * - eo_data_unref() receives an object and the data to unreference. The data MUST belong to this object.
+ *
* - eo_isa() indicates if a given object is of a given type.
- *
+ *
* - eo_do_super() is in charge to invoke a function in the next parents that implement it. It is recommended to use eo_do_super() only from a function with the same op id.\n
* In addition, there is no way to jump over classes who implement the function. If A inherits from B, B from C and A, B and C implement a virtual function defined in C, the function calls order will be A, then B and finally C. It is impossible to pass over B.
*
@@ -242,7 +253,7 @@
* Evas_Coord *x2 = va_arg(*list, Evas_Coord *);
* Evas_Coord *y2 = va_arg(*list, Evas_Coord *);
*
- * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
+ * Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
* if (x1) *x1 = obj->cur.geometry.x + o->cur.x1;
* if (y1) *y1 = obj->cur.geometry.y + o->cur.y1;
* if (x2) *x2 = obj->cur.geometry.x + o->cur.x2;
@@ -254,7 +265,7 @@
* {
* eo_do_super(eo_obj, eo_constructor());
*
- * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
+ * Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
* evas_object_line_init(eo_obj);
* }
*