jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=05cc5ab940caaf0612ac246c468fbb48144dbe02

commit 05cc5ab940caaf0612ac246c468fbb48144dbe02
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Feb 17 18:46:09 2017 +0900

    evas: Avoid useless calls to eo_data_scope_get
    
    Use an internal variant of the function for evas when we already
    have the protected data pointer.
---
 src/lib/evas/canvas/evas_clip.c             |  4 +-
 src/lib/evas/canvas/evas_focus.c            |  9 ++-
 src/lib/evas/canvas/evas_layer.c            |  6 +-
 src/lib/evas/canvas/evas_object_intercept.c | 87 ++++++++++++++++++-----------
 src/lib/evas/canvas/evas_object_main.c      |  8 +--
 src/lib/evas/canvas/evas_stack.c            | 14 ++---
 src/lib/evas/include/evas_private.h         |  2 +
 7 files changed, 74 insertions(+), 56 deletions(-)

diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c
index 11d7c8e..494e13d 100644
--- a/src/lib/evas/canvas/evas_clip.c
+++ b/src/lib/evas/canvas/evas_clip.c
@@ -332,7 +332,7 @@ _efl_canvas_object_clip_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, Evas_Ob
      }
 
    if (_efl_canvas_object_clip_set_block(eo_obj, obj, eo_clip, clip)) return;
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 
1, eo_clip)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 1, eo_clip)) return;
 
    if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class &&
        obj->smart.smart->smart_class->clip_set)
@@ -430,7 +430,7 @@ static void
 _clip_unset(Eo *eo_obj, Evas_Object_Protected_Data *obj)
 {
    if (_efl_canvas_object_clip_unset_block(eo_obj, obj)) return;
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 
1, NULL)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 1, NULL)) return;
    if (obj->is_smart && obj->smart.smart && obj->smart.smart->smart_class &&
        obj->smart.smart->smart_class->clip_unset)
      {
diff --git a/src/lib/evas/canvas/evas_focus.c b/src/lib/evas/canvas/evas_focus.c
index cae966a..d700e2c 100644
--- a/src/lib/evas/canvas/evas_focus.c
+++ b/src/lib/evas/canvas/evas_focus.c
@@ -134,9 +134,8 @@ _efl_canvas_object_seat_focus_del(Eo *eo_obj,
      {
         if (dev != seat)
           continue;
-        if (_evas_object_intercept_call(eo_obj,
-                                        EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
-                                        1, EINA_FALSE))
+        if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
+                                             1, EINA_FALSE))
           {
              return EINA_FALSE;
           }
@@ -175,8 +174,8 @@ _efl_canvas_object_seat_focus_add(Eo *eo_obj,
    if (_already_focused(obj->focused_by_seats, seat))
      goto end;
 
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
-                                   1, EINA_TRUE))
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET,
+                                        1, EINA_TRUE))
      {
         return EINA_FALSE;
      }
diff --git a/src/lib/evas/canvas/evas_layer.c b/src/lib/evas/canvas/evas_layer.c
index 86496c4..11bbe03 100644
--- a/src/lib/evas/canvas/evas_layer.c
+++ b/src/lib/evas/canvas/evas_layer.c
@@ -216,15 +216,13 @@ evas_object_layer_set(Evas_Object *obj, short l)
 }
 
 EOLIAN void
