eo: Move hacky API auto_unref to C only
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 5 Dec 2017 05:31:22 +0000 (14:31 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 5 Dec 2017 06:06:34 +0000 (15:06 +0900)
This API is meant to be used by parts only, and by bindings dealing with
part objects. This patch fixes make check which got broken in the after
the previous one (cxx).

13 files changed:
src/bindings/cxx/eo_cxx/efl_object_impl.hh
src/lib/edje/edje_part_helper.h
src/lib/edje/edje_private.h
src/lib/efl/cxx/efl_part_impl.hh
src/lib/elementary/elementary_config.h
src/lib/elementary/elm_part_helper.h
src/lib/eo/Eo.h
src/lib/eo/efl_object.eo
src/lib/eo/eo.c
src/lib/eo/eo_base_class.c
src/lib/eo/eo_private.h
src/lib/eolian_cxx/grammar/part_implementation.hpp
src/tests/eo/suite/eo_test_general.c

index ce61ed6..734ed17 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef EFL_OBJECT_MANUAL_IMPL_HH
 #define EFL_OBJECT_MANUAL_IMPL_HH
 
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
-
 // Skip del. Must be implemented in eo::concrete.
 #define EOLIAN_CXX_EFL_DEL_DECLARATION
 #define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION
index c2b184f..671bf65 100644 (file)
@@ -101,7 +101,7 @@ end: \
    __VA_ARGS__; \
    if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \
    efl_allow_parent_unref_set(proxy, 1); \
-   efl_auto_unref_set(proxy, 1); \
+   ___efl_auto_unref_set(proxy, 1); \
    return proxy; \
 }
 
index 3dc4634..c5238b3 100644 (file)
@@ -40,8 +40,6 @@
 #endif
 
 // auto_unref
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
 #define EDJE_OBJECT_BETA
 #define EFL_CANVAS_OBJECT_PROTECTED
 #define EFL_CANVAS_LAYOUT_CALC_PROTECTED
index f40292c..b97dda1 100644 (file)
@@ -8,7 +8,7 @@
 inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \
 { \
    ::Eo *handle = ::efl_part(_eo_ptr(), name.c_str()); \
-   ::efl_auto_unref_set(handle, false); \
+   ::___efl_auto_unref_set(handle, false); \
    return ::efl::Object{handle}; \
 }
 
index b062509..3830254 100644 (file)
@@ -15,8 +15,6 @@
 #define EFL_CANVAS_OBJECT_PROTECTED
 #define EFL_CANVAS_GROUP_PROTECTED
 #define EFL_CANVAS_GROUP_BETA
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
 #define EFL_ACCESS_BETA
 #define EFL_ACCESS_COMPONENT_BETA
 #define EFL_ACCESS_EDITABLE_TEXT_BETA
index 25001d7..858dbb4 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef _ELM_PART_HELPER_H
 #define _ELM_PART_HELPER_H
 
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
-
 #include "Elementary.h"
 #include "elm_priv.h"
 #include "efl_ui_layout_part_legacy.eo.h"
@@ -75,7 +72,7 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
 
    EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL);
    efl_allow_parent_unref_set(proxy, 1);
-   efl_auto_unref_set(proxy, 1);
+   ___efl_auto_unref_set(proxy, 1);
    pd->part = eina_tmpstr_add(part);
    pd->obj = obj;
 
index b3ba90a..e7e4bc3 100644 (file)
@@ -2144,6 +2144,7 @@ EAPI Eina_Iterator *eo_objects_iterator_new(void);
    /* Private for EFL internal use only. Do not use these! */
 EAPI int ___efl_ref2_count(const Eo *obj_id);
 EAPI void ___efl_ref2_reset(const Eo *obj_id);
+EAPI void ___efl_auto_unref_set(Eo *obj_id, Eina_Bool val);
 
 #endif
 
index 951a574..1b7c075 100644 (file)
@@ -279,29 +279,6 @@ abstract Efl.Object ()
                even if @.parent is not $null.]]
          }
       }
