Commit Graph

316 Commits

Author SHA1 Message Date
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 38612b5490 eo: lets drop efl_interfaces
its not required anymore, our wonderfull new syntax solves the original
problem it was trying to solve.

fixes T7565

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7893
2019-02-08 10:27:27 +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
Marcel Hollerbach 3009bee9ee eo: remove whitespaces
remove the whitespaces from this file. Every editor in this world
removes unneccessay whitespaces at the end of a line. So every time i am
touching this header, i need to get rid of them, which is super
annoying. I know we are used to *not* doing such patches, but this is
just a waste of time, getting them out of the header every and every
single time.

Differential Revision: https://phab.enlightenment.org/D7880
2019-02-06 10:01:02 +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
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 b8e352cde7 eo: improve documentation for event forwarder.
Reviewed-by: Xavi Artigas <xavierartigas@yahoo.es>
Differential Revision: https://phab.enlightenment.org/D7532
2019-01-10 11:13:49 -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
Marcel Hollerbach efd0efb316 eo: move definitions of priority from Eo.h to the object
So it can be references from the later coming definition of
callback_forwarder

ref D7532

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7542
2019-01-04 11:03:38 -08:00
Cedric BAIL dfd09ec7e4 eo: enable priority with event forwarder.
Note: Their isn't any ability to do something like a static array of
events at the moment. It might lead to large memory being used when it
wouldn't be necessary. If that was the case, we could fix it, but it
would require a lot of dynamic hash operation I think.

Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7482
2019-01-02 13:39:14 -08: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
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
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
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
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
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
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
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 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
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
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 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 356e37564a eo: handle NULL nicely in efl_replace. 2018-05-01 10:39:01 -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
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
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 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
Jean-Philippe Andre ec8fe2a8f3 eo: Fix warning when Eo.h is used from C++ 2017-12-07 12:48:00 +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
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
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
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 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
Jean Guyomarc'h 76144128ce eo: fix doxygen typo 2017-09-16 14:28:39 +02: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
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
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
Marcel Hollerbach 68eba4817a eo: clarify what extensions are. 2017-07-18 17:51:38 +02:00