Commit Graph

11 Commits

Author SHA1 Message Date
Lauro Moura 40a980174b csharp: Add licensing information.
Summary:
C# bindings will be lincensed under Apache Sofware License 2.0.

This commit adds the license text to the licenses folder and a copyright
notice to the binding files.

Fixes T8039

Reviewers: woohyun, felipealmeida, vitor.sousa

Reviewed By: felipealmeida

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8039

Differential Revision: https://phab.enlightenment.org/D9414
2019-10-24 10:10:56 -03:00
Yeongjong Lee 711823cb1d mono: remove underscores of Efl_Op_Description, Efl_Object_Ops
Summary:
C# does not use underscore in type name.

ref T8333

Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true

Reviewers: lauromoura, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8333

Differential Revision: https://phab.enlightenment.org/D10422
2019-10-17 14:24:01 -03:00
Lauro Moura d5c8d05292 csharp: Move locks inside AddRemove native handlers
Summary:
Instead of using a lock block in every method definition, we just need
them inside the actual methods adding/removing the handlers.

Kudos to @herb for the suggestion.

Reviewers: felipealmeida, herb, brunobelo

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, herb, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9758
2019-10-04 10:12:57 -03:00
Lauro Moura 2e7b508312 csharp: Fix wrapping of private classes
Summary:
Sometimes, valid Eo objects of private classes can be returned from
methods. Currently we try to wrap in a minimal `Efl.Object` instance,
but as it is an abstract class, we can't instantiate directly.

This commits adds a dummy `Efl.ObjectRealized` to be instantiated when
wrapping such classes alongside a test case.

Fixes: T8258

Reviewers: felipealmeida, brunobelo, segfaultxavi, Jaehyun_Cho

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10101
2019-09-24 18:00:05 -03:00
Yeongjong Lee f4d9188ca7 eolian_mono: remove redundant code in NativeMethods
Summary:
Duplicated interface's NativeMethods code will be removed. they are called in
`GetInterfaces`.

Size of efl_mono.dll
6,587,392 bytes(6.6MB) -> 4,112,384 bytes (4.1MB)

Test Plan: ninja test

Reviewers: felipealmeida, lauromoura, vitor.sousa

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, woohyun, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9752
2019-09-08 22:14:21 -03:00
Jaehyun Cho b7bab9aa8e csharp: add SetKeyValue and GetKeyValue to EoWrapper
Summary:
SetKeyValue adds a value object associated with a key object to hash
table.
GetKeyValue returns a value object associated with a key object from
hash table.

Reviewers: felipealmeida, lauromoura, vitor.sousa, woohyun, cedric

Subscribers: zmike, bu5hm4n, segfaultxavi, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9622
2019-09-02 21:35:23 +09:00
Lauro Moura a19bb21edf csharp: Tag exported API items.
Summary:
Attributes to be used by the API export tool. For end users, no changes
in the public API (except for a new attribute in generated classes).

Also simplifies constructor forwarding by not needing to pass the type
of the first "generated" class to compare.

Currently only automatically generated items are tagged.

Depends: D9259

Reviewers: vitor.sousa, felipealmeida

Reviewed By: vitor.sousa

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9270
2019-07-11 15:51:38 -03:00
Vitor Sousa ec501a6623 csharp: fix some build warnings related with incorrect and missing documentation
Summary:
Some parameter names, tag names and cref identifiers in the documentation were
incorrect and causing warnings during compilation.
There were also warnings related with missing documentation in publicly
visible elements in the manual binding.

This commit fixes these incorrections and adds documentation to the manual
binding in order to solve these compilation warnings.

Warnings related with missing documentation in `.eo` files are still present.

Test Plan: Just compile with mono binding.

Reviewers: lauromoura, felipealmeida, segfaultxavi

Reviewed By: segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9243
2019-07-08 17:20:08 +02:00
Vitor Sousa 73df0d47ff csharp: encapsulate some internal code of EoWrapper
Summary:
Encapsulate some parts of EoWrapper making them less accessible to lib users.
This can avoid unnecessary and risky usage of code that is only intended for
internal usage.

`inherited` field was made private and renamed to `generated`. Now its value
can only be obtained through the `IsGeneratedBindingClass` property.

`handle` field was made private.

`eventLock` was renamed to `eflBindingEventLock`

`ConstructingHandle` property set was made private.

Constructors that are used to create new EFL# managed objects by wrapping a
preexisting eo handle now receive a specific struct wrapping the handle pointer.
This can avoid faulty interactions with the Reflection engine used only for
generated classes that implement this constructor.

Test Plan: meson test

Reviewers: lauromoura, felipealmeida, YOhoho

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9212
2019-07-05 09:57:23 +09:00
Vitor Sousa b7fa7d48ac csharp: make inherited C# classes constructible from native C
Summary:
With this commit it is now possible for a class that inherits from a C# binding
class to be instantiated from native C code. It only has to provide a
constructor that receives an `Efl.Eo.EoWrapper.ConstructingHandle` struct,
and which calls the base binding constructor passing it.
For example:

`private Type(ConstructingHandle ch) : base(ch) {}`.

Add some test files to validate the proper behavior of this feature.

Add some small fixes in generation contexts in order to properly
generate base constructors.

Depends on D9070

Test Plan: `meson test` and `make check`

Reviewers: lauromoura, felipealmeida, segfaultxavi, woohyun, YOhoho

Reviewed By: YOhoho

Subscribers: YOhoho, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9071
2019-06-28 10:38:57 -03:00
Vitor Sousa fcf5f1d2e2 csharp: Refactor wrapper lifetime.
Summary:
This commit makes use of the `ownership,shared` and `ownership,unique`
events from Efl.Object in order to avoid the C# wrapper from being
collected while C code holds a reference to the object.

For example, creating a list of items in a for loop and attaching events to
them would fails without this commit, as the C# GC may collect the wrapper.

The basic idea is that we use a `WrapperSupervisor`, which is stored in
the Eo data storage, with a GCHandle allocated for the lifetime of the
underlying Eo object. This supervisor takes care of holding either a
weak C# reference (when in unique mode, allowing the wrapper to be GC'd)
or a hard C# reference (when in shared mode, making the wrapper
non-collectable while the Eo has extra references).

One limitation is that object graphs can leak if a shared object in the
graph - an Eo child for example - stores a hard reference to another
object in the graph as a C# field. In this example, this causes the
parent to always have a hard C# reference (from the child) as the child
is non-collectable due to the parent holding an Eo reference to it.

Depends on D8678

Test Plan: `ninja test` and `make test`

Reviewers: lauromoura, felipealmeida, woohyun, segfaultxavi

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9014
2019-05-31 17:44:12 -03:00