Commit Graph

73 Commits

Author SHA1 Message Date
Carsten Haitzler 5dd52fd09b ecore - begin moving data into the efl loop data in the object
we really should have data inside the loop object, so begin moving it
one small thing at a time. this is the basics that will allow multiple
efl loops. make an eo efl object and class for fd handlers that is efl loop
bound make fd handlers really bound to their parent loop and not global  as
well as have a nice class/obj. create an message queue per loop and
put legacy ecore events on top of it... and a lot more.

this is not 100% done, but it's a lot of the core and groundwork.
various ecore_timer_add(), ecore_diler_add() etc. need changes.

The following still need doing:

  ecore_timer (internal usage for sure)
  ecore_idler (internal usage for sure)
  ecore_idle_enterer
  ecore_idle_exiter
  ecore_pollers? (is the new efl loop stuff ok?)
  ecore_exe (fork/spawn from any thread and track exe from that thread?)
  ecore_signal code
  ecore_throttle (should we have a single global too? we have per loop)
  ecore_app ? (should every loop be given its own argv/argc?)

Lots of internal ecore code uses/calls these legacy calls and we
should have efl loop replacements and/or use the ones we have

The following will bedifferently designed for loop to loop
control/messaging/ipc:

  ecore_thread
  ecore_pipe
2017-12-15 14:16:53 +09:00
Pawel Aksiutowicz c41480e46c ecore: munmap() call get size of the same type as nmap() call in "len" argument
Reviewers: stanluk, lukasz.stanislawski, jpeg

Reviewed By: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D5553
2017-12-04 19:32:46 +09:00
Cedric Bail 1112ce2a8a ecore: should be the one triggering EFL_LOOP_EVENT_TERMINATE. 2017-11-15 16:29:14 -08:00
Cedric BAIL ee65414ef6 ecore: introduce ecore_init_ex/ecore_shutdown_ex to propagate argc,argv properly. 2017-11-07 16:08:39 -08:00
Cedric BAIL 3d72cb8da3 ecore: report startup time of the main loop with EFL_FIRST_LOOP environment variable. 2017-11-07 16:08:39 -08:00
Cedric BAIL dd40079185 ecore,elementary: move startup time accounting in ecore. 2017-11-07 16:08:39 -08:00
Vincent Torri 0cdd501246 EFL For WIN32: Replace HAVE_EVIL define with _WIN32 2017-09-22 05:06:10 -05: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
Mike Blumenkrantz e263cbf9d0 Revert "ecore: forcefully flush pending event when ecore_shutdown is called."
This reverts commit 2c6808e4ee.

this breaks a number of expectations and guarantees in efl:

* causes unexpected event iteration during app startup before main loop begins
  - leads to event loss
* causes unexpected event iteration during app shutdown after main loop quits
  - leads to invalid memory access
* causes recursive event iteration during event handler callbacks
  - leads to ?????????????????????????????????????????????????????????????????

all of these can be easily seen by running enlightenment, and all of these cause
unexpected behaviors in enlightenment including, but not limited to, a lot of crashes

fix T5232
2017-03-03 11:56:04 -05:00
Cedric BAIL d8edf70c32 ecore: improve debugging of animator. 2017-02-28 11:04:34 -08:00
Cedric BAIL 2c6808e4ee ecore: forcefully flush pending event when ecore_shutdown is called.
If a component emit Ecore_Event and they aren't processed before the
call it call ecore_shutdown, there is no way to prevent this event
from being triggered after the component at shutdown itself. Which
may well lead to a use after free case. As we don't know which event
are pending and we also are not shuting down ecore completely as they
are still other component using it, we can only flush all pending event
right away.
2017-02-27 15:05:35 -08:00
Gustavo Sverzut Barbieri 8dc853f230 ifdef RUN_IN_TREE logic.
This logic is only needed for autotools, cmake will replicate the
installation file structure and thus eina_prefix works out of box.
2017-02-03 12:36:38 -02:00
Carsten Haitzler 2f6045abc0 ecore - add run state evlogs to know when we run (mainloop) or sleep 2016-11-10 16:22:34 +09:00
Gustavo Sverzut Barbieri 564e499467 ecore_init() use getenv(ECORE_NO_SYSTEM_MODULES) and disable those.
Sometimes during debug of efl_net we get some "extra" sockets from
DBus to talk to upower, localed, timedated... which are helpful in
real life, but pollutes debugging.