-_efl_canvas_object_efl_gfx_stack_layer_set(Eo *eo_obj,
-                                     Evas_Object_Protected_Data *obj,
-                                     short l)
+_efl_canvas_object_efl_gfx_stack_layer_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, short l)
 {
    Evas *eo_e;
 
    if (obj->delete_me) return;
    evas_object_async_block(obj);
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_LAYER_SET, 
1, l)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_LAYER_SET, 1, l)) return;
    if (obj->smart.parent) return;
    if (obj->cur->layer == l)
      {
diff --git a/src/lib/evas/canvas/evas_object_intercept.c 
b/src/lib/evas/canvas/evas_object_intercept.c
index faeedee..da774e2 100644
--- a/src/lib/evas/canvas/evas_object_intercept.c
+++ b/src/lib/evas/canvas/evas_object_intercept.c
@@ -82,31 +82,24 @@ EVAS_OBJECT_INTERCEPT_CALL(focus_set,   (COMMON_ARGS, int 
focus), UNPACK_ARG1(fo
 EVAS_OBJECT_INTERCEPT_CALL(color_set,   (COMMON_ARGS, int r, int g, int b, int 
a), UNPACK_ARG4(r, g, b, a))
 EVAS_OBJECT_INTERCEPT_CALL(clip_set,    (COMMON_ARGS, Evas_Object *clip), 
UNPACK_ARG1(clip))
 
-
-/* This is a legacy-only compatibility function.
- * Made public for other parts of EFL (elm, ecore_evas).
- */
-EWAPI Eina_Bool
-_evas_object_intercept_call(Evas_Object *eo_obj, Evas_Object_Intercept_Cb_Type 
cb_type,
-                            int internal, ...)
+static Eina_Bool
+_evas_object_intercept_call_internal(Evas_Object *eo_obj,
+                                     Evas_Object_Protected_Data *obj,
+                                     Evas_Object_Intercept_Cb_Type cb_type,
+                                     int internal, va_list args)
 {
-   Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, 
EFL_CANVAS_OBJECT_CLASS);
    Eina_Bool blocked = 0;
    Evas_Object *eo_other;
    int r, g, b, a, i, j;
-   va_list args;
 
-   EVAS_OBJECT_DATA_ALIVE_CHECK(obj, 1);
    evas_object_async_block(obj);
 
-   va_start(args, internal);
-
    switch (cb_type)
      {
       case EVAS_OBJECT_INTERCEPT_CB_VISIBLE:
         i = !!va_arg(args, int);
-        if (i == obj->cur->visible) goto end_block;
-        if (!obj->interceptors) goto end_noblock;
+        if (i == obj->cur->visible) return 1;
+        if (!obj->interceptors) return 0;
         if (i) blocked = evas_object_intercept_call_show(eo_obj, obj);
         else blocked = evas_object_intercept_call_hide(eo_obj, obj);
         break;
@@ -116,7 +109,7 @@ _evas_object_intercept_call(Evas_Object *eo_obj, 
Evas_Object_Intercept_Cb_Type c
           {
              WRN("evas_object_move() called on object %p (%s) in the middle "
                  "of moving the same object", eo_obj, 
efl_class_name_get(eo_obj));
-             goto end_block;
+             return 1;
           }
         i = va_arg(args, int);
         j = va_arg(args, int);
@@ -133,47 +126,47 @@ _evas_object_intercept_call(Evas_Object *eo_obj, 
Evas_Object_Intercept_Cb_Type c
         i = va_arg(args, int);
         j = va_arg(args, int);
         if (_efl_canvas_object_efl_gfx_size_set_block(eo_obj, obj, i, j, 
internal))
-          goto end_block;
-        if (!obj->interceptors) goto end_noblock;
+          return 1;
+        if (!obj->interceptors) return 0;
         blocked = evas_object_intercept_call_resize(eo_obj, obj, i, j);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_RAISE:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         blocked = evas_object_intercept_call_raise(eo_obj, obj);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_LOWER:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         blocked = evas_object_intercept_call_lower(eo_obj, obj);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_STACK_ABOVE:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         eo_other = va_arg(args, Evas_Object *);
         blocked = evas_object_intercept_call_stack_above(eo_obj, obj, 
eo_other);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_STACK_BELOW:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         eo_other = va_arg(args, Evas_Object *);
         blocked = evas_object_intercept_call_stack_below(eo_obj, obj, 
eo_other);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_LAYER_SET:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         i = va_arg(args, int);
         blocked = evas_object_intercept_call_layer_set(eo_obj, obj, i);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_FOCUS_SET:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         i = va_arg(args, int);
         blocked = evas_object_intercept_call_focus_set(eo_obj, obj, !!i);
         break;
 
       case EVAS_OBJECT_INTERCEPT_CB_COLOR_SET:
-        if (!obj->interceptors) goto end_noblock;
+        if (!obj->interceptors) return 0;
         r = va_arg(args, int);
         g = va_arg(args, int);
         b = va_arg(args, int);
@@ -188,9 +181,9 @@ _evas_object_intercept_call(Evas_Object *eo_obj, 
Evas_Object_Intercept_Cb_Type c
              if (!internal)
                {
                   if (_efl_canvas_object_clip_set_block(eo_obj, obj, eo_other, 
NULL))
-                    goto end_block;
+                    return 1;
                }
-             if (!obj->interceptors) goto end_noblock;
+             if (!obj->interceptors) return 0;
              blocked = evas_object_intercept_call_clip_set(eo_obj, obj, 
eo_other);
           }
         else
@@ -198,24 +191,52 @@ _evas_object_intercept_call(Evas_Object *eo_obj, 
Evas_Object_Intercept_Cb_Type c
              if (!internal)
                {
                   if (_efl_canvas_object_clip_unset_block(eo_obj, obj))
-                    goto end_block;
+                    return 1;
                }
-             if (!obj->interceptors) goto end_noblock;
+             if (!obj->interceptors) return 0;
              blocked = evas_object_intercept_call_clip_unset(eo_obj, obj);
           }
         break;
      }
 
-   va_end(args);
    return blocked;
+}
+
+/* This is a legacy-only compatibility function.
+ * Made public for other parts of EFL (elm, ecore_evas).
+ */
+EWAPI Eina_Bool
+_evas_object_intercept_call(Evas_Object *eo_obj, Evas_Object_Intercept_Cb_Type 
cb_type,
+                            int internal, ...)
+{
+   Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, 
EFL_CANVAS_OBJECT_CLASS);
+   Eina_Bool ret;
+   va_list args;
+
+   EVAS_OBJECT_DATA_ALIVE_CHECK(obj, 1);
 
-end_block:
+   va_start(args, internal);
+   ret = _evas_object_intercept_call_internal(eo_obj, obj, cb_type, internal, 
args);
    va_end(args);
-   return 1;
 
-end_noblock:
+   return ret;
+}
+
+Eina_Bool
+_evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj,
+                                 Evas_Object_Intercept_Cb_Type cb_type,
+                                 int internal, ...)
+{
+   Eina_Bool ret;
+   va_list args;
+
+   EVAS_OBJECT_DATA_ALIVE_CHECK(obj, 1);
+
+   va_start(args, internal);
+   ret = _evas_object_intercept_call_internal(obj->object, obj, cb_type, 
internal, args);
    va_end(args);
-   return 0;
+
+   return ret;
 }
 
 /* public calls */
diff --git a/src/lib/evas/canvas/evas_object_main.c 
b/src/lib/evas/canvas/evas_object_main.c
index b8f2a84..c650876 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -1143,7 +1143,7 @@ _efl_canvas_object_efl_gfx_position_set(Eo *eo_obj, 
Evas_Object_Protected_Data *
    Eina_Bool source_invisible = EINA_FALSE;
    Eina_List *was = NULL;
 
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 1, 
x, y))
+   if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 1, 
x, y))
      return;
 
    Evas_Map *map;
