Commit Graph

69 Commits

Author SHA1 Message Date
Daniel Kolesa 4f4b58bf4c efl: change all occurences of @owned to @move 2019-09-06 17:01:05 +02:00
Xavi Artigas dc05cbbee8 docs: Fix typos and wrap EO files to 120 chars
As per our style guide:
https://www.enlightenment.org/contrib/docs/eo-guide.md
2019-09-02 16:24:26 +02:00
Daniel Kolesa 9c018613ee eolian: drop @cref
In the end this was just a failed experiment that didn't turn
out to be practical. For now, revert back to ptr(const(T)) until
a proper replacement for pointer syntax is added.
2019-08-29 13:58:16 +02:00
WooHyun Jung cfc1d3d38b efl_object: set @beta to name_find
This property should not be used by application developers
with current status.
There is no way to trace child objects from parents, because
many codes are internally calling efl_parent_set.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9768
2019-08-28 18:08:32 +02:00
Daniel Kolesa 8a8a833837 eolian: rename @class on methods to @static
Ref https://phab.enlightenment.org/T8118
Ref https://phab.enlightenment.org/T7675
2019-08-16 16:27:00 +02:00
Daniel Kolesa d964a04da1 eo: remove Efl_Event definition (replace with builtin) 2019-07-26 13:21:14 +02:00
Cedric BAIL 9e6d3b44e6 eo: add ability to register provider on the Eo object directly.
This should reduce the need for custom implementation of efl_object_provider_bind.
It also enable the ability to register provider from user code on any Efl_Object.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9292
2019-07-17 21:57:53 +02:00
Daniel Kolesa fbdbf6b132 eolian: add builtin binbuf and event types
Binbuf is like strbuf and allows not using the Eina opaque wrapper
now, which will remove some ptr(). And event translates to
Efl.Event because otherwise there would be no way to get rid
of void_ptr.
2019-07-17 15:52:39 +02: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
Daniel Kolesa 13ddc5dbc1 eolian: rename @warn_unused and its associated API
@warn_unused in syntax is now called @no_unused - this is because
"warning about unused" is a C thing (or rather, an extension to C)
and various languages might want to use stricter behavior for this.

Its associated API does the reverse now - it lets you query whether
being unused is allowed at all. This is to match future behavior
of Eolian (once it supports versioning) that will likely reverse it.

@feature
2019-05-26 17:41:22 +02:00
Daniel Kolesa d0fed247bb eolian: remove param @nonull
This has been deprecated for a while and is not strictly necessary
- as a part of an effort to stabilize Eolian, remove this. Eolian
will eventually gain support for versioning and use a reversed
behavior (i.e. no NULL by default), but the API it wlll use for
that will be very different. Features can always be added, it's
much harder to drop them.

@feature
2019-05-26 17:25:15 +02:00
Daniel Kolesa 5ea0195661 eolian: remove @nullable keyword
This was an experiment that never properly took off and was never
used by any generator. Its use was highly variable, so it could
not be relied upon. We will still want to reverse the current
behavior eventually (no null by default), but that will be
done with eo file versioning in the future.

@feature
2019-05-21 16:04:35 +02:00
Daniel Kolesa 6312cafe20 eolian: move from eo_prefix to c_prefix 2019-05-09 16:17:44 +02:00
Xavi Artigas 57da0bee3d docs: Fix common misspellings in EO files
Fixed all appearances of words from this list in EO files:
https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2019-04-02 11:32:05 +02:00
Xavi Artigas 9f1cd60aeb docs: Document event info calling convention
Both at the emitter (efl_event_callback_call) and the receiver
(info field in the Efl.Event structure).
The Events tutorial should repeat this.
Fixes T7760

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8486
2019-03-28 09:39:40 +01:00
Xavi Artigas 205193f1ab docs: Add @since 1.22 to all stable classes' EO docs
Summary: Previous @since tags have already been removed from eo files.