Since I don't want to contaminate examples with
ecore_app_no_system_modules(), which could lead users to naively copy
those and end without the system modules features, add an envvar that
I can define in my tests when I need them.
2016-10-27 09:33:09 -02:00
Cedric BAIL e4958e9faa ecore: remove useless ecore_parent.eo. 2016-09-19 13:05:32 -07:00
Carsten Haitzler 09f19c3c73 eo - make eo id table TLS private data for thread safety and speed
This moved all the eoid tables, eoid lookup caches, generation count
information ad eo_isa cache into a TLS segment of memory that is
thread private. There is also a shared domain for EO objects that all
threads can access, but it has an added cost of a lock. This means
objects accessed outside the thread they were created in cannot be
accessed by another thread unless they are adopted in temporarily, or
create4d with the shared domain active at the time of creation. child
objects will use their parent object domain if created with a parent
object passed in. If you were accessing EO (EFL) objects across threads
before then this will actually now cause your code to fail as it was
invalid before to do this as no actual objects were threadsafe in EFL,
so this will force things to "fail early".
ecore_thread_main_loop_begin() and end() still work as this uses the
eo domain adoption features to temporarily adopt a domain during this
section and then return it when done.

This returns speed back to eo brining the overhead in my tests of
lookup for the elm genlist autobounce test in elementary from about
5-7% down to 2.5-2.6%. A steep drop.

This does not mean everything is perfect. Still to do are:

1. Tests in the test suite
2. Some API's to help for sending objects from thread to thread
3. Make the eo call cache TLS data to make it also safe
4. Look at other locks in eo and probably move them to TLS data
5. Make eo resolve and call wrappers that call the real method func do
   recursive mutex wrapping of the given object IF it is a shared object
   to provide threadsafety transparently for shared objects (but adding
   some overhead as a result)
6. Test test est, and that is why this commit is going in now for wider
   testing
7. Decide how to make this work with sending IPC (between threads)
8. Deciding what makes an object sendable (a sendable property in base?)
9. Deciding what makes an object shareable (a sharable property in base?)
2016-09-07 18:17:10 +09:00
Tom Hacohen e65aae994e Eo: Finish the renaming of Eo to the EFL.
This renames all the rest of the API to the EFL namespace except for
Eo_Event that will follow soon.

Obviously breaks both API and ABI.
2016-08-15 15:07:42 +01:00
Tom Hacohen c662934be8 Change the EFL to follow the new Eo rename. 2016-08-11 17:04:43 +01:00
Carsten Haitzler 9527240d74 efl - fix lots of little init/shutdown pairs that are wrong
i've fixed almost all the eina init/shutdown pairs to do the right
thing now... except one (ecore_shutdown) with comment inline where
eo_shutdown is not called. if this is called we are in crash land.
this needs further inspection.
2016-07-04 21:30:34 +09:00
Cedric BAIL 0e6d5df60c ecore: use EINA_ERROR_PROMISE_CANCEL instead of a custom Ecore one. 2016-06-03 17:00:12 -07:00
Cedric BAIL b3d56820d5 ecore: Efl.Timer should be Efl.Loop.Timer for coherence.
As we add more object in the main loop, they can't live in the top
namespace as they make little sense there (Efl.Fd !). For coherence,
everyone should in the loop namespace, so move timer there.
2016-06-03 17:00:12 -07:00
Tom Hacohen a6a2338962 Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba.

It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.

We would have an issue with references and objects being freed too soon
and in general, issue with the references.

Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.

eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 13:33:21 +01:00
Tom Hacohen 546ff7bbba Eo: Remove eo_del() and make eo_unref() the replacement.
We used to have eo_del() as the mirrored action to eo_add(). No longer,
now you just always eo_unref() to delete an object. This change makes it
so the reference of the parent is shared with the reference the
programmer has. So eo_parent_set(obj, NULL) can free an object, and so
does eo_unref() (even if there is a parent).

This means Eo no longer complains if you have a parent during deletion.
2016-05-17 16:23:23 +01:00
Cedric Bail aa4da11b33 ecore: do not create another main loop object
So ecore main loop does restart everything with an main loop shutdown
and init when it detect a bad fd. This can happen if you del a fd after
you have destroyed it. Something terminology is doing (and should be
legal), but that then ended up with a main loop with no event handler
registered and the process was looking like stuck with nothing happening.
2016-05-17 07:41:13 -07:00
Cedric BAIL 93af61f255 ecore: rename ecore_timer to efl_timer. 2016-05-04 10:30:13 -07:00
Cedric Bail 7fa953e9ae ecore: add Efl.Loop.Job promise. 2016-05-02 18:17:09 -07:00
Cedric BAIL 3108f023ba ecore: move ecore idle exiter to relly on the factorized main loop event. 2016-04-21 14:49:00 -07:00
Cedric BAIL 5c87f2762f ecore: use new refactorized idle infrastructure to make idle enterer rely on mainloop events 2016-04-21 14:07:49 -07:00
Cedric BAIL 3ff21c021d ecore: move Ecore_Idler to legacy and rely on Eo event restart capability. 2016-04-21 12:07:50 -07:00
Cedric BAIL bc7174262f ecore: make the main loop singleton initialized and available early on. 2016-04-21 12:07:50 -07:00
Jean-Philippe Andre 83a591b335 Ecore: Try to fix build for windows
Move efl.h above ecore.h to not mess with EAPI's dllimport
vs. dllexport definition. This addresses T3423.
2016-04-07 15:25:42 +09:00
Jean-Philippe Andre 4e4b42ec03 Efl: Add internal strong symbol to fix build on GCC < 5.3
This fixes a crash in ecore_init, calling a weak function from
libefl that was resolved to NULL.