@@ -1230,7 +1230,7 @@ _efl_canvas_object_efl_gfx_size_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj,
    if (w < 0) w = 0;
    if (h < 0) h = 0;
 
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 1, 
w, h))
+   if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 
1, w, h))
      return;
 
    if (!(obj->layer->evas->is_frozen))
@@ -1818,7 +1818,7 @@ EOLIAN static void
 _efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data 
*obj,
                                        Eina_Bool vis)
 {
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 
1, vis))
+   if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 
1, vis))
      return;
 
    if (vis) _show(eo_obj, obj);
@@ -1850,7 +1850,7 @@ _efl_canvas_object_efl_gfx_color_set(Eo *eo_obj, 
Evas_Object_Protected_Data *obj
    if (EVAS_COLOR_SANITIZE(r, g, b, a))
      ERR("Evas only handles premultiplied colors (0 <= R,G,B <= A <= 255)");
 
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, 
1, r, g, b, a)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_COLOR_SET, 1, r, g, b, a)) return;
    if ((obj->cur->color.r == r) &&
        (obj->cur->color.g == g) &&
        (obj->cur->color.b == b) &&
diff --git a/src/lib/evas/canvas/evas_stack.c b/src/lib/evas/canvas/evas_stack.c
index 879dafd..55a46b0 100644
--- a/src/lib/evas/canvas/evas_stack.c
+++ b/src/lib/evas/canvas/evas_stack.c
@@ -46,8 +46,8 @@ evas_object_raise(Evas_Object *obj)
 EOLIAN void
 _efl_canvas_object_efl_gfx_stack_raise(Eo *eo_obj, Evas_Object_Protected_Data 
*obj)
 {
-   evas_object_async_block(obj);
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_RAISE, 1)) 
return;
+   if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_RAISE, 
1))
+     return;
 
    if (!((EINA_INLIST_GET(obj))->next))
      {
@@ -95,8 +95,8 @@ evas_object_lower(Evas_Object *obj)
 EOLIAN void
 _efl_canvas_object_efl_gfx_stack_lower(Eo *eo_obj, Evas_Object_Protected_Data 
*obj)
 {
-   evas_object_async_block(obj);
-   if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_LOWER, 1)) 
return;
+   if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_LOWER, 
1))
+     return;
 
    if (!((EINA_INLIST_GET(obj))->prev))
      {
@@ -145,14 +145,13 @@ evas_object_stack_above(Evas_Object *obj, Evas_Object 
*above)
 EOLIAN void
 _efl_canvas_object_efl_gfx_stack_stack_above(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, Efl_Gfx_Stack *eo_above)
 {
-   evas_object_async_block(obj);
    if (!eo_above)
      {
         evas_object_raise(eo_obj);
         return;
      }
    if (eo_obj == eo_above) return;
-   if (_evas_object_intercept_call(eo_obj, 
EVAS_OBJECT_INTERCEPT_CB_STACK_ABOVE, 1, eo_above)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_STACK_ABOVE, 1, eo_above)) return;
    Evas_Object_Protected_Data *above = efl_data_scope_get(eo_above, 
EFL_CANVAS_OBJECT_CLASS);
    if ((EINA_INLIST_GET(obj))->prev == EINA_INLIST_GET(above))
      {
@@ -223,14 +222,13 @@ evas_object_stack_below(Evas_Object *obj, Evas_Object 
*below)
 EOLIAN void
 _efl_canvas_object_efl_gfx_stack_stack_below(Eo *eo_obj, 
Evas_Object_Protected_Data *obj, Efl_Gfx_Stack *eo_below)
 {
-   evas_object_async_block(obj);
    if (!eo_below)
      {
         evas_object_lower(eo_obj);
         return;
      }
    if (eo_obj == eo_below) return;
-   if (_evas_object_intercept_call(eo_obj, 
EVAS_OBJECT_INTERCEPT_CB_STACK_BELOW, 1, eo_below)) return;
+   if (_evas_object_intercept_call_evas(obj, 
EVAS_OBJECT_INTERCEPT_CB_STACK_BELOW, 1, eo_below)) return;
    Evas_Object_Protected_Data *below = efl_data_scope_get(eo_below, 
EFL_CANVAS_OBJECT_CLASS);
    if ((EINA_INLIST_GET(obj))->next == EINA_INLIST_GET(below))
      {
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 7573acd..0aad234 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1729,6 +1729,8 @@ void evas_text_style_pad_get(Evas_Text_Style_Type style, 
int *l, int *r, int *t,
 void _evas_object_text_rehint(Evas_Object *obj);
 void _evas_object_textblock_rehint(Evas_Object *obj);
 
+Eina_Bool _evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj, 
Evas_Object_Intercept_Cb_Type cb_type, int internal, ...);
+
 void evas_unref_queue_image_put(Evas_Public_Data *pd, void *image);
 void evas_unref_queue_glyph_put(Evas_Public_Data *pd, void *glyph);
 void evas_unref_queue_texts_put(Evas_Public_Data *pd, void *glyph);

-- 


Reply via email to