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)
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 364ff54..333bdee 100644
--- a/doc/eo_tutorial.dox
+++ b/doc/eo_tutorial.dox
@@ -55,10 +55,19 @@
55 * @endcode 55 * @endcode
56 * 56 *
57 * - Eo way: 57 * - Eo way:
58 * 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.
59 * This reference mechanism will be used in the future to detect bad usage of objects, defragment the memory space used by the objects...
58 * @code 60 * @code
59 * Evas_Object_Line *o = eo_data_get(obj, EVAS_OBJ_LINE_CLASS); 61 * Evas_Object_Line *o = eo_data_scope_get(obj, EVAS_OBJ_LINE_CLASS);
60 * if (!o) return; 62 * if (!o) return;
61 * @endcode 63 * @endcode
64 * or
65 * @code
66 * Evas_Object_Line *o = eo_data_ref(obj, EVAS_OBJ_LINE_CLASS);
67 * if (!o) return;
68 * ...
69 * eo_data_unref(obj, o);
70 * @endcode
62 * 71 *
63 * - Call function of parent 72 * - Call function of parent
64 * - Old way: 73 * - Old way:
@@ -74,10 +83,12 @@
74 * @section Important to know 83 * @section Important to know
75 * - eo_do() is the function used to invoke functions of a specific class on an object. 84 * - eo_do() is the function used to invoke functions of a specific class on an object.
76 * 85 *
77 * - 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. 86 * - 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.
78 * 87 *
88 * - eo_data_unref() receives an object and the data to unreference. The data MUST belong to this object.
89 *
79 * - eo_isa() indicates if a given object is of a given type. 90 * - eo_isa() indicates if a given object is of a given type.
80 * 91 *
81 * - 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 92 * - 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
82 * 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. 93 * 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.
83 * 94 *
@@ -242,7 +253,7 @@
242 * Evas_Coord *x2 = va_arg(*list, Evas_Coord *); 253 * Evas_Coord *x2 = va_arg(*list, Evas_Coord *);
243 * Evas_Coord *y2 = va_arg(*list, Evas_Coord *); 254 * Evas_Coord *y2 = va_arg(*list, Evas_Coord *);
244 * 255 *
245 * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 256 * Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
246 * if (x1) *x1 = obj->cur.geometry.x + o->cur.x1; 257 * if (x1) *x1 = obj->cur.geometry.x + o->cur.x1;
247 * if (y1) *y1 = obj->cur.geometry.y + o->cur.y1; 258 * if (y1) *y1 = obj->cur.geometry.y + o->cur.y1;
248 * if (x2) *x2 = obj->cur.geometry.x + o->cur.x2; 259 * if (x2) *x2 = obj->cur.geometry.x + o->cur.x2;
@@ -254,7 +265,7 @@
254 * { 265 * {
255 * eo_do_super(eo_obj, eo_constructor()); 266 * eo_do_super(eo_obj, eo_constructor());
256 * 267 *
257 * Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 268 * Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
258 * evas_object_line_init(eo_obj); 269 * evas_object_line_init(eo_obj);
259 * } 270 * }
260 * 271 *