cedric pushed a commit to branch master.

commit 16090555795a7d57c350f56c51df284a836300a8
Author: Cedric Bail <[email protected]>
Date:   Tue Jun 18 11:43:16 2013 +0900

    evas: reduce memory footprint taken by Evas_Object_Table callbacks setup.
    
    This reduce by 50K elemines memory use on 32bits system.
---
 ChangeLog                               |  2 +-
 NEWS                                    |  2 +-
 src/lib/evas/canvas/evas_object_table.c | 30 +++++++++++++++++-------------
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 295c122..2dc8a14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2013-06-18  Cedric Bail
 
-       * Evas: Use Eo array of callbacks to reduce edje memory foot print of 
Evas_Object_Box.
+       * Evas: Use Eo array of callbacks to reduce edje memory foot print of 
Evas_Object_Box and Evas_Object_Table.
 
 2013-06-17  Sung W. Park (sung_)
 
diff --git a/NEWS b/NEWS
index 5781dc5..c8c2758 100644
--- a/NEWS
+++ b/NEWS
@@ -189,7 +189,7 @@ Improvements:
     * Evas gl engine - dont map dri/drm buffer unless we are going to render.
     * Partial rendering support in evas for several gl drivers.
     * edje: use eo array of callbacks to reduce callbacks memory footprint.
-    * evas: use eo array of callbacks to reduce callbacks memory footprint of 
Evas_Object_Box.
+    * evas: use eo array of callbacks to reduce callbacks memory footprint of 
Evas_Object_Box and Evas_Object_Table.
 
 Fixes:
     * Fix a memory leak in ecore_con_dns when using ecore_con_server_connect
diff --git a/src/lib/evas/canvas/evas_object_table.c 
b/src/lib/evas/canvas/evas_object_table.c
index 1d582d8..57e7dc6 100644
--- a/src/lib/evas/canvas/evas_object_table.c
+++ b/src/lib/evas/canvas/evas_object_table.c
@@ -245,38 +245,42 @@ _evas_object_table_option_del(Evas_Object *o)
    return evas_object_data_del(o, EVAS_OBJECT_TABLE_OPTION_KEY);
 }
 
-static void
-_on_child_del(void *data, Evas *evas EINA_UNUSED, Evas_Object *child, void 
*einfo EINA_UNUSED)
+static Eina_Bool
+_on_child_del(void *data, Eo *child, const Eo_Event_Description *desc 
EINA_UNUSED, void *einfo EINA_UNUSED)
 {
    Evas_Object *table = data;
    evas_object_table_unpack(table, child);
+
+   return EO_CALLBACK_CONTINUE;
 }
 
-static void
-_on_child_hints_changed(void *data, Evas *evas EINA_UNUSED, Evas_Object *child 
EINA_UNUSED, void *einfo EINA_UNUSED)
+static Eina_Bool
+_on_child_hints_changed(void *data, Eo *child EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *einfo EINA_UNUSED)
 {
    Evas_Object *table = data;
-   EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN(table, priv);
+   EVAS_OBJECT_TABLE_DATA_GET_OR_RETURN_VAL(table, priv, EO_CALLBACK_CONTINUE);
    _evas_object_table_cache_invalidate(priv);
    evas_object_smart_changed(table);
+
+   return EO_CALLBACK_CONTINUE;
 }
 
+static const Eo_Callback_Array_Item evas_object_table_callbacks[] = {
+  { EVAS_OBJECT_EVENT_DEL, _on_child_del },
+  { EVAS_OBJECT_EVENT_CHANGED_SIZE_HINTS, _on_child_hints_changed },
+  { NULL, NULL }
+};
+
 static void
 _evas_object_table_child_connect(Evas_Object *o, Evas_Object *child)
 {
-   evas_object_event_callback_add
-     (child, EVAS_CALLBACK_DEL, _on_child_del, o);
-   evas_object_event_callback_add
-     (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_child_hints_changed, o);
+   eo_do(child, eo_event_callback_array_add(evas_object_table_callbacks, o));
 }
 
 static void
 _evas_object_table_child_disconnect(Evas_Object *o, Evas_Object *child)
 {
-   evas_object_event_callback_del_full
-     (child, EVAS_CALLBACK_DEL, _on_child_del, o);
-   evas_object_event_callback_del_full
-     (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_child_hints_changed, o);
+   eo_do(child, eo_event_callback_array_del(evas_object_table_callbacks, o));
 }
 
 static void

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to