eo: Move hacky API auto_unref to C only

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).
This commit is contained in:
Jean-Philippe Andre 2017-12-05 14:31:22 +09:00
parent 8cdb3184f8
commit 207a0cf3e3
13 changed files with 12 additions and 53 deletions

View 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

View 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; \
}

View 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

View 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}; \
}

View 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

View 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;

View 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

View 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;

View 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"

View 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 *

View 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. */

View 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 << "::"))

View 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");