summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 14:31:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-05 15:06:34 +0900
commit207a0cf3e3ce169b2e6400ca4bc1df512ea15a27 (patch)
tree25ef8280e607308de2e7cbf131c7064a6397291c
parent8cdb3184f8a1f3e5396d953b238ce2e217f0cb1c (diff)
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).
-rw-r--r--src/bindings/cxx/eo_cxx/efl_object_impl.hh3
-rw-r--r--src/lib/edje/edje_part_helper.h2
-rw-r--r--src/lib/edje/edje_private.h2
-rw-r--r--src/lib/efl/cxx/efl_part_impl.hh2
-rw-r--r--src/lib/elementary/elementary_config.h2
-rw-r--r--src/lib/elementary/elm_part_helper.h5
-rw-r--r--src/lib/eo/Eo.h1
-rw-r--r--src/lib/eo/efl_object.eo23
-rw-r--r--src/lib/eo/eo.c3
-rw-r--r--src/lib/eo/eo_base_class.c9
-rw-r--r--src/lib/eo/eo_private.h2
-rw-r--r--src/lib/eolian_cxx/grammar/part_implementation.hpp2
-rw-r--r--src/tests/eo/suite/eo_test_general.c9
13 files changed, 12 insertions, 53 deletions
diff --git a/src/bindings/cxx/eo_cxx/efl_object_impl.hh b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
index ce61ed6200..734ed17df0 100644
--- a/src/bindings/cxx/eo_cxx/efl_object_impl.hh
+++ b/src/bindings/cxx/eo_cxx/efl_object_impl.hh
@@ -1,9 +1,6 @@
1#ifndef EFL_OBJECT_MANUAL_IMPL_HH 1#ifndef EFL_OBJECT_MANUAL_IMPL_HH
2#define EFL_OBJECT_MANUAL_IMPL_HH 2#define EFL_OBJECT_MANUAL_IMPL_HH
3 3
4#define EFL_OBJECT_BETA
5#define EFL_OBJECT_PROTECTED
6
7// Skip del. Must be implemented in eo::concrete. 4// Skip del. Must be implemented in eo::concrete.
8#define EOLIAN_CXX_EFL_DEL_DECLARATION 5#define EOLIAN_CXX_EFL_DEL_DECLARATION
9#define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION 6#define EOLIAN_CXX_EFL_DEL_IMPLEMENTATION
diff --git a/src/lib/edje/edje_part_helper.h b/src/lib/edje/edje_part_helper.h
index c2b184fc7a..671bf657ae 100644
--- a/src/lib/edje/edje_part_helper.h
+++ b/src/lib/edje/edje_part_helper.h
@@ -101,7 +101,7 @@ end: \
101 __VA_ARGS__; \ 101 __VA_ARGS__; \
102 if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \ 102 if (!no_del_cb) efl_del_intercept_set(proxy, _ ## type ## _del_cb); \
103 efl_allow_parent_unref_set(proxy, 1); \ 103 efl_allow_parent_unref_set(proxy, 1); \
104 efl_auto_unref_set(proxy, 1); \ 104 ___efl_auto_unref_set(proxy, 1); \
105 return proxy; \ 105 return proxy; \
106} 106}
107 107
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 3dc4634b30..c5238b3f69 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -40,8 +40,6 @@
40#endif 40#endif
41 41
42// auto_unref 42// auto_unref
43#define EFL_OBJECT_BETA
44#define EFL_OBJECT_PROTECTED
45#define EDJE_OBJECT_BETA 43#define EDJE_OBJECT_BETA
46#define EFL_CANVAS_OBJECT_PROTECTED 44#define EFL_CANVAS_OBJECT_PROTECTED
47#define EFL_CANVAS_LAYOUT_CALC_PROTECTED 45#define EFL_CANVAS_LAYOUT_CALC_PROTECTED
diff --git a/src/lib/efl/cxx/efl_part_impl.hh b/src/lib/efl/cxx/efl_part_impl.hh
index f40292c6e0..b97dda1457 100644
--- a/src/lib/efl/cxx/efl_part_impl.hh
+++ b/src/lib/efl/cxx/efl_part_impl.hh
@@ -8,7 +8,7 @@
8inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \ 8inline ::efl::Object Part::part(::efl::eina::string_view const& name) const \
9{ \ 9{ \
10 ::Eo *handle = ::efl_part(_eo_ptr(), name.c_str()); \ 10 ::Eo *handle = ::efl_part(_eo_ptr(), name.c_str()); \
11 ::efl_auto_unref_set(handle, false); \ 11 ::___efl_auto_unref_set(handle, false); \
12 return ::efl::Object{handle}; \ 12 return ::efl::Object{handle}; \
13} 13}
14 14
diff --git a/src/lib/elementary/elementary_config.h b/src/lib/elementary/elementary_config.h
index b062509e22..38302542fa 100644
--- a/src/lib/elementary/elementary_config.h
+++ b/src/lib/elementary/elementary_config.h
@@ -15,8 +15,6 @@
15#define EFL_CANVAS_OBJECT_PROTECTED 15#define EFL_CANVAS_OBJECT_PROTECTED
16#define EFL_CANVAS_GROUP_PROTECTED 16#define EFL_CANVAS_GROUP_PROTECTED
17#define EFL_CANVAS_GROUP_BETA 17#define EFL_CANVAS_GROUP_BETA
18#define EFL_OBJECT_BETA
19#define EFL_OBJECT_PROTECTED
20#define EFL_ACCESS_BETA 18#define EFL_ACCESS_BETA
21#define EFL_ACCESS_COMPONENT_BETA 19#define EFL_ACCESS_COMPONENT_BETA
22#define EFL_ACCESS_EDITABLE_TEXT_BETA 20#define EFL_ACCESS_EDITABLE_TEXT_BETA
diff --git a/src/lib/elementary/elm_part_helper.h b/src/lib/elementary/elm_part_helper.h
index 25001d714e..858dbb4d90 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -1,9 +1,6 @@
1#ifndef _ELM_PART_HELPER_H 1#ifndef _ELM_PART_HELPER_H
2#define _ELM_PART_HELPER_H 2#define _ELM_PART_HELPER_H
3 3
4#define EFL_OBJECT_BETA
5#define EFL_OBJECT_PROTECTED
6
7#include "Elementary.h" 4#include "Elementary.h"
8#include "elm_priv.h" 5#include "elm_priv.h"
9#include "efl_ui_layout_part_legacy.eo.h" 6#include "efl_ui_layout_part_legacy.eo.h"
@@ -75,7 +72,7 @@ _elm_part_initialize(Eo *proxy, Eo *obj, const char *part)
75 72
76 EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL); 73 EINA_SAFETY_ON_FALSE_RETURN_VAL(pd && obj && part, NULL);
77 efl_allow_parent_unref_set(proxy, 1); 74 efl_allow_parent_unref_set(proxy, 1);
78 efl_auto_unref_set(proxy, 1); 75 ___efl_auto_unref_set(proxy, 1);
79 pd->part = eina_tmpstr_add(part); 76 pd->part = eina_tmpstr_add(part);
80 pd->obj = obj; 77 pd->obj = obj;
81 78
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index b3ba90ab88..e7e4bc3c96 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -2144,6 +2144,7 @@ EAPI Eina_Iterator *eo_objects_iterator_new(void);
2144 /* Private for EFL internal use only. Do not use these! */ 2144 /* Private for EFL internal use only. Do not use these! */
2145EAPI int ___efl_ref2_count(const Eo *obj_id); 2145EAPI int ___efl_ref2_count(const Eo *obj_id);
2146EAPI void ___efl_ref2_reset(const Eo *obj_id); 2146EAPI void ___efl_ref2_reset(const Eo *obj_id);
2147EAPI void ___efl_auto_unref_set(Eo *obj_id, Eina_Bool val);
2147 2148
2148#endif 2149#endif
2149 2150
diff --git a/src/lib/eo/efl_object.eo b/src/lib/eo/efl_object.eo
index 951a5748ce..1b7c0755bf 100644
--- a/src/lib/eo/efl_object.eo
+++ b/src/lib/eo/efl_object.eo
@@ -279,29 +279,6 @@ abstract Efl.Object ()
279 even if @.parent is not $null.]] 279 even if @.parent is not $null.]]
280 } 280 }
281 } 281 }
282 @property auto_unref @protected @beta {
283 [[Mark an object to be automatically deleted after a function call.
284
285 This becomes effectives only after finalize is done. After any EO
286 function has been called on this object, it will be unref'ed. This
287 property will also be reset to $false. This is intended to simplify
288 Part objects lifecycle.
289
290 Note: This applies to any EO function call, even if the object was
291 of the wrong type (call resolution failed).
292
293 This is a write-only property as reading it would unref the object,
294 and reset the flag.
295
296 Warning: This is a beta API, do not use it unless you know exactly
297 what you are doing.
298 ]]
299 set {}
300 values {
301 enable: bool(false);
302 [[If $true, unref this object after the next call.]]
303 }
304 }
305 } 282 }
306 implements { 283 implements {
307 class.constructor; 284 class.constructor;
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 8365807e4e..0d443ef625 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -16,9 +16,6 @@
16# include <mach/mach_time.h> 16# include <mach/mach_time.h>
17#endif 17#endif
18 18
19#define EFL_OBJECT_BETA
20#define EFL_OBJECT_PROTECTED
21
22#include "Eo.h" 19#include "Eo.h"
23#include "eo_ptr_indirection.h" 20#include "eo_ptr_indirection.h"
24#include "eo_private.h" 21#include "eo_private.h"
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 8eda874cb2..d55ab245c3 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -5,9 +5,6 @@
5#include <Eina.h> 5#include <Eina.h>
6#include <fnmatch.h> 6#include <fnmatch.h>
7 7
8#define EFL_OBJECT_BETA
9#define EFL_OBJECT_PROTECTED
10
11#include "Eo.h" 8#include "Eo.h"
12#include "eo_ptr_indirection.h" 9#include "eo_ptr_indirection.h"
13#include "eo_private.h" 10#include "eo_private.h"
@@ -2109,12 +2106,12 @@ _efl_object_allow_parent_unref_get(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd)
2109 return pd->allow_parent_unref; 2106 return pd->allow_parent_unref;
2110} 2107}
2111 2108
2112EOLIAN static void 2109EAPI void
2113_efl_object_auto_unref_set(Eo *obj_id EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED, Eina_Bool enable) 2110___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable)
2114{ 2111{
2115 // Write-only property 2112 // Write-only property
2116 EO_OBJ_POINTER(obj_id, obj); 2113 EO_OBJ_POINTER(obj_id, obj);
2117 obj->auto_unref = enable ? 2 : 0; 2114 obj->auto_unref = enable ? 1 : 0;
2118} 2115}
2119 2116
2120EOLIAN static Eo * 2117EOLIAN static Eo *
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 676b0fbab6..38f8c9eb03 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -119,7 +119,7 @@ struct _Eo_Object
119 Eina_Bool del_triggered:1; 119 Eina_Bool del_triggered:1;
120 Eina_Bool destructed:1; 120 Eina_Bool destructed:1;
121 Eina_Bool manual_free:1; 121 Eina_Bool manual_free:1;
122 unsigned char auto_unref : 2; // unref after 1 call 122 unsigned char auto_unref : 1; // unref after 1 call - hack for parts
123}; 123};
124 124
125/* How we search and store the implementations in classes. */ 125/* How we search and store the implementations in classes. */
diff --git a/src/lib/eolian_cxx/grammar/part_implementation.hpp b/src/lib/eolian_cxx/grammar/part_implementation.hpp
index 692ebca7c1..d88ae05b92 100644
--- a/src/lib/eolian_cxx/grammar/part_implementation.hpp
+++ b/src/lib/eolian_cxx/grammar/part_implementation.hpp
@@ -31,7 +31,7 @@ struct part_implementation_generator
31 if(!as_generator(string << ">::type "<< string << "::" << string << "() const\n{\n" 31 if(!as_generator(string << ">::type "<< string << "::" << string << "() const\n{\n"
32 << scope_tab << "::Eo *__return_value = ::efl_part" 32 << scope_tab << "::Eo *__return_value = ::efl_part"
33 << "(this->_eo_ptr(), \"" << string << "\");\n" 33 << "(this->_eo_ptr(), \"" << string << "\");\n"
34 << scope_tab << "::efl_auto_unref_set(__return_value, false);\n") 34 << scope_tab << "::___efl_auto_unref_set(__return_value, false);\n")
35 .generate(sink, std::make_tuple(part.klass.eolian_name, klass_name, part.name, part.name), ctx)) 35 .generate(sink, std::make_tuple(part.klass.eolian_name, klass_name, part.name, part.name), ctx))
36 return false; 36 return false;
37 if(!as_generator(scope_tab << "return ::" << *(string << "::")) 37 if(!as_generator(scope_tab << "return ::" << *(string << "::"))
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index 2a26bf8dd1..46c351fdd9 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -9,9 +9,6 @@
9# include <unistd.h> 9# include <unistd.h>
10#endif 10#endif
11 11
12#define EFL_OBJECT_BETA
13#define EFL_OBJECT_PROTECTED
14
15#include <Eo.h> 12#include <Eo.h>
16 13
17#include "eo_suite.h" 14#include "eo_suite.h"
@@ -1740,7 +1737,7 @@ START_TEST(efl_object_auto_unref_test)
1740 obj = efl_add(SIMPLE_CLASS, NULL); 1737 obj = efl_add(SIMPLE_CLASS, NULL);
1741 fail_if(efl_ref_count(obj) != 1); 1738 fail_if(efl_ref_count(obj) != 1);
1742 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del); 1739 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
1743 efl_auto_unref_set(obj, 1); 1740 ___efl_auto_unref_set(obj, 1);
1744 fail_if(_auto_unref_del); 1741 fail_if(_auto_unref_del);
1745 fail_if(efl_ref_count(obj) != 1); 1742 fail_if(efl_ref_count(obj) != 1);
1746 efl_name_set(obj, "name"); 1743 efl_name_set(obj, "name");
@@ -1751,7 +1748,7 @@ START_TEST(efl_object_auto_unref_test)
1751 obj = efl_add(SIMPLE_CLASS, NULL); 1748 obj = efl_add(SIMPLE_CLASS, NULL);
1752 fail_if(efl_ref_count(obj) != 1); 1749 fail_if(efl_ref_count(obj) != 1);
1753 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del); 1750 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
1754 efl_auto_unref_set(obj, 1); 1751 ___efl_auto_unref_set(obj, 1);
1755 fail_if(_auto_unref_del); 1752 fail_if(_auto_unref_del);
1756 fail_if(efl_ref_count(obj) != 1); 1753 fail_if(efl_ref_count(obj) != 1);
1757 simple_no_implementation(obj); 1754 simple_no_implementation(obj);
@@ -1764,7 +1761,7 @@ START_TEST(efl_object_auto_unref_test)
1764 fail_if(efl_ref_count(obj) != 1); 1761 fail_if(efl_ref_count(obj) != 1);
1765 efl_allow_parent_unref_set(obj, 1); 1762 efl_allow_parent_unref_set(obj, 1);
1766 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del); 1763 efl_event_callback_add(obj, EFL_EVENT_DEL, _auto_unref_del_cb, &_auto_unref_del);
1767 efl_auto_unref_set(obj, 1); 1764 ___efl_auto_unref_set(obj, 1);
1768 fail_if(_auto_unref_del); 1765 fail_if(_auto_unref_del);
1769 fail_if(efl_ref_count(obj) != 1); 1766 fail_if(efl_ref_count(obj) != 1);
1770 efl_name_set(obj, "name"); 1767 efl_name_set(obj, "name");