Test Plan: Everything builds, but stable classes now have Since tags in the docs.

Reviewers: zmike, bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8446
2019-03-22 16:57:36 +01:00
Xavi Artigas bbd4b6e514 docs: Remove obsolete @since tags from EO files
Summary:
All legacy @since tags have already moved to the *.legacy.h files.
EO files are now devoid of @since tags (except some eldbus still
needed for legacy).
Upcoming patches will add @since 1.22 to those APIs which come out
of beta in this release.
APIs marked @beta do not need @since tags.

Test Plan: Everything builds, EO docs (like DocFX) have no Since tags.

Reviewers: zmike, bu5hm4n, lauromoura, cedric

Reviewed By: cedric

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8430
2019-03-20 20:16:05 +01:00
Marcel Hollerbach 999ed5f200 eo: mark efl_object stable
fix T7557

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8000
2019-03-06 11:34:53 -08:00
Xavi Artigas 333330a6e5 Mark BETA classes individually
Summary:
Instead of surrounding all the #include "*.eo.h" lines in Efl.h
with #ifdef EFL_BETA_API_SUPPORT, include these files unconditionally, but mark
all classes as @beta in the eo files.
This will allow taking them out of beta one by one as we deem them stable enough.
Otherwise, the current procedure involves moving the #include line out of the
ifdef block, which is cumbersome and messes include order.

Depends on D7950
Fixes T7692

Test Plan: Nothing changes

Reviewers: zmike, bu5hm4n, cedric

Subscribers: #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7692

Differential Revision: https://phab.enlightenment.org/D7951
2019-02-14 17:46:50 +01:00
Marcel Hollerbach 1fabc8fb99 eo: declare Eo stable
Summary:
This declares the main part of Eo.h as stable, except the domain api for
now. We don't have a user of that API for now, nor do we have bindings
supporting threads, lets wait with this bit until we have bindings for
this, so we can test it.

Further more, this does not stabilize the composition API of
efl_object.eo.h, reason for this is, that we might want to overthink the
solution we have with events, as we might want to forward events per
default.
Depends on D7931

Reviewers: stefan_schmidt, cedric, zmike, segfaultxavi

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7932
2019-02-14 15:24:45 +01:00
Xavi Artigas 8985222f47 docs: Update efl_object lifecycle docs
Summary:
Explained the different phases, added method refs and removed outdated links.
Ref T7557

Reviewers: zmike, bu5hm4n

Reviewed By: bu5hm4n

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7557

Differential Revision: https://phab.enlightenment.org/D7903
2019-02-11 14:16:48 +01:00
Lauro Moura 5f1b448323 eo: Replace ptr(Eina.Strbuf) with plain strbuf.
Summary: Also fix CXX compilation after this change.

Reviewers: cedric, felipealmeida

Reviewed By: felipealmeida

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7792
2019-01-28 16:15:09 +09:00
Xavi Artigas 213a842d52 docs: Fix Efl.Object Freeze and Thaw docs
Summary: Fixes T7641

Test Plan: Only docs affected.

Reviewers: zmike, cedric

Reviewed By: cedric

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T7641

Differential Revision: https://phab.enlightenment.org/D7707
2019-01-25 13:36:44 +01: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 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 35acfebee4 eo: provider find actually is just accepting Efl.Class, maybe an hystoric left over.
Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com>
Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de>
Differential Revision: https://phab.enlightenment.org/D7440
2019-01-09 11:02:05 -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
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
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
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
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
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 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
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
Andy Williams d280ab7410 docs: Fix eo_add -> efl_add 2018-01-03 14:44:39 +00:00
Andy Williams 5162d66c51 eo: Update grammar and readability 2017-12-20 09:52:31 +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
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
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
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
Daniel Kolesa a8b8b7efde eo files: first batch of @owned conversions 2017-09-15 16:44:26 +02: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
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 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