Commit Graph

1090 Commits

Author SHA1 Message Date
Marcel Hollerbach e43f090265 cmake: remove!
This build was never complete and also was not maintained probebly.

It is also dropped in favour of meson which is cool, merged, works & is fast.

Differential Revision: https://phab.enlightenment.org/D7010
2018-12-20 20:07:26 +01:00
Cedric BAIL 2bc28da2e3 eo: fix efl_future_then example.
Summary: Depends on D7393

Reviewers: segfaultxavi

Reviewed By: segfaultxavi

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7472

Differential Revision: https://phab.enlightenment.org/D7423
2018-12-07 13:32:12 +01:00
Cedric BAIL 33c00de365 eo: make efl_future_then have a data pointer in addition of the object pointer.
Summary:
In the case when you have multiple future in flight related to one object, you
couldn't use the previous version of efl_future_then. Now all function calls
take a void* pointer that allow multiple future to have their private data
request data accessible in all the callback.

This should not break released API as Eo.h is not released yet and so
was efl_future_Eina_FutureXXX_then.

Depends on D7332

Reviewers: felipealmeida, segfaultxavi, vitor.sousa, SanghyeonLee, bu5hm4n

Reviewed By: segfaultxavi

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7472

Differential Revision: https://phab.enlightenment.org/D7379
2018-12-07 12:23:11 +01:00
Marcel Hollerbach c1dd57d210 meson: use eolian_gen with -S
this ensures that eolian does not parse installed .eo files

Differential Revision: https://phab.enlightenment.org/D7405
2018-12-03 19:00:26 +01:00
Cedric BAIL 5de51f84fb eo: rename efl_future_Eina_FutureXXX_then in efl_future_then as this has been available for some time.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br>
Differential Revision: https://phab.enlightenment.org/D7327
2018-11-23 11:39:43 -08:00
Daniel Kolesa c8e0a1d2e2 eolian: implement new syntax for inheritance
This new syntax separates the parent class from extensions, in
a familiar way to similar to e.g. Java. Since changing everything
at once is a lot of effort, implement it alongside for the time
being.
2018-11-23 13:57:07 +01:00
Cedric BAIL fccce08947 eo: make efl_replace work with a const pointer like efl_ref/unref do.
Summary: This is done to keep consistency with all the reference counting functions in Eo.

Reviewers: Hermet, smohanty