-      @property auto_unref @protected @beta {
-         [[Mark an object to be automatically deleted after a function call.
-
-           This becomes effectives only after finalize is done. After any EO
-           function has been called on this object, it will be unref'ed. This
-           property will also be reset to $false. This is intended to simplify
-           Part objects lifecycle.
-
-           Note: This applies to any EO function call, even if the object was
-           of the wrong type (call resolution failed).
-
-           This is a write-only property as reading it would unref the object,
-           and reset the flag.
-
-           Warning: This is a beta API, do not use it unless you know exactly
-           what you are doing.
-         ]]
-         set {}
-         values {
-            enable: bool(false);
-               [[If $true, unref this object after the next call.]]
-         }
-      }
    }
    implements {
         class.constructor;
index 8365807..0d443ef 100644 (file)
@@ -16,9 +16,6 @@
 # include <mach/mach_time.h>
 #endif
 
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
-
 #include "Eo.h"
 #include "eo_ptr_indirection.h"
 #include "eo_private.h"
index 8eda874..d55ab24 100644 (file)
@@ -5,9 +5,6 @@
 #include <Eina.h>
 #include <fnmatch.h>
 
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
-
 #include "Eo.h"
 #include "eo_ptr_indirection.h"
 #include "eo_private.h"
@@ -2109,12 +2106,12 @@ _efl_object_allow_parent_unref_get(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd)
    return pd->allow_parent_unref;
 }
 
-EOLIAN static void
-_efl_object_auto_unref_set(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED, Eina_Bool enable)
+EAPI void
+___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
 {
    // Write-only property
    EO_OBJ_POINTER(obj_id, obj);
-   obj->auto_unref = enable ? 2 : 0;
+   obj->auto_unref = enable ? 1 : 0;
 }
 
 EOLIAN static Eo *
index 676b0fb..38f8c9e 100644 (file)
@@ -119,7 +119,7 @@ struct _Eo_Object
      Eina_Bool del_triggered:1;
      Eina_Bool destructed:1;
      Eina_Bool manual_free:1;
-     unsigned char auto_unref : 2; // unref after 1 call
+     unsigned char auto_unref : 1; // unref after 1 call - hack for parts
 };
 
 /* How we search and store the implementations in classes. */
index 692ebca..d88ae05 100644 (file)
@@ -31,7 +31,7 @@ struct part_implementation_generator
       if(!as_generator(string << ">::type "<< string << "::" << string << "() const\n{\n"
                        << scope_tab << "::Eo *__return_value = ::efl_part"
                        << "(this->_eo_ptr(), \"" << string << "\");\n"
-                       << scope_tab << "::efl_auto_unref_set(__return_value, false);\n")
+                       << scope_tab << "::___efl_auto_unref_set(__return_value, false);\n")
             .generate(sink, std::make_tuple(part.klass.eolian_name, klass_name, part.name, part.name), ctx))
         return false;
       if(!as_generator(scope_tab << "return ::" << *(string << "::"))
index 2a26bf8..46c351f 100644 (file)
@@ -9,9 +9,6 @@
 # include <unistd.h>
 #endif
 
-#define EFL_OBJECT_BETA
-#define EFL_OBJECT_PROTECTED
-
 #include <Eo.h>
 
 #include "eo_suite.h"
@@ -1740,7 +1737,7 @@ START_TEST(efl_object_auto_unref_test)
    obj = efl_add(SIMPLE_CLASS, NULL);
    fail_if(efl_ref_count(obj) != 1);
    efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
-   efl_auto_unref_set(obj, 1);
+   ___efl_auto_unref_set(obj, 1);
    fail_if(_auto_unref_del);
    fail_if(efl_ref_count(obj) != 1);
    efl_name_set(obj, "name");
@@ -1751,7 +1748,7 @@ START_TEST(efl_object_auto_unref_test)
    obj = efl_add(SIMPLE_CLASS, NULL);
    fail_if(efl_ref_count(obj) != 1);
    efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
-   efl_auto_unref_set(obj, 1);
+   ___efl_auto_unref_set(obj, 1);
    fail_if(_auto_unref_del);
    fail_if(efl_ref_count(obj) != 1);
    simple_no_implementation(obj);
@@ -1764,7 +1761,7 @@ START_TEST(efl_object_auto_unref_test)
    fail_if(efl_ref_count(obj) != 1);
    efl_allow_parent_unref_set(obj, 1);
    efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
-   efl_auto_unref_set(obj, 1);
+   ___efl_auto_unref_set(obj, 1);
    fail_if(_auto_unref_del);
    fail_if(efl_ref_count(obj) != 1);
    efl_name_set(obj, "name");