Commit Graph

466 Commits

Author SHA1 Message Date
Stefan Schmidt d0f69cf2e2 exotic: remove left-overs from Exotic support
This seems to have been gone a long time ago and only references left
that have not been disturbing the build. Time to clean up!

Signed-off-by: Stefan Schmidt <s.schmidt@samsung.com>
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10793
2019-12-04 12:21:28 -08:00
Cedric Bail 474b1b2c2d eo: add infrastructure to attach an Eina_Future_Scheduler to any source of event.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10480
2019-10-31 14:52:46 +01:00
Boris Faure cdb920ab08 get rid of shadow variables
Summary: gl: add some EINA_FALLTHROUGH

Reviewers: #reviewers, zmike

Reviewed By: zmike

Subscribers: zmike, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9525
2019-08-08 17:18:46 -04:00
Marcel Hollerbach a0952b0c01 eo: add helper for checking the ownable state
if a object is ownable, then there is one free reference. If not, a
error will be printed.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9332
2019-07-19 10:54:57 -07:00
Vitor Sousa fb7f9d4ed3 eo: add an API entry for custom instantiation of Eo objects for binding usage
Add a new function in the Eo API in order to provide more options on object
instantiation for binding creators.

For the Eo lib to be able to construct objects that inherit from bindings in
many languages we should provide a way for bindings to call different kinds of
constructors, in a way that simply overriding the `efl_constructor` method is
not enough.
We need a way to differentiate at construction time if the Eo is being
constructed from C or from the binding, because if it is the
former we need too call the inherited object constructor from C and instantiate
a new object, and if it is the later we need to avoid instantiating a
new object because we are already in the middle of the process of creating
a new one.
`efl_constructor` alone does not provide any way of distinguishing between
those situations, so, being able to pass additional information for
efl_add_start (like a custom constructor pointer) is necessary to make the
right distinction.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9070
2019-06-25 17:08:53 -07:00
Vitor Sousa a86a0931f1 eo: add events to track the ownership status of an Eo object
Some user code may want to track an object ownership in regard to whether it is
kept by just one owner or shared between many owners.

This is specially true for code provided by bindings to other programming
languages, where different kinds of resource management may take place.

The event `ownership,unique` is triggered whenever the object refcount goes
from two to one, as a signal that it has just one owner from now on.

The event `ownership,shared` is triggered whenever the object refcount goes
from one to two, as a signal that it has multiple owners from now on.
It will not trigger when further increasing the refcount to any value beyond
two.

We also add benchmarks for sharing (i.e. increasing the refcount) and them
unsharing objects, in order to evaluate the performance impact of this patch.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8678
2019-05-29 15:53:23 -07:00
Vincent Torri 7f45f94af0 Eo: replace Evil.h with evil_private.h
Test Plan: compilation

Reviewers: q66, raster, zmike

Reviewed By: q66

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8905
2019-05-16 14:36:12 +02:00
Cedric BAIL adf4512a35 eo: refactor auto_unref logic used by efl_part.
This bring no functional change to Eo and efl_part.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8357
2019-03-27 15:03:18 -07:00
Cedric BAIL f11dfc0bc8 eo: enforce auto_unref logic at the end of efl_unref execution.
This allow for the safe use of efl_ref/efl_unref around an efl_part
without calling any function on that part.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8358
2019-03-27 15:03:16 -07:00
Christopher Michael d7beb192da eo: Fix missing varags cleanup
Summary:
Coverity reports that va_end is never called for p_list when we error
out of this function. This patch adds a missing va_end before we error
out of here.

Fixes Coverity CID1399080

@fix
Depends on D8315

Reviewers: raster, cedric, q66, zmike, bu5hm4n, stefan

Reviewed By: q66

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8316
2019-03-12 10:59:04 -04:00
Cedric BAIL bc12d9feb5 eo: make reflection getter const function.
Getter are usually not modifying there object. This is going to put a strong
limit on what a getter property for MVVM is, as it will prevent any side
effect on getting a property from a View.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7969
2019-03-08 14:31:08 -08:00
Marcel Hollerbach 8118330d2a eo: fix reflection
Summary:
the DFS tree walk was accidently stopped by a too early return
statement. We should only return if we found a reflection entry, if not,
then we should continue our search