Reviewed By: Hermet

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7274
2018-11-16 12:09:48 +09:00
Lauro Moura 021513923d eo: Avoid namespace clashes.
Summary:
This commit removes some clashes (i.e. names as classes and namespaces
at the same time). It'll avoid nested items that are either forbidden
(C#) or problematic (Python) in some languages.

Reviewers: segfaultxavi, bu5hm4n, felipealmeida

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7260
2018-11-13 09:48:14 +01:00
Vitor Sousa 08357cd153 eo: fix and rework efl_replace()
Summary:
Check if the Eo to be replaced is NULL before calling efl_unref.
The documentation implies that the replaced object can be NULL, so this
check avoids unnecessary function calls and warning logs.

Add an EINA_SAFETY check in order to properly print an error message
when the function is used with an NULL storage pointer.
The documentation specifies that the first parameter can not be NULL.
So printing an error message should be better than silently returning.

Add a boolean return to the function that signalizes if the content of
the storage was changed. It is NOT an success/error flag, it is just a
simple helper to quickly test for a change in content.
This feature was inspired by eina_stringshare_replace that is used in
similar ways around the code.

Change the documentation to match the changes and to be more specific
about what is expected and how the arguments are treated.

Reviewers: raster, bu5hm4n, cedric, felipealmeida

Reviewed By: bu5hm4n

Subscribers: #reviewers, #committers, larryolj

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7256
2018-11-12 18:20:03 -02:00
Daniel Kolesa 5a3d79d383 meson: add eolian custom dependencies support
This uses the meson/ninja depfile functionality + eolian to make
sure proper dependencies between generated files and .eo files
are managed, to ensure consistent re-generation of all generated
files that are affected upon .eo file modification.

For custom rules with multiple outputs, Ninja currently does not
support depfiles. Therefore, split those into two custom rules
so that the depfiles functionality can be enabled. While this
is ugly and slows down the process a little by having to invoke
Eolian twice instead of once, it has to be done and it's still
better than what we had in Autotools anyway.

Differential revision: D7187

Fixes T6700.
2018-10-24 12:02:55 +02:00
Marcel Hollerbach 46d464e5bf here comes meson
a new shiny buildtool that currently completes in the total of ~ 4 min..
1 min. conf time
2:30 min. build time
Where autotools takes:
1:50 min. conf time
3:40 min. build time.

meson was taken because it went quite good for enlightenment, and is a traction gaining system that is also used by other mayor projects. Additionally, the DSL that is defined my meson makes the configuration of the builds a lot easier to read.

Further informations can be gathered from the README.meson

Right now, bindings & windows support are missing.

It is highly recommented to use meson 0.48 due to optimizations in meson
that reduced the time the meson call would need.

Co-authored-by: Mike Blumenkrantz <zmike@samsung.com>

Differential Revision: https://phab.enlightenment.org/D7012
Depends on D7011
2018-10-02 17:22:50 +02:00
Yeongjong Lee d2defeea7c eina_value: return null when eina_value_pget failed
Summary:
Add return value check.
found by coverity.

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7107
2018-09-27 14:10:31 +09:00
junsu choi 9d197f38bb eo: Add null check
Summary:
This commit add null check on _efl_object_invalidate
In EO_OBJ_POINTER, if obj_id is null, obj can also be null.

Test Plan: N/A

Reviewers: cedric, zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7068
2018-09-21 16:54:52 +09:00
Marcel Hollerbach 068e09cf2e eo: add funktion for alive checks
The function simply checks if the object is finalized and not
started to be invalidated or invalidated.

Differential Revision: https://phab.enlightenment.org/D6723
2018-09-14 11:18:56 +02:00
Marcel Hollerbach 365c0334ff efl_object: add call for getting invalidating
Summary:
there is now invalidated & invalidating.

invalidated returns true when all children are invalidated, and the
object is / was requested to be invalidated.

invalidating return true when the object is called to be invalidated but
not all children are invalidated yet. However, the object is garanteed
to be invalidated in near future.

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric

Tags: #efl, #do_not_merge

Differential Revision: https://phab.enlightenment.org/D6722
2018-08-20 13:15:57 -04:00
Xavi Artigas 1de1f6d8fb eo: Fix efl_new without initializing parameters
Summary:
efl_new(CLASS), i.e., without initializers, never worked before.
The problem is the dangling comma: efl_add_ref(klass, NULL, );
Fortunately the C preprocessor concatenation operator # # has a special
case just for this occasion: When you do A ## B, and A is a comma and B
is empty, it removes also A.
https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
This trick is already in use in several other EFL headers using variadic macros.

Reviewers: zmike, bu5hm4n, devilhorns, herdsman

Reviewed By: zmike

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6553
2018-07-12 09:32:42 -04:00
Mike Blumenkrantz cba95178d5 eo/base_class: explicitly refuse to set an object as its own parent
somehow this has been possible until now. no.

@fix

Differential Revision: https://phab.enlightenment.org/D6489
2018-07-05 15:11:55 -04: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
Mike Blumenkrantz 51d0faec67 eo: remove some erroneous mutex unlocks during base class parent_set errors
recent changes added unlocks for these mutexes in some other places, so only
do the unlocks where necessary

fix T7020
2018-06-25 15:14:30 -04:00
Mike Blumenkrantz 02c62d3135 eo: remove some erroneous mutex unlocks during base class parent_set errors
recent changes added unlocks for these mutexes in some other places, so only
do the unlocks where necessary

fix T7020
Depends on D6356

Differential Revision: https://phab.enlightenment.org/D6357
2018-06-25 17:17:13 +02: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
Marcel Hollerbach e2d143d19e eo: make noref also a special count
Summary:
this brings down the first frame time from 2.0 sec. to something at 0.7
sec.

ref T6983

Reviewers: zmike

Reviewed By: zmike

Subscribers: YOhoho, cedric, #committers, zmike

Tags: #efl

Maniphest Tasks: T6983

Differential Revision: https://phab.enlightenment.org/D6244
2018-06-05 10:56:09 -04:00
Marcel Hollerbach 608575f5bd eo: do not return efl_invalidated true when its not true
Summary:
the object is invalidated AFTER the parent is lost, (thats what the doc
says). Returning invalidated as true when the parent is still present is
thus not correctly.

Depends on D6222

Reviewers: cedric, zmike, JackDanielZ

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6223

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
2018-05-28 21:50:17 -07:00
Cedric BAIL 38d8b615c8 eo: an object is invalidated if it is invalidated or if any parent is invalidated. 2018-05-24 16:02:21 -07:00
Cedric BAIL b1954ce1e7 eo: move wref set to NULL to append after last event.
Making wref disapear before the last event require additional work to use
them during the FREE event. As I think we should introduce a wref that
disapear after the invalidate state, it makes sense to move that to a later
stage. Especially because their is no specific event related to them
being set to NULL.
2018-05-24 16:02:20 -07:00
Cedric Bail fa795b17d3 eo: allow efl_part during object invalidate. 2018-05-24 16:02:20 -07: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 ccf320b06a eo: improve error reporting to display object pointer (without accessing it). 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 5c23ea00b4 eo: add warning in case of a terrible situation happen. 2018-05-24 16:02:20 -07:00
Cedric BAIL b0aa5d806b eo: efl_invalidate should also be triggered for object with no parent before the destructor. 2018-05-24 16:02:20 -07:00
Cedric Bail e1d41eef3a eo: actually enforcing the efl_parent_set code path is necessary to enforce the predictability of the code path. 2018-05-24 16:02:19 -07:00
Cedric Bail 23e2c0bdb8 eo: as efl_del is not an Eo API call anymore, manually protect call with refcount. 2018-05-24 16:02:19 -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 d052f001be eo: move destruction of the link with children to be always after invalidate. 2018-05-24 16:02:19 -07:00
Cedric Bail 3a1fe14742 eo: propagate invalidate before destroying the link to the parent. 2018-05-24 16:02:19 -07:00
Cedric Bail a3c91d14a9 eo: improve message for debugging life cycle issues. 2018-05-24 16:02:19 -07:00
Cedric BAIL 0239099d01 eo: efl_del should not be something anyone can override this can break so many things.
Allowing override of efl_del allow for messing with object life cycle which can create
problem for binding where an object was expected to be invalidated, but isn't really.
2018-05-24 16:02:19 -07:00
Cedric BAIL c447b61756 eo: actually during invalidating we already have an invalidated object.
Differential Revision: https://phab.enlightenment.org/D6100
2018-05-24 16:02:18 -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 8a513a522e efl: major rewrite of efl_part.
The interface efl_part_get should not be directly called from C, but the efl_part
wrapper should. It rely on efl_noref to properly destroy the object. Binding can
control the lifecycle of the reference the way they want by either calling the
wrapper or efl_part_get directly. It also means that the ugly ___efl_auto_unref_set
doesn't need to be exposed outside of EFL anymore.

Differential Revision: https://phab.enlightenment.org/D6098
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 ef6cac1476 eo: prevent parenting to an already invalidated parent.
Differential Revision: https://phab.enlightenment.org/D6086
2018-05-24 16:02:18 -07:00
Cedric BAIL 546a4c79e0 eo: only call efl_parent_set(NULL) at the end of invalidate if the object is not invalidating.
Add also a comment to justify why we do force parent to NULL during invalidate.

Differential Revision: https://phab.enlightenment.org/D6085
2018-05-24 16:02:18 -07:00
Cedric BAIL 56fb2cf377 eo: improve error message by pointing to the class that is creating trouble.
Differential Revision: https://phab.enlightenment.org/D6079
2018-05-24 16:02:18 -07:00
Cedric BAIL bb66aa37ca eo: preventing infinite loop by safely iterating over children during destructor.
Differential Revision: https://phab.enlightenment.org/D6078
2018-05-24 16:02:18 -07:00
Cedric BAIL 2160fe0d4d eo: invalidate at the end of efl_invalidate only and prevent infinite recursion with an invalidating phase.
Differential Revision: https://phab.enlightenment.org/D6075
2018-05-24 16:02:18 -07:00
Cedric Bail 36f8a70041 eo: to avoid mistake in timing, efl_invalidate should always be triggered before any destructor code.
Differential Revision: https://phab.enlightenment.org/D6061
2018-05-24 16:02:17 -07:00
Xavi Artigas 029f0769a5 efl: rename Efl.Event.Description -> Efl.Event_Description 2018-05-23 17:33:47 +02:00
Xavi Artigas 35bbedc96f efl: Add missing event types
Summary:
All events must have a type now, otherwise bindings don't know how to handle
the event_info field.
Most of the missing event types were actually "void" (no event_info present).
Some struct definitions had to be moved to eo instead of h files, so they
are available to bindings. Some have not, and are marked with FIXME.
Some namespaces have been fixed (like Efl_Event_Cb -> Efl.Event_Cb).

In general, there are hundreds of changed files, but mostly to add a type which
was not present before, so there's no harm done.
Also, A lot of FIXMEs have been added which should be, like, fixed.
For example, some events can send different types of event_info, which is
very inconvenient (and error prone).

Test Plan: make with c# bindings works, make check and make examples work too.

Reviewers: cedric, q66, lauromoura

Subscribers: zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6169
2018-05-19 01:42:26 +02:00
Xavi Artigas 5d1898dd9e eo: do not expose callback,add and del events in bindings
These events have been removed from efl_object.eo. Bindings can
still use the EFL_EVENT_CALLBACK_ADD and EFL_EVENT_CALLBACK_DEL
events from C, but they won't be available to the bound language.
The rationale is that bound languages probably will have their
own way to handle callbacks and C function pointers will mean
very little to them. For example, the binding code could route
the native callback through a dispatcher so the received
function ptr would always be that of the dispatcher method.

Closes D6179.
2018-05-18 16:45:11 +02:00
Xavi Artigas 048adae83d Eo: introduce convenience macro efl_new()
Summary:
This is just a wrapper around efl_add_ref() with a NULL parent.
It only simplifies a bit object creation when no parent is desired, but it
simplifies a lot the explanation of the refcounting concepts (and tutorials).

Reviewers: cedric, bu5hm4n

Reviewed By: cedric, bu5hm4n

Subscribers: bu5hm4n, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6024
2018-05-15 09:53:24 -04:00
Daniel Kolesa f58bdbf23a eolian: switch Eina.Future instances to future<T> 2018-05-03 17:14:39 +02:00
Xavi Artigas 5d1e1bf3ae Update docs for efl_add() and efl_add_ref()
Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D6023

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-05-02 10:46:34 -07:00
Cedric BAIL cdbbaede7e efl: remove old Efl_Future, Efl_Promise. 2018-05-01 10:39:01 -07:00
Cedric Bail e7d5d34158 eo: invalidate before setting the parent to NULL. 2018-05-01 10:39:01 -07:00
Cedric BAIL b30587f5b0 eo: linking a future lifecycle with an object lifecycle doesn't change the object. 2018-05-01 10:39:01 -07:00
Cedric BAIL 67d9c0c11e eo: implement a copy function.
we do not rely on copying the object, but on refcounting it. This seems
to match the usage we have with object.
2018-05-01 10:39:01 -07:00
Cedric BAIL 79afb51626 eo: if the pointer is incorrect, goto to the error handler. 2018-05-01 10:39:01 -07:00
Cedric Bail 356e37564a eo: handle NULL nicely in efl_replace. 2018-05-01 10:39:01 -07:00
Xavi Artigas eaa4a3b10d Efl.Object_Override (from Efl.Object.Override)
Ref https://phab.enlightenment.org/T6847

Reviewed-by: Cedric Bail <cedric@osg.samsung.com>
2018-04-24 09:03:47 -07:00
Daniel Kolesa fcae7cab27 eolian gen: enable constness generation on property getter impls
This changes a lot of things all across the EFL. Previously,
methods tagged @const had both their external prototype and
internal impl generated with const on object, while property
getters only had const on the external API. This is now changed
and it all has const everywhere.

Ref T6859.
2018-04-17 20:31:55 +02:00
junsu choi ad6ef48053 eo : Add null check
Summary:
This commit add null check on __efl_auto_unref_set.
In EO_OBJ_POINTER, if obj_id is null, obj can also be null.

Test Plan: N/A

Reviewers: woohyun, kimcinoo, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5869

Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-04-16 11:24:29 -07:00
Cedric Bail 224049fa18 eo: trigger invalidate and noref event before any modification is commited on the object tree. 2018-04-02 17:18:46 -07:00
Cedric BAIL 9072c9a37a eo: add events when object get invalidated and loose all its reference matching other lifecycle events. 2018-03-30 09:53:59 -07:00
Cedric BAIL d7da460dd2 eo: use EINA_SAFETY_ON_TRUE_GOTO to error message out in case of mistake. 2018-03-29 14:07:54 -07:00
Cedric BAIL 168849e8a0 eo: use unref instead of del when constructor fails without parent
Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-20 17:20:57 -07:00
Cedric Bail a1bf513920 eo: start reporting abuse of efl_del 2018-03-20 17:20:56 -07:00
Cedric Bail 2a14a283e8 eo: slight improvement of invalidate code as parent_set(NULL) will be valid on an invalidated object. 2018-03-19 16:47:28 -07:00
Cedric Bail 21164b5a56 eo: automatically cancel a future that is attached to an invalidated object. 2018-03-19 16:38:07 -07:00
Cedric BAIL a5bb8bf3df eo: check return in efl_add before performing more operations
this fixes a crash on objects which fail to be created using efl_add_ref

Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
2018-03-19 13:04:45 -07:00
Cedric BAIL e1a53fe125 eo: start printing warning when instanciating object with efl_add and no parent. 2018-03-19 13:04:45 -07:00
Lauro Moura 47ac8689f1 eo: Orphan an object that is being invalidated.
Summary:
This will avoid infinite loops and errors when the parent tries
to orphan an invalidated child.

Fixes T6780

Test Plan: Run `make check`

Reviewers: cedric

Maniphest Tasks: T6780

Differential Revision: https://phab.enlightenment.org/D5839

Reviewed-by: Cedric BAIL <cedric@osg.samsung.com>
2018-03-15 22:10:27 -07:00
Cedric BAIL 425a447379 eo: fix invalidate to always happen. 2018-03-13 15:29:21 -07:00
Cedric BAIL bae1b25b8d eo: cleanup future on invalidate. 2018-03-12 12:00:27 -07:00
Cedric Bail 626539e6e5 eo: add an helper to get an object from an Eina_Value. 2018-03-12 12:00:13 -07:00
Cedric BAIL a57eca7f02 eo: allow setting value eo Eina_Value from an Eo pointer directly. 2018-03-12 11:59:59 -07:00
Cedric BAIL 34673ab983 eo: ERR some warning when illegally using invalidated object. 2018-03-08 15:46:45 -08:00
Cedric BAIL f1aa23805a eo: when an object is reused, reset the invalidate flag. 2018-03-08 15:07:09 -08:00
Cedric Bail 83251edae7 eo: introduce invalidate and noref state.
This is just a first step. All user of destructor should be updated to
move the code that rely on their efl_parent and on efl_provider_find to
invalidate. Then we will be able to change the way efl_add and efl_del
work to properly refcount things. efl_noref won't be triggered at the
moment until both efl_parent_set(obj, NULL) and the last user ref are
set to NULL. This is not what we want, but due to how user refcount is
accounting parent at the moment, until all the code is move to rely
on invalidate we can not fix this.
2018-03-07 10:56:53 -08:00
Carsten Haitzler 1bdd9e4dd1 ecore - a different take on efl.app class as a super class to efl.loop
so the MAIN loop is actually an efl.app object. which inherits from
efl.loop. the idea is that other loops in threads will not be efl.app
objects. thread on the creator side return an efl.thread object.
inside the thread, like the mainloop, there is now an efl.appthread
object that is for all non-main-loop threads.

every thread (main loop or child) when it spawns a thread is the
parent. there are i/o pipes from parnet to child and back. so parents
are generally expected to, if they want to talk to child thread, so
use the efl.io interfaces on efl.thread, and the main loop's elf.app
class allows you to talk to stdio back to the parent process like the
efl.appthread does the same using the efl.io interfaces to talk to its
parent app or appthread. it's symmetrical

no tests here - sure. i have been holding off on tests until things
settle. that's why i haven't done them yet. those will come back in a
subsequent commit

for really quick examples on using this see:

https://phab.enlightenment.org/F2983118
https://phab.enlightenment.org/F2983142

they are just my test code for this.

Please see this design document:

https://phab.enlightenment.org/w/efl-loops-threads/
2018-03-03 13:40:33 +09:00
Jean Guyomarc'h 91966f1d16 eo: avoid useless computations
Better exploit class constructor and destructor to initialize data once
and for all. This allows not make initialization checks at runtime.
2018-02-25 14:06:52 +01:00
Jean Guyomarc'h 088f9b862f eo: mark more unlikely labels as cold
This is one more hint the compiler can take to spatially isolate
unlikely branches and possibly improving the hot paths.
2018-02-25 14:06:52 +01:00
Cedric BAIL 1eb4d1311e eo: only call costly function _eo_op_desc_name_get when in debug mode. 2018-01-24 15:36:39 -08:00
Vincent Torri f5b01ac5ce all: Simplify definition of EAPI
This will help in the transition from Autotools to Meson. This has been
tested on Windows for which EFL_XXX_BUILD were first introduced.
2018-01-18 18:04:03 +09:00
Jean-Philippe Andre dd2f450ea7 eo: Fix make check
The cache had a generation count, removing this check breaks eo suite.
EO is designed to tolerate init/shutdown cycles (as long as
dlopen/dlclose isn't involved).

Note: the ugly goto are useless as GCC -O2 understands EINA_(UN)LIKELY
and deals with it as expected (just look at the asm produced).

See 34d9f20706
2018-01-16 19:50:52 +09:00
Jean-Philippe Andre 8b4abdcd0e eo: Remove unused goto label 2018-01-16 19:35:54 +09:00
Jean-Philippe Andre f2b5b00ca2 eo: Warn on calls to NULL object
This makes eo print a WRN message in case a function is called on NULL.
efl_del is an exception to this rule (implemented in a hackish way, I
admit). I don't know any language or object model where using a null
object doesn't result in an exception or crash, except EO. In any case,
calls to null are invalid.

The next commits will resolve most warnings for EFL.

Ref T6326
2018-01-16 18:37:05 +09:00
Jean Guyomarc'h 34d9f20706 eina: remove usless newline
Summary:
ecore_evas: remove debug

eina: unregister log level when done with

Fixes a constant memory leak.

eina: introduce EINA_HOT and EINA_COLD

These attributes respectivelly expand to __attribute__ ((hot)) and
__attribute__ ((cold)) when available. They allow to mark functions are
being hot/cold (frequently used or not) as well as to qualify labels
within a function (likely/unlikely branches).

eo: speed-up generated calls by removing call cache

The call cache needed to by thread-local, to avoid concurrency issues.
Problem with TLS is that is adds an extra overhead, which appears to be
greater than the optimization the cache provides.

Op is naturally atomic, because it is an unsigned integer. As such, it
cannot be tempered with while another thread is reading it. When
entering the generated function, the first operation done is reading
'op'. If we have concurrency, we will have access sequences returning
either EFL_NOOP or a VALID op, because 'op' is not set until the very
end of the function, when everything has been computed. As such, we now
use the 'op' atomic integer to instore a lock-free/wait-free mechanism,
which allows to drop the TLS nature of the cache, speeding up the access
to the cache, and therefore making functions execute faster.

We don't test anymore the generation count. This can be put as a
limitation. If means that if you call efl_object_shutdown() and
re-initialize it later with different data, opcodes will be invalid.
I am not sure there is any usecase for this to ever happen.
We could move all the caches in a dedicated section, that can be
overwritten after a call to efl_object_shutdown(), but I am not sure it
will be very portable.

Benchmark: mean over 3 executions of
   ELM_TEST_AUTOBOUNCE=100 time elementary_test -to genlist

```
                     BEFORE               AFTER
------------------------------------------------------------
time (ns)            11114111647.0        9147676220.0
frames               2872.3333333333335   2904.6666666666665
time per frame (ns)  3869364.6666666665   3149535.3333333335
user time (s)        11.096666666666666   9.22
cpu (%)              22.666666666666668   18.333333333333332
```

Ref T6580

Reviewers: raster, cedric

Subscribers: cedric, jpeg

Maniphest Tasks: T6580

Differential Revision: https://phab.enlightenment.org/D5738
2018-01-16 17:50:46 +09:00
Carsten Haitzler f32f0d89f4 mmap memory allocation - do not used when under valgrind
we can't sensibly use things like massif to track memory if we bypass
itr with mmaping -1 fd anonymous memory... so if built with valgrind
support and running under valgrind, use malloc/calloc and free so
these tools actually do something useful for these bits of memory.
2018-01-12 03:02:43 +09:00
Jean-Philippe Andre f285fd5925 eo: Add "destruct" event
Triggered after (almost) complete destruction of the object.

Not called "deleted" because the other event is already "del".
I don't like "destruct" much but this follows the terminology of
"constructor" / "destructor".

@feature
2018-01-10 16:31:06 +09:00
Cedric BAIL 526415d903 eo: make efl_provider_find a @const function. 2018-01-04 11:45:10 -08:00
Cedric BAIL c19ef91020 Revert "efl_loop: move scheduler_get to eo API"
This reverts commit f910ba248e.

The scheduler is meant to be used only in C, not by bindings so there isn't really
a use for it in the loop class. Now this patch was triggered due to complexity in
using future/promise, so will do a follow up patch to improve that.
2018-01-03 11:21:34 -08:00
Andy Williams d280ab7410 docs: Fix eo_add -> efl_add 2018-01-03 14:44:39 +00:00
Andy Williams f910ba248e efl_loop: move scheduler_get to eo API 2018-01-03 12:46:06 +00:00
Andy Williams 5162d66c51 eo: Update grammar and readability 2017-12-20 09:52:31 +00:00
Cedric BAIL 90f30ea418 eina: make __eina_promise_cancel_all an internal only function. 2017-12-18 16:17:04 -08:00
Jean-Philippe Andre 5dbfb7961f eo/eina: Add HACK to avoid calls to EO after shutdown
Efl.Future is an EO object which means even cancelling Efl.Future
objects requires EO. So this should be done before shutting down EO,
otherwise everything fails badly.

I believe Efl.Future is going to disappear soon, but the problem will
remain: if any promise/future uses EO or anything else outside of Eina
(so, basically anything) then it needs to be canceled before shutting
down the above layers. This is the same situation as with ecore events,
for which we've introduced ecore_event_type_flush.

Ping @cedric
2017-12-18 19:54:31 +09:00
Jean-Philippe Andre 69c595b5fd eo: Fix crash with invalid objects
Not a legacy fix as auto-unref is new in 1.21.
2017-12-15 16:17:42 +09:00
Carsten Haitzler 3a703dbf4a eo - set opts hash to NULL after free 2017-12-15 14:16:53 +09:00
Carsten Haitzler c4e96e4e83 eo - fi missed error condition if eoid passed in is NULL
in some cases construction can fail badly and this causes a crash...
eoid is NULL going in and this causes a cascade of failure. survive
and be more robust.
2017-12-15 14:16:53 +09:00
Jean-Philippe Andre 3e9825cb96 eo: Remove trailing newline in ERR message 2017-12-08 16:02:23 +09:00
Jean-Philippe Andre ec8fe2a8f3 eo: Fix warning when Eo.h is used from C++ 2017-12-07 12:48:00 +09:00
Jean-Philippe Andre 3c68a8afc9 eo: Remove unnecessary defines from the EO file
Those promise/future APIs are not required in the EO files.
2017-12-07 11:25:40 +09:00
Jean-Philippe Andre e4797e75f7 eo: Move unnecessary eina type out of the EO file 2017-12-07 11:22:11 +09:00
Marcel Hollerbach f533ab94d8 eo: add definition of function back 2017-12-05 20:53:12 +00:00
Andy Williams b6b0fac978 eo: Update header for readability
Author: Nate Drake
Reviewer: Andy Williams
2017-12-05 17:04:19 +00:00
Jean-Philippe Andre 207a0cf3e3 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).
2017-12-05 15:06:34 +09:00
Carsten Haitzler 74327ddbc8 eo - by default on 64bit only use 47 bits because of luajit
luajit wants to check the upper 17 bits of pointers and assume they
are all 0 if on a 64bit architecture. it will panic and barf if they
are used. we have been using them in our eoid's for a long time.

my take on this is that this is unportable. assuming how many bits are
or are not valid in an opaque pointer (void *) that is simply passed
to you and you cannot dereference or use (no size information even for
what amount of data it points to etc.), is just wrong. it's not
portable and it's trying to be too smart and creating such issues. my
take is that luajit needs a fix for this in the longer term. but for
now let's have a 47 bit mode and go with that. it does mean i have to
drop our generation counter to 10 bits on 64bit (from 27 bits) which
increases likelihood of eoid re-use being falsely detected as valid
(before on 64bit it was 1 in 130 million or so chance, with this 47
bit change it's 1 in 1000. but to be fair on 32bit it's 7 bits for gen
count so 1 in 127 ... so still more than 10x "safer" than on 32bit...
but still...). the relevant check in luajit is:

  (((uint64_t)(p) >> 47) ? (lj_err_msg(L, LJ_ERR_BADLU), NULL) : (p))

it ONLY does this on 64bit. on 32bit pointers are not checked for
validity at all.

as an aside, armv8.2 seemingly will bring 52bit addresses so luajit is
going to fall over flat on a newer rev of armv8. it may be x86 also
uses more bits. last i knew it was 48bits so the 47 bit check luajit
does i think is even wrong for x86-64. to be detailed i read:

amd64 arch == 48 bits (so luajit is wrong). even better In addition,
the AMD specification requires that the most significant 16 bits of
any virtual address, bits 48 through 63, must be copies of bit 47 (in
a manner akin to sign extension). so if the upper bit of 48 is set
THEN all the 16 upper bits must be 1... breaking luajit, even if it
were 47bit and this rule applied. I read the architecture allows for
up to 52bits of actual addresses so architecture-wise this is even
wrong...

So I smell a core bug here in luajit. Certainly in the number of bits
it insists must be 0 (the upper 17 bits where on amd64/x86-64 it
should be the upper 16 bits... and even then these may NOT be 0 if bit
47 (the upper bit of the lower 48 is 1).... so the whole check is
invalid... :(

at least the above is at a theoretical level. i believe that the
addresses divide the 48 bits into 2 chunks (thus 47)... but at the
PHYSICAL level with no mmu and virtual memory. arm64 has this:

https://www.kernel.org/doc/Documentation/arm64/memory.txt

note in all cases the 2nd chunk of memory has at leats some upper bits
of physical addresses beign 1 ... which makes luajit invalid tyo use
without virtual memory remapping these away from high bits.

@fix
2017-11-24 18:29:23 +09:00
Jean-Philippe Andre 7e785d936d eo: Make sure auto_unref only applies after finalize
It would be pretty stupid to create an object that dies before it even
gets created. Auto-unref is for parts and should probably not be used
anywhere else :)
2017-11-24 16:15:44 +09:00
Marcel Hollerbach 2ba64efe62 Eo: be a bit more detailed in the docs
this is completly not obvious. But now its documented.
2017-11-17 16:08:14 +01:00
Andy Williams d5dbcdabd1 eo: Rename efl_ref_get to efl_ref_count 2017-11-08 09:30:42 +00:00
Carsten Haitzler eb67a08c8d eo - fix freeq usage to not use freeq for a vtable cleaning
the freeq can't allow things to access the content of the pointer
because the content canbe written over by canary handling qhen
submitted to the freeq. clear it inline then just submit the final
pointer to the freeq.

@fix
2017-11-07 17:36:57 +09:00
Cedric Bail 769a970be0 eo: fix typo.
Thanks Gustavo.
2017-11-04 13:26:21 -07:00
Cedric Bail b7066e3352 eo: add helper to manipulate Eo object as Eina_Value. 2017-11-03 15:31:31 -07:00
Cedric Bail a1e9497461 eo: refactor use of efl_replace. 2017-11-03 15:31:31 -07:00
Daniel Kolesa 4f5b72a3ed eo files: convert various to use @cref 2017-11-02 16:41:01 +01:00
Jean-Philippe Andre df304d0155 eo: Add beta API for auto_unref after a call
Before screaming in horror (C++...) here's why we may need this:
Efl.Part.part API returns an object that is by definition valid for a
single function call only. Enforcing this in practice is actually quite
hard as all implementation functions must manually take care of the
life-cycle. This is a lot of code in many places and a lot of
opportunities to forget to properly handle that life-cycle. Also, this
means any invalid function call on a part will leak an object.

This API absolutely must remain either "internal" or "beta" and
definitely not become abused by applications. On top of that such an API
can cause great trouble for bindings like C++. As a consequence, only
specially crafted APIs like efl_part() should return an object marked as
auto_unref.

Alternatively this API could be defined in Eo.h or some other
Eo_Internal.h. I placed it in efl_object.eo because it's much more
convenient :) (read: I'm lazy)

****

Performance notes:

Tested with clang & gcc (with -O2), I had a look at the output of perf
top, in particular the asm view. I used eo_bench in a loop. My
conclusions are:

- EINA_LIKELY/UNLIKELY actually works. The jump statement varies
  according to the expectation. I highly doubt all those ugly goto in
  eo.c / Eo.h are even useful.

- The impact of auto_unref on a call_resolve is so small it doesn't even
  appear in the trace. It is significant inside call_end, though
  (obviously, that function is just a few lines long). That function
  accounts for ~1% to ~4% of all CPU time. The impact of auto_unref in
  call_end is ~4% of the function time. This means ~0.16% of all CPU
  time (worst measured case). _efl_object_op_api_id_get simply doesn't
  show up because of caching, so the extra check there is negligible.

PS: I also tested EINA_LIKELY/UNLIKELY by compiling with -O2 and looking
at the output with objdump. The flag is well respected, and the jump
instructions are what you would expect (no jump for LIKELY and jump for
UNLIKELY). Conclusion: The goto's in eo.c only make the code harder to
read...
2017-10-18 11:02:16 +09:00
Lauro Moura b7ab2ac1ed eo: Use any_value in eina_types.eot
Reviewers: q66, jpeg

Subscribers: jenkins, cedric

Differential Revision: https://phab.enlightenment.org/D5328
2017-10-17 17:31:38 +09:00
Jean-Philippe Andre ccee1c0944 eo: Simplify debug_name_override
Simply pass in the strbuf and don't expect the callee to own it. This
makes things simpler and safer (it'll crash only if the callee frees
said strbuf, and shouldn't leak). efl_ebug_name is new in the upcoming
release, EFL 1.21.

Realised this after talking with Amitesh. Thanks.

See 999dbd9764
And c4769ff898
2017-10-13 10:57:00 +09:00
Marcel Hollerbach 8e4d0d70e9 eo: introduce function definitions with fallback
there can be cases where the call to such a function is never going to
be directed to the actual implementation. In those cases the FallackCall
will be called.
2017-09-29 11:00:37 +02:00
Jean-Philippe Andre d3436af616 eo: Add API to allow deletion by unref
This allows deleting an object by simply calling efl_unref() on it, even
if there is a parent. Normally the parent is in charge, and you can
request deletion by calling efl_del() or efl_parent_set(NULL).

But in some rare cases, you want to give ownership of an object (@owned)
and still give a parent to that object. efl_unref() should be used (and
would be used by bindings when going out of scope or on garbage
collection), which would then print an error message. This API allows
the specific behaviour.

@feature
2017-09-28 16:42:04 +09:00
Jean-Philippe Andre 662a172139 eo_debug: Allow disabling of backtraces
export EO_LIFECYCLE_BACKTRACE=0

This means that the lifecycle can be tracked but we don't care about the
backtraces. Related to some recent eo_debug patches.
2017-09-28 16:15:07 +09:00
Jean-Philippe Andre 008ec97d84 eo: Allow efl_reuse to be called with a parent
If an object still has a parent inside the del intercept, we shouldn't
reset the "parent_sunk" flag. This would indeed break logic as
parent_sunk == false implies that a parent was never set, which means
the parent must be null. Right now this case isn't used but it can be
imagined with caches of evas objects (they should remain parented to
their evas).

@fix
2017-09-28 16:10:53 +09:00
Jean-Philippe Andre 902938f626 eo: Fix unnecessary ERR logs with eo_debug
efl_data_scope_safe_get() is often used to assert that an object is of a
certain type, but assuming it may be NULL or not of the required type.
This means that encountering an invalid type is an error handled by the
caller (we return NULL), and shouldn't print out extra ERR() logs.

This fixes issues with E run under eo_debug. E's code was safe as it's
using evas_object_smart_data_get() and verifies whether the returned
value is NULL (which is expected for a rectangle, for instance).

@fix
2017-09-28 12:30:36 +09:00
Jean-Philippe Andre 3dc140abfb eo_debug: Also print out the current backtrace
We can't use EINA_LOG_BACKTRACE=1 for that as eo_lifecycle itself prints
out ERR messages for its backtrace dump.
2017-09-28 12:30:36 +09:00
Jean-Philippe Andre 213821240b eo_debug: Enable logging of all ref/unref
This is done via the syntax (not documented yet):

  EO_LIFECYCLE_DEBUG=N:<class names>

Where N is:
 1. new/free
 2. new/free/ref/unref
 3. new/free/ref/unref/reuse

@feature
2017-09-28 12:30:36 +09:00
Jean-Philippe Andre 0ae529ac19 eo: Fix crashes with call cache after init cycle
It's not enough to check the init generation count, if the cache data is
not reset properly.

This patch adds safety in two ways:
 1. Actually reset the op call cache when we detect a new generation
 2. Verify that we don't return NULL function pointer

The 1st point is absolutely necessary, 2nd is optional (extra cost of
one if()).

@fix
2017-09-26 17:58:07 +09:00
Daniel Kolesa fdd27cadf8 eo: make more freefuncs implicit 2017-09-22 16:17:19 +02:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05:00
Jean-Philippe Andre 986e5e8827 efl: Add precise_position for input events
The previous commit removed useless delta
2017-09-19 10:51:48 +09:00
Jean-Philippe Andre f3eff6eb3e efl: Introduce Eina.Rect and switch EO APIs to it
It's a complex struct but defined in EO as a simple struct. ABI-wise
it's equivalent to Eina_Rectangle. Some macros that use Eina_Rectangle
also work on Eina_Rect out of the box, most of the code dealing with
x,y,w,h will require no modifications either.

But Eina_Rect provides direct access to a size or position 2d component,
as well as the usual x,y,w,h. The field "rect" is provided as a
convenience for code dealing with both Eina_Rectangle and Eina_Rect. We
may or may not require it.

Note: Size2D could use unsigned values but I have spotted a few places
in the code that actually use -1 to indicate invalid size (as opposed to
0x0).

@feature
2017-09-18 13:22:52 +09:00
Jean Guyomarc'h 76144128ce eo: fix doxygen typo 2017-09-16 14:28:39 +02:00
Daniel Kolesa a8b8b7efde eo files: first batch of @owned conversions 2017-09-15 16:44:26 +02:00
Jean-Philippe Andre 76bc13530a eo: Add class name to error log (unref) 2017-09-13 09:57:05 +09:00
Gustavo Sverzut Barbieri 8e80d3d2dc export efl_future_then() for Eina_Future syntax sugar.
This is actually written as efl_future_Eina_FutureXXX_then() as the
old API clashes, after removing the old code we'll "sed" to fix those.
2017-09-04 10:24:00 -03:00
Guilherme Iscaro d12c652a96 Efl_Object: Add integration with Eina_Future.
This commit adds the EO support for the new future infra.
From now on there's no need to efl_future_link()/efl_future_unlink()
object and futures since the new API already handles that internally.
2017-09-04 10:24:00 -03:00
Guilherme Iscaro 5bd8c9a78d Eina: Add Eina_Promise/Eina_Future.
This commit adds a new promise/future API which aims to replace
efl_future.
2017-09-04 10:24:00 -03:00
Jean-Philippe Andre c071fd453b eo: Mark name_find as const
The search should not require a mutable object.
See the previous commit on elm_widget.
2017-08-23 20:53:20 +09:00
Jean-Philippe Andre e8826062eb eo: Define Efl.Event in EO
This can be used in the widgets propagation mechanism later. I don't see
any really good reason to not define this struct in EO anyway.

Ref T5363
2017-08-23 11:16:45 +09:00
Cedric Bail 87acc90fc7 eo: only return NULL when the object is destructed.
There is a problem with the previous version. The object can still be
alive due to the use of manual_free in evas. So you wouldn't be able
for example to remove a callback from an object that hasn't been
destroyed yet. If that callback is triggered by the destruction
of the object, you would end up with an unexpected and impossible to
prevent effect of access after free on a callback that you had removed.

Not sure if that still solve the original problem that the code was
trying to prevent in Ecore_Evas.
2017-08-13 13:18:04 -07:00
Jean-Philippe Andre e2f8ba7ad9 eo: Check refs in efl_data_scope_safe_get
This makes sure the object is actually still alive and kicking before
returning any data. Otherwise the "safe" word is a bit of an abuse...

Ref T5869

@fix
2017-08-11 11:22:11 +09:00
Jean-Philippe Andre 8b3c1eb069 eo: Add a space in documentation
This separates the brief and the content.
2017-08-09 12:21:42 +09:00
Jean-Philippe Andre d5ad85abae eo: Fix memory leak with overrides
See 0834511067
And b7840d9177

Ref T5580
2017-08-08 11:28:59 +09:00
Cedric BAIL b7840d9177 eo: temporary prevent segfault.
In some case, detected during eo test suite, the vtable does fail to
be fully assigned, but it is still being assigned as the new vtable.
Of course when later destroying it, it has already been freed. Leading
to a double free.
2017-08-07 10:42:45 -07:00
Jean-Philippe Andre 999dbd9764 eo debug name: Use strbuf instead of slstr
This should be a little bit more efficient, even if more "risky"
in terms of leaks. The final API still looks exactly the same.
2017-08-04 10:24:03 +09:00
Jean-Philippe Andre c4769ff898 eo: Add debug_name read-only property to ease debugging
This will include the following information, by default:
 - class name
 - whether the class is an override
 - eo id (pointer)
 - refcount
 - name if one was set (Efl.Object property)

This also supports classes, which is why it's an EAPI in eo.c
and not only a method of Efl.Object

This can be overriden by subclasses using the empty method
Efl.Object.debug_name_override.get

If the function is overriden, then the returned string is used
as is and so it is left to the subclass to include all the
necessary information (as above). This can easily be achieved
by calling efl_debug_name_get(efl_super()) and then concatenating
the strings.

Think of this function as something like Java's toString(), but
only for debugging (i.e. a string class should not just return
its string value).

@feature
2017-08-04 10:24:03 +09:00
Jean-Philippe Andre 0834511067 Eo: Allow multiple functions overrides
This allows two things:
 - adding new override functions on an object that already has
   overrides
 - resetting a specific function (or list of functions) to the
   parent class implementation by passing NULL as implementation

Fixes T5580

@feature
2017-08-04 10:24:03 +09:00
Jean-Philippe Andre 7231a3295b eo: Fix deadlock due to the shared mutex
Explicit lock / unlock of the shared mutex mixed with implicit
lock / unlock when accessing the internal Eo_Object data lead
to uncaught issues such as these.

This was found by trying to run E with gfx filters under eo_debug.
2017-07-19 15:44:49 +09:00
Marcel Hollerbach 68eba4817a eo: clarify what extensions are. 2017-07-18 17:51:38 +02:00
Jean-Philippe Andre 40029ce70a eo: Don't resolve function calls for NULL objects
eo_function(NULL) always leads to a no-operation. A this
point it is basically considered the normal operation
with EO to just silently ignore NULL errors.

If the API function "eo_function" belongs to a class that
has not been loaded yet (eg. no object of this type has
been created yet), then the op associated to the API func
may not be defined yet.

Fixes T5715
2017-07-12 11:20:59 +09:00
Jean-Philippe Andre 5a98f78ce8 eo: Improve invalid EO ID error message
This focus on the domain and ID bits is very confusing. Let's
keep it at the end of the message, and also try to guess whether
the object may have been deleted or simply doesn't belong to the
current thread.
2017-06-22 13:19:23 +09:00
Jean-Philippe Andre b96722cfb8 eo: Add API efl_data_scope_safe_get
This is a safe version of efl_data_scope_get, meaning that it will
return NULL if the object is not of the required type, or if there
is no data for that class, or if the given class was used as an
interface (and isn't a mixin).

@feature
2017-06-14 16:54:11 +09:00
Daniel Zaoui 3107e0d3eb Eo: add APIs to walk over classes and objects
These APIs are needed by Clouseau to get a list of classes and objects.
2017-06-05 08:55:38 +03:00
Jean-Philippe Andre ac3abd1f5b eo: Make efl_cast() return NULL if invalid cast
This makes it work like C++ dynamic_cast<> operator, so that
the return value will be NULL if the object is not an instance
of the given class.

In case of efl_super() we don't do it as efl_super is used A LOT
inside EFL itself (all constructors & destructors, for a start)
and efl_isa is in fact a bit expensive. efl_cast isn't really used
and is intended to be something like dynamic_cast.

For @cedric :)
2017-05-29 13:29:03 +09:00
Carsten Haitzler 1d0b37a9e6 eo - eoid - finally rtemove option to not have eoid. it doesn't work
we use too many bits for metadata now so eoid is broken... remove it
as an option so people dont break out the foot guns
2017-05-17 15:04:01 +09:00
Marcel Hollerbach 5b8421c550 eo: fix missing event emission
There have been cases where the logic of _event_callback_call break'ed
too early in the event submission.
Reason for that was the line ((const unsigned char *) desc -
(const unsigned char *) it->desc) producing a overflow.

This means the if statement

if (!legacy_compare &&
   ((const unsigned char *) desc - (const unsigned char *) it->desc) < 0)

was true while the pointer desc was smaller than it->desc, which means
the event subscription got aborted, even if it should not.

This turned out on two 32 bit maschines. And led to not rendering apps
anymore.

It was introduced by commit in 605fec91ee.

@fix
2017-05-04 20:44:42 +02:00
Daniel Kolesa 6af8527117 eo: move all the key_ properties to C 2017-04-26 16:19:06 +02:00
Daniel Kolesa 20d1cf94c3 eo: move wref_add/wref_del to C 2017-04-26 16:19:06 +02:00
Daniel Kolesa 67c7eb3134 eo: move future_link to C 2017-04-26 16:19:06 +02:00
Daniel Kolesa 3fb4bc336e eo: hide dbg_info from eo files
Continues b780cf2af2.
2017-04-21 17:59:32 +02:00
Daniel Kolesa da43c63ce1 eo: move event related structures and callback to C
We don't need to keep this in eo files anymore because the APIs
using them are now fully in C. This also allows removal of the
event callback builtin from Eolian.
2017-04-21 15:48:31 +02:00
Daniel Kolesa b780cf2af2 eo: move unbindable event APIs to C
In a few classes, this requires some manual expansion. This should
not break anything but it's also fairly ugly; a better solution
would be appreciated, for now we do this.

Similar changes will be done to a few other Efl.Object APIs as
well at later point.
2017-04-20 18:24:38 +02:00
Daniel Kolesa da982535f6 eo: move Efl_Event definition back to C
It's not used anywhere in eo files and has a void pointer.
2017-04-20 16:15:22 +02:00
Jean-Philippe Andre ec71288548 eo: Micro-optimize function calls
This is related to the previous changes to efl_super.
2017-04-19 14:44:14 +09:00
Jean-Philippe Andre 9a81165830 eo: Remove super bit from eo id
It is not required anymore as the super class and super bit can
be stored inside the object data. See the previous patches.
2017-04-19 11:41:15 +09:00
Jean-Philippe Andre 28d785ccb8 eo: Add docs for efl_super and efl_cast (doxygen) 2017-04-19 11:35:48 +09:00
Jean-Philippe Andre 19b9234f23 eo: Add new API efl_cast
This is similar to efl_super but the specified class is the one
we want to call the function on. This is similar to dynamic_cast<>
in C++.

Note: both efl_super() and efl_cast() need documentation!

This is an experimental feature.

Fixes T5311

@feature

Maniphest Tasks: T5311

Differential Revision: https://phab.enlightenment.org/D4797
2017-04-19 11:15:30 +09:00
Jean-Philippe Andre 85636658e0 eo: Remove lock from efl_super
I've always really disliked this lock. If someone calls a non-eo
function by accident with efl_super() then you'll most likely end
up in a deadlock.

This adds the cur_klass pointer to the object itself, exploiting
the fact that we have 8 bytes of padding (on 64 bits, at least).

Also, this opens the door to efl_cast() which would be similar to
efl_super() except that only a dynamic cast is done, not a call
to the parent function.

make benchmark shows a performance improvement, surprisingly.

This is a bit experimental. See also the following commit (efl_cast)
2017-04-19 11:04:12 +09:00
Jean-Philippe Andre 86d1f2b6cd eo: Use COW to save 8~16 bytes per object
Summary:
This uses Eina_Cow to implement support for rarely used features
in EO objects. This covers:
- composite objects (eg. UI widgets: combobox, text, video, win)
- vtable for efl_object_override
- del_intercept

All of these features are quite tricky to get right and while
very useful, should still be used with great care. With this patch,
the size of an _Eo_Object struct comes down from 80 bytes (rounded
up from 72b) to 64 bytes (rounded up from 56b) on 64 bits.

Also I haven't measured precisely but I don't expect any performance
impact since the COW data is more likely to remain in L1/L2 cache,
as the default one will be used most often. Unfortunately, the
results of "make benchmark" have been quite inconsistent over
multiple runs.

This saves ~64kb in elementary_test (>4k objects) at the cost of
~100 calls to COW write (del intercept on some events).

@optimization

Reviewers: raster, cedric

Differential Revision: https://phab.enlightenment.org/D4796
2017-04-18 18:52:27 +09:00
Jean-Philippe Andre d6d4c3c25b eo: Fix crash in case of API misuse
If efl_object_override() is called with a function that does
not exist in the original class, it may lead to a crash on
indexing an non-existing array in the vtable.

This is really just a safety check, as the usage was wrong:
 * You are only allowed to override functions that are defined in the
 * class or any of its interfaces (that is, efl_isa returning true).
2017-04-18 15:34:29 +09:00
Jean-Philippe Andre 9dc0a15499 eo: Make _eo_obj_pointer_done an inline function
@optimization
2017-02-21 10:52:39 +09:00
Marcel Hollerbach ae80040331 eo: ensure the generation is correctly clamped
Summary:
when a few recursive event emissions are happening, and in some deep
recursive level a subscription to the same object is happening, the
subscription would just be executed when the complete recursion is done.
that is wrong. The subscription needs to be executed when the event is
called after the subscription is added, undepended from any recursive
level. That fixes that and adds a regression test for it.

This was discovered in e, since e gives a lot of error messages about a eo object
that is already freed. It turned out this object is returned from evas, and exactly
the above happened to the EFL_EVENT_DEL subscription of that object.

Test Plan: make check

Reviewers: tasn, cedric, stefan_schmidt

Subscribers: stefan_schmidt, netstar, zmike, raster, jpeg

Differential Revision: https://phab.enlightenment.org/D4656

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-16 13:37:19 -08:00
Jean-Philippe Andre 8947caf120 eo: Fix shadow variable warning 2017-02-15 20:11:22 +09:00
Jean-Philippe Andre 63eb9a28b3 eo_debug: Remove some abusive goto where not needed
goto was used for micro-optimization. There is absolutely no
need for those if we're using the slow path with eo_debug.

Simplify the code.
2017-02-15 15:35:38 +09:00
Jean-Philippe Andre a11836b5a1 eo_debug: Some more log improvements
Nothing fancy here...
2017-02-15 15:35:38 +09:00
Jean-Philippe Andre 2e96b5074d eo_debug: Improve dangling xref debug logs even more
In case of manual free, as is heavily used by Evas, we can't really
print an ERR if there are still references before free has been
called.

This may not be ideal from a pure EO point of view but considering
how Evas uses manual free this is the best solution to avoid
polluting debug logs.
2017-02-15 14:50:50 +09:00
Jean-Philippe Andre a5535464bf eo_debug: Improve one log
This changes the following message when the object is referencing
its own data. Also lowers from ERR to WRN and adds the class
name for the referenced data.

ERR<17450>:eo /home/jpeg/e/core/efl/src/lib/eo/eo_private.h:337
  _efl_unref_internal() in /home/jpeg/e/core/efl/src/lib/eo/eo.c:620:
  func '_efl_object_call_end' Data of object 0x400000021008db58 is
  still referenced by object 0x400000021008db58

Note that evas and elm have a few calls to efl_data_ref(obj, NULL)
which are imho quite ugly: not using the return value and not
specifying the data class. I'm keeping them as-is for now.
2017-02-15 14:01:06 +09:00
Stefan Schmidt 337e8f1ab4 eo: add missing since tags for functions added during 1.19 cycle 2017-02-14 21:47:15 +01:00
Carsten Haitzler 6d4b85f820 eo base - fix warnings for debug logs to get format string types happy
gcc is very unhappy with these log prints - specifically on arm 32bit.
this fixes it so we can focus on real warnings/issues.
2017-02-12 00:32:16 +09:00
Carsten Haitzler eb3f6f06f1 efl base class - fix warning about comparing differing sizes
yes - we compare a difference between 2 ptrs and an index which is a
uint. the safe thing here is to promote the unit to the ptrdiff_t
type. reality is we cant have more than 2^32 cb's on an object
anyway... so this should be ok.
2017-02-11 23:13:00 +09:00
Marcel Hollerbach 15b0d0dd12 efl_object: document when callbacks are called 2017-02-10 18:50:41 +01:00
Stefan Schmidt 09352f0a6d docs: eina: add doc for new eina value type 2017-02-09 14:47:22 +01:00
Larry Jr 093c592188 efl: add efl_model and efl_ui_view classes
Efl.Model.Container and Efl.Model.Item to efl/interfaces are used
to create Efl.Model objects with predefined property values.
This is useful to any situation where we want an Efl.Model with
explicit defined property values.

Efl.Ui.View and Efl.Ui.Factory are used to connect Efl.Models with
Widgets, Elm.Layout and Efl.Ui.Image has changed to use news interfaces

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2017-02-06 15:26:21 -08:00
Gustavo Sverzut Barbieri 3813044ef6 cmake/eo: add description (fills eo.pc file) 2017-01-23 19:34:39 -02:00
Marcel Hollerbach 27504d7db0 cmake: add eo 2017-01-23 20:02:06 +01:00
Carsten Haitzler ccc68f0719 eo - remove the spare eo domain for now for future expansion 2017-01-12 13:08:57 +09:00
Gustavo Sverzut Barbieri 3680ae0bab eo_debug: print tracebacks for more errors.
If eo_debug (libeo_dbg/EO_DEBUG), then print tracebacks if lifecycle
is being tracked.
2016-12-20 10:18:31 -02:00