So, here's a fun thing happening with GCC < 5.3. Since a1a506e13e
all EOAPI and EO class_get() functions are weak symbols. This means
that all APIs inside libefl.so are weak.

As a result, gcc linker with --as-needed skipped linking to libefl
since not a single strong symbol from libefl was required by
libecore. This is actually a bug in gcc linker since we do in fact
use symbols from libefl, just weak ones.

GCC 5.3 seems to be fixed, so people with GCC 5.3+ will not
experience any build/runtime issue. The current patch is
a workaround that bug, by artifically creating a strong symbol
required by ecore.

Other libraries than ecore might also need to call
__efl_internal_init, if they end up not being linked to libefl.
2016-04-07 14:40:10 +09:00
Carsten Haitzler 7c8b2da286 efl ecore - init vpath on ecore init so we have a base object working
this inits a new vpath object and adds it at priority 0 to the vpath
manager so you can use the vpath manager to create vpath file objects
and look things up.

@feature
2016-04-05 16:22:59 +09:00
Tom Hacohen f24210caac Revert "Automatic migration to the new eo_add syntax."
This reverts commit 4f949a2757.
2016-03-11 12:29:03 +00:00
Tom Hacohen 4f949a2757 Automatic migration to the new eo_add syntax. 2016-03-09 16:09:14 +00:00
Jean Guyomarc'h 15ddd174a1 ecore: better resources use in the glib integration
Summary:
When glib support is enabled (HAVE_GLIB), _ecore_glib_init()
was always reserving resources. However, its counterpart may not
be called when:
- glib is not always integrated and
- when a user didn't explicitly required the integration.

Calling _ecore_glib_init() within the request code will cause the
resources to be reserved only when the integration with glib is
required and furthermore guarantees that resources always have a
chance to be released.

Reviewers: cedric, raster

Subscribers: cedric, jpeg

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-03-04 16:09:51 -08:00
Cedric BAIL 8cc6c7561a ecore: remove useless ecore_lock/unlock. 2016-02-02 10:45:42 -08:00
Felipe Magno de Almeida a3db1dddd3 efl-js: JavaScript Eolian binding
To configure efl sources with bindings to use in nodejs add ––with-js=nodejs in configure flags to generate node files

$ configure --with-js=nodejs

and compile normally with:

$ make
$ make install

To use, you have to require efl:

efl = require('efl')

The bindings is divided in two parts: generated and manually
written. The generation uses the Eolian library for parsing Eo files
and generate C++ code that is compiled against V8 interpreter library
to create a efl.node file that can be required in a node.js instance.

@feature
2015-12-23 23:59:40 -02:00
Vincent Torri 0497b9685c efl: add binary mode to open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:06:04 +01:00
Vincent Torri 3b44645363 efl: add binary mode to f(re)open() calls
This allows better compatibility with Windows

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-12-05 21:04:36 +01:00
Vincent Torri 16063b8ab1 Use eina_environment_tmp_get() 2015-07-22 09:22:02 +01:00
ChunEon Park be0c2f5a31 ecore: null cb function is unacceptable.
@fix
2015-06-10 17:46:31 +09:00
Carsten Haitzler 009ec26460 eina + ecore - fix main loop thread id tracking on fork
if you fork and even if you do ecore_fork_reset() a thread calling
ecore_main_loop_thread_safe_call_async(0 for example eill end up
resetting the mainloop thread id to itself (a non mainlopo thread) via
calling eina_main_loop_is() since pid changed. there is little point
in doing this so remove the pid tracking from eina and ensure mainloop
thread id is updated in ecore's fork reset.

@fix
2015-02-26 19:47:51 +09:00
Cedric BAIL e5ddfb4b2b ecore: add ecore_thread_wait and necessary infrastructure.
This enable the possibility to block the main loop until a
specific thread is done. It may trigger still process ending
of other thread during that function call, but not any other
type of event (timer, animator, idler, ... are all ignored).
2015-01-07 16:45:07 +01:00
Carsten Haitzler 164ea41b3e move ecore documentation not in headers to .h files for consistency 2014-07-26 12:30:12 +09:00
Yossi Kantor 86ec4e28bc Eolian: Integration of Ecore Parent 2014-04-02 10:05:37 +03:00
Cedric Bail 30d7779178 ecore: @fix race condition when using ecore_main_loop_thread_safe_call_sync. 2014-02-27 12:24:28 -03:00
Carsten Haitzler e8c13118eb fix mingw build for setuid fix/checks 2014-01-08 22:06:41 +09:00
Carsten Haitzler b95ef3801f setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.
2014-01-08 19:46:23 +09:00
Carsten Haitzler 6f685d7608 fixme notes - fixme: many instances of module loading that bloat our mem 2014-01-06 12:16:36 +09:00