Depends on D7996

Reviewers: cedric, zmike, q66, segfaultxavi

Reviewed By: cedric, zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7997
2019-03-08 08:19:23 -05:00
Jaehyun Cho 0e5ce0e9b4 Revert "eo: fix to remove unreachable loop"
This reverts commit f02b82a49e.
2019-02-22 19:02:06 +09:00
Jaehyun Cho f02b82a49e eo: fix to remove unreachable loop 2019-02-22 13:57:16 +09:00
Cedric BAIL 11d2b39b44 eo: add efl_property_reflection_exist to be able to know if a property is available on an object.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7937
2019-02-21 11:54:14 -08:00
Cedric BAIL 770750486c eo: return an Eina_Value error when a get for a property is not implemented.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7936
2019-02-21 11:54:12 -08:00
Cedric BAIL b23f65291f eo: make reflection setter able to return an error code in case of failure.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7935
2019-02-21 11:54:09 -08:00
Marcel Hollerbach 5284ac36ca eo: add API for querying the class type
a class can be a interface mixin abstract or regular.
This adds a API for getting this information
2019-02-21 08:56:13 +01:00
Marcel Hollerbach 46885653bc eo: remove class functions from eo
As in the previous commit explained, we want to get rid of class
functions in eo, and make them just c functions right away.

This commit removes the class parameter from the eo_class_function_set
call, and adjusts the tests to not depend on class functions anymore.
Class functions are now not tested anymore, tests that used them as a
way to test *things* are adjusted to test them now with object
functions, tests that just tested the working of class functions are
dropped.

This fixes T7675.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7902
2019-02-13 16:59:59 +01:00
Marcel Hollerbach 87373bf66c eo: efl_isa with a EFL_OVERRIDE_CLASS should return true
this is important, as basically every single class etc. can be a
EFL_OVERRIDE_CLASS. This makes efl_override work with eo_debug.

Differential Revision: https://phab.enlightenment.org/D7910
2019-02-12 11:20:21 +01:00
Marcel Hollerbach 0f32bb9047 eo: here comes reflection API
this adds support in eo to generate a reflection API. To get the actaul
reflection to the klass, the API efl_class_reflection_table_set needs to
be called, the table in the end can be generated by eolian. Reflection
API is inherited by the extended class. This means, if you have two
reflection tables, first, the most upperst is called, then the next
lower one is called.

For now this API accepts NULL setter or getter, and will ignore them
silently when they are called.

fix T7681

Differential Revision: https://phab.enlightenment.org/D7879
2019-02-07 14:43:25 +01:00
Marcel Hollerbach 0709bdea6f eo: change API call of efl_class_functions_set
The next commit will bring support for something like reflection. This
commit prepares the whole tree for getting another argument in
efl_class_functions_set.

ref T7681

Differential Revision: https://phab.enlightenment.org/D7882
2019-02-07 14:43:25 +01:00
Mike Blumenkrantz c946b1477d eo: implement class overriding (+unit tests)
this enables an app or a platform to add an override for a given class,
then return a different object when that class is created. the benefit is
that a class can be internally customized by the app without needing to
modify upstream versions of that class

@feature
fix T7516

Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7702
2019-02-04 19:31:17 +01:00
Marcel Hollerbach 32a2268f46 eo: fix efl_isa to work propertly with interfaces
mro only contains special interfaces, not in general all, in order to
have a working function, while NOT having a bad performance. In order to
achive that we just copy the code that is done on efl_isa for a object.
which is a linear walk of a list

ref D7857

Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7860
2019-02-01 11:32:43 +01:00
Jaehyun Cho 4eda1ea38e eo: check memory allocation of table data
Memory allocation is checked for the given domain's table data like
other cases for main and shared table data.
Differential Revision: https://phab.enlightenment.org/D7810
2019-01-30 13:33:49 +01:00
Cedric BAIL 549bf6e269 eo: improve efl_isa to be able to know if a class is part of the hierarchy of another class.
Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7703
2019-01-24 16:29:25 -08:00
Cedric BAIL 745fb1cf3c eo: propagate knowledge of EFL_EVENT_NOREF callback registration to the event call generation.
This reduce the amount of time efl_event_callback_call(EFL_EVENT_NOREF) is triggered by a factor of 10.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Differential Revision: https://phab.enlightenment.org/D7744
2019-01-24 12:22:43 -08:00
Cedric BAIL 4a25abccd6 eo: remove function efl_noref that duplicate EFL_EVENT_NOREF.
efl_noref is unused, but will still trigger the full eo call for nothing.
This was the most expensive NOOP. EFL_EVENT_NOREF does the same thing and
we can even filter generating that call as we know when someone is listening.
So removing the function.

Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7742
2019-01-24 11:54:19 -08:00
Cedric BAIL 8e85e19804 eo: fix MacOS break.
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7571
2019-01-09 12:49:07 -08:00
Cedric BAIL e02dba3377 eo: add the ability to get the size of object of a certain class.
Their was two different way to implement this, either like this with
a simple function that work on Efl_Class, or by a function on
Efl.Object. I leaned on the first one, but I could easily be convinced
it should be done on Efl.Object actually.

Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7441
2019-01-09 11:02:07 -08:00
Mike Blumenkrantz 1332e0e025 eo: improve thread check during class construction
Summary:
a common use case is for a class to be constructed during a thread+mainloop
sync (e.g., ecore_thread_main_loop_begin() ecore_thread_main_loop_end())
and then naturally destroyed in the main thread during shutdown

ref 023a9ca2ee

Reviewers: bu5hm4n, devilhorns

Reviewed By: bu5hm4n

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6472
2018-06-29 11:31:10 -04:00
Marcel Hollerbach 4378d6feb9 eo: lower from CRI to ERR
Summary:
unreffing too often is not good. However, its definitly not a critical
error. Most of the wikipedia articles (*) that are speaking about ciritcal or
fatal errors are highlighting that no reasonable recovery can be done.

In our case a recovery is not even needed, due to our pointer safety we
dont need to recover anything since the refcounting safed us from doing
something stupid.

ref T6987.
Depends on D6384

Reviewers: zmike, segfaultxavi, devilhorns

Reviewed By: zmike

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T6987

Differential Revision: https://phab.enlightenment.org/D6385
2018-06-25 06:50:31 -04:00
Xavi Artigas dc2aa79843 eo_debug: Fix segfault when parsing EO_LIFECYCLE_DEBUG envvar
Summary:
The 'if' block should only be executed when the string contains the colon and
something else behind, but sscanf cannot be used in this case.
If the string contained no colon, the following line with strchr(s, ':')
returns NULL and everything explodes.

Test Plan: eo_debug -l now works for me without segfaulting.

Reviewers: bu5hm4n, zmike, devilhorns, q66

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6347
2018-06-21 17:11:40 +02:00
Mike Blumenkrantz 023a9ca2ee eo: CRI when class constructor or destructor is called from thread
Summary:
calling the constructor and deconstructor from different threads
causes issues with mempool deallocation, so ensure that the class is
always initialized in the main thread for safety, e.g., call the
SOME_NAMED_CLASS macro during init to instantiate the class

fix T7003

Reviewers: bu5hm4n, devilhorns

Reviewed By: bu5hm4n

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7003

Differential Revision: https://phab.enlightenment.org/D6332
2018-06-19 13:42:16 -04:00
Marcel Hollerbach 4201893048 eo: make the debug build print leaked errors
Summary: Depends on D6328

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6329
2018-06-19 13:36:04 -04:00
Marcel Hollerbach 39d8a36b5e eo: only call efl_parent_set when parent_id is available
Summary:
this is no functinal change, we safe the calling to efl_parent_set.
Nothing else, the base implementation is initializated with NULL as
parent, and efl_parent_set with NULL would have returned in the first
few lines.

fix T7032

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Maniphest Tasks: T7032

Differential Revision: https://phab.enlightenment.org/D6327
2018-06-19 13:35:38 -04:00
Felipe Magno de Almeida 4a60c60528 eo: Fix internal reference count wrongly 0 when constructor returns a different object
The class's Eo constructor can return a different object, which makes
the efl_add return that object instead. However, a bug was not
initializing the internal reference count when a different object was
returned.
2018-06-18 14:55:57 -03:00
Mike Blumenkrantz bbf60946e3 eo: call efl_object_class_get() during efl_object_init()
Summary:
ensure that this is always called for the first time from the
main thread to avoid triggering asserts during shutdown

ref T7003

Reviewers: bu5hm4n, devilhorns

Reviewed By: bu5hm4n

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7003

Differential Revision: https://phab.enlightenment.org/D6272
2018-06-13 10:09:32 -04:00
Marcel Hollerbach 7e72a93283 eo: unref compensate is not requires here
this check caused a leaked reference.

Eo objects are having two reference counters a internal and external
one. The external one can be manipulated via efl_ref / efl_unref. The
internal one can be manipulated via _efl_ref _efl_unref.

The external reference counter is keeping a internal reference by the
time the external counter is > 0. When the external counter reaches ==
0 this internal reference is given up with the _efl_unref call in
eo.c:1928.

However, checking unref_compensate in the block in line 1950 leads that
to the leak that this internal reference is not given up at the pointer
user_refcount reaches exactly 0. This check also does not prevent
anything, the object is kept alive anywayys as the efl_unref method
keeps its private internal reference.

This lead to leaks in efl_device_* classes, parts have not been
destructed correctly.

Differential Revision: https://phab.enlightenment.org/D6252
2018-06-07 09:39:10 +02:00
Marcel Hollerbach 8d5a398610 eo: _efl_unref correctly
Summary:
this function calls _efl_ref in the beginning, so _efl_unref them in the
end. This fixes bugs where wrong evas_object_del is called to often,
which would lead to the internal refcount rising instead of getting to
0.

Reviewers: cedric, zmike, stefan_schmidt, q66

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6246
2018-06-06 14:20:11 -05:00
Cedric BAIL a90b5fa930 eo: remove parent_sink as this hack should not be necessary anymore. 2018-05-24 16:02:20 -07:00
Cedric BAIL 0cc07f4e6b eo: try to make efl_add and efl_add_ref refcounting sane in all case. 2018-05-24 16:02:20 -07:00
Cedric BAIL 0bf7a5ea13 eo: make sure that reporting object refcount during efl_noref, doesn't lead to recursive loop. 2018-05-24 16:02:20 -07:00
Cedric Bail 48b8118123 eo: update refcount before sending efl_noref event to avoid double update during events propagation. 2018-05-24 16:02:19 -07:00
Cedric BAIL 4c9a33a388 eo: move EFL internal function ___efl_ref2 also to eo_internal.h
Differential Revision: https://phab.enlightenment.org/D6099
2018-05-24 16:02:18 -07:00
Cedric BAIL c28eb28728 eo: check for allow_parent_unref during efl_unref and silence warning.
Differential Revision: https://phab.enlightenment.org/D6097
2018-05-24 16:02:18 -07:00
Cedric BAIL dcfddcd283 eo: make sure efl_noref is always called at the proper time.
Differential Revision: https://phab.enlightenment.org/D6096
2018-05-24 16:02:18 -07:00
Cedric BAIL 79e4947f3e eo: add an automatic fallback at the moment when efl_unref instead of efl_del is called.
Differential Revision: https://phab.enlightenment.org/D6095
2018-05-24 16:02:18 -07:00
Cedric BAIL 93a49da161 eo: optimize efl object reuse by limiting the amount of call to pointer translation.
Differential Revision: https://phab.enlightenment.org/D6088
2018-05-24 16:02:18 -07:00
Cedric BAIL cdbbaede7e efl: remove old Efl_Future, Efl_Promise. 2018-05-01 10:39:01 -07:00