2019-10-24 06:01:50 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2019 by its authors. See AUTHORS.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2017-12-06 16:03:55 -08:00
|
|
|
#pragma warning disable 1591
|
2017-11-23 16:49:22 -08:00
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Runtime.InteropServices;
|
2019-04-05 15:57:29 -07:00
|
|
|
using System.Runtime.CompilerServices;
|
2017-11-23 16:49:22 -08:00
|
|
|
using System.Collections.Generic;
|
2018-04-03 09:46:45 -07:00
|
|
|
using System.Diagnostics;
|
2019-11-01 06:04:04 -07:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
using System.Reflection;
|
2018-05-07 15:22:59 -07:00
|
|
|
using System.Threading;
|
2019-10-24 14:50:48 -07:00
|
|
|
using System.Linq;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
using static Eina.NativeCustomExportFunctions;
|
2018-12-14 09:06:12 -08:00
|
|
|
using EoG = Efl.Eo.Globals;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
namespace Efl
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
namespace Eo
|
|
|
|
{
|
2019-03-21 10:38:45 -07:00
|
|
|
|
2019-12-20 03:00:45 -08:00
|
|
|
internal static class Globals
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-03-21 10:38:45 -07:00
|
|
|
/// <summary>Represents the type of the native Efl_Class.</summary>
|
2019-10-29 07:56:38 -07:00
|
|
|
internal enum EflClassType
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-03-21 10:38:45 -07:00
|
|
|
/// <summary>Regular EFL classes.</summary>
|
|
|
|
Regular = 0,
|
|
|
|
/// <summary>Non-instantiable efl classes (i.e. Abstracts).</summary>
|
|
|
|
RegularNoInstant,
|
|
|
|
/// <summary>Interface types.</summary>
|
|
|
|
Interface,
|
|
|
|
/// <summary>Mixins types.</summary>
|
|
|
|
Mixin,
|
|
|
|
/// <summary>Invalid class type.</summary>
|
|
|
|
Invalid
|
|
|
|
}
|
|
|
|
|
2019-01-15 23:29:56 -08:00
|
|
|
[return: MarshalAs(UnmanagedType.U1)]
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate bool efl_object_init_delegate();
|
2019-10-28 15:04:33 -07:00
|
|
|
static readonly FunctionWrapper<efl_object_init_delegate> efl_object_init_ptr =
|
2019-01-15 23:29:56 -08:00
|
|
|
new FunctionWrapper<efl_object_init_delegate>(efl.Libs.EoModule, "efl_object_init");
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static bool efl_object_init() => efl_object_init_ptr.Value.Delegate();
|
2019-01-15 23:29:56 -08:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate void efl_object_shutdown_delegate();
|
2019-10-28 15:04:33 -07:00
|
|
|
static readonly FunctionWrapper<efl_object_shutdown_delegate> efl_object_shutdown_ptr = new FunctionWrapper<efl_object_shutdown_delegate>(efl.Libs.EoModule, "efl_object_shutdown");
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void efl_object_shutdown() => efl_object_shutdown_ptr.Value.Delegate();
|
2019-10-17 16:23:11 -07:00
|
|
|
// [DllImport(efl.Libs.Eo)] internal static extern void efl_object_shutdown();
|
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 13:43:11 -07:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr efl_mono_wrapper_supervisor_get(IntPtr eo);
|
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void efl_mono_wrapper_supervisor_set(IntPtr eo, IntPtr ws);
|
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 13:43:11 -07:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
_efl_add_internal_start([MarshalAs(UnmanagedType.LPStr)] String file, int line,
|
|
|
|
IntPtr klass, IntPtr parent, byte is_ref, byte is_fallback);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2019-06-28 06:29:01 -07:00
|
|
|
_efl_add_internal_start_bindings([MarshalAs(UnmanagedType.LPStr)] String file, int line, IntPtr klass, IntPtr parent,
|
|
|
|
byte is_ref, byte is_fallback, IntPtr substitute_ctor, IntPtr data);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr
|
2019-01-15 23:29:56 -08:00
|
|
|
_efl_add_end_delegate(IntPtr eo, byte is_ref, byte is_fallback);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
_efl_add_end(IntPtr eo, byte is_ref, byte is_fallback);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr
|
2019-01-15 23:29:56 -08:00
|
|
|
efl_ref_delegate(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2017-11-23 16:49:22 -08:00
|
|
|
efl_ref(IntPtr eo);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate void
|
2019-01-15 23:29:56 -08:00
|
|
|
efl_unref_delegate(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
2017-11-23 16:49:22 -08:00
|
|
|
efl_unref(IntPtr eo);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate int
|
2019-01-15 23:29:56 -08:00
|
|
|
efl_ref_count_delegate(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern int
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
efl_ref_count(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
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 13:43:11 -07:00
|
|
|
efl_mono_wrapper_supervisor_callbacks_set(Efl.FreeWrapperSupervisorCb freeWrapperSupervisorCb);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
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 13:43:11 -07:00
|
|
|
efl_mono_native_dispose(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
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 13:43:11 -07:00
|
|
|
efl_mono_thread_safe_native_dispose(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
2019-04-05 15:57:29 -07:00
|
|
|
efl_mono_thread_safe_efl_unref(IntPtr eo);
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern void
|
2019-04-15 10:09:49 -07:00
|
|
|
efl_mono_thread_safe_free_cb_exec(IntPtr free_cb, IntPtr cb_data);
|
2019-01-15 23:29:56 -08:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2019-02-06 11:50:28 -08:00
|
|
|
efl_class_name_get(IntPtr eo);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr extn44, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr extn44, IntPtr extn45, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr extn44, IntPtr extn45, IntPtr extn46, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr extn44, IntPtr extn45, IntPtr extn46, IntPtr extn47, IntPtr term);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr
|
2018-12-14 09:06:12 -08:00
|
|
|
efl_class_new(IntPtr class_description, IntPtr parent, IntPtr extn1, IntPtr extn2, IntPtr extn3, IntPtr extn4, IntPtr extn5, IntPtr extn6, IntPtr extn7, IntPtr extn8, IntPtr extn9, IntPtr extn10, IntPtr extn11, IntPtr extn12, IntPtr extn13, IntPtr extn14, IntPtr extn15, IntPtr extn16, IntPtr extn17, IntPtr extn18, IntPtr extn19, IntPtr extn20, IntPtr extn21, IntPtr extn22, IntPtr extn23, IntPtr extn24, IntPtr extn25, IntPtr extn26, IntPtr extn27, IntPtr extn28, IntPtr extn29, IntPtr extn30, IntPtr extn31, IntPtr extn32, IntPtr extn33, IntPtr extn34, IntPtr extn35, IntPtr extn36, IntPtr extn37, IntPtr extn38, IntPtr extn39, IntPtr extn40, IntPtr extn41, IntPtr extn42, IntPtr extn43, IntPtr extn44, IntPtr extn45, IntPtr extn46, IntPtr extn47, IntPtr extn48, IntPtr term);
|
2019-01-15 23:29:56 -08:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate byte efl_class_functions_set_delegate(IntPtr klass_id, IntPtr object_ops, IntPtr class_ops);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern byte efl_class_functions_set(IntPtr klass_id, IntPtr object_ops, IntPtr class_ops);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr efl_data_scope_get_delegate(IntPtr obj, IntPtr klass);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr efl_data_scope_get(IntPtr obj, IntPtr klass);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr efl_super_delegate(IntPtr obj, IntPtr klass);
|
2019-10-15 06:11:09 -07:00
|
|
|
|
|
|
|
/// <summary>Gets a native pointer to <c>obj</c> that forwards the method call to its parent
|
|
|
|
/// implementation.
|
|
|
|
///
|
|
|
|
/// <para>For generated code use only.</para>
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj">The native pointer to be prepared.</param>
|
|
|
|
/// <param name="klass">The current class.</param>
|
|
|
|
/// <returns>The native pointer to <c>obj</c> prepared to call the parent implementation of <c>klass</c>.</returns>
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr Super(IntPtr obj, IntPtr klass)
|
2019-10-15 06:11:09 -07:00
|
|
|
{
|
|
|
|
return efl_super(obj, klass);
|
|
|
|
}
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr efl_super(IntPtr obj, IntPtr klass);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr efl_class_get_delegate(IntPtr obj);
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr efl_class_get(IntPtr obj);
|
2019-10-15 06:11:09 -07:00
|
|
|
|
|
|
|
/// <summary>Gets the native EO class pointer for the given object.
|
|
|
|
/// <para>For generated code use only.</para>
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj">The native pointer to the <see cref="Efl.Object" /> instance to get the native class
|
|
|
|
/// from.</param>
|
|
|
|
/// <returns>The native class pointer or <see cref="IntPtr.Zero" /> if no such class existis.</returns>
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr GetClass(IntPtr obj)
|
2019-10-15 06:11:09 -07:00
|
|
|
{
|
|
|
|
return efl_class_get(obj);
|
|
|
|
}
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern EflClassType efl_class_type_get(IntPtr klass);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate IntPtr dlerror_delegate();
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Evil)] internal static extern IntPtr dlerror();
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] internal static extern IntPtr efl_constructor(IntPtr obj);
|
2019-06-28 06:29:01 -07:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.CustomExports)] internal static extern IntPtr efl_mono_avoid_top_level_constructor_callback_addr_get();
|
2019-06-28 06:29:01 -07:00
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool
|
2019-04-05 15:59:34 -07:00
|
|
|
efl_event_callback_priority_add(IntPtr obj, IntPtr desc, short priority, IntPtr cb, IntPtr data);
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool
|
2019-04-05 15:59:34 -07:00
|
|
|
efl_event_callback_del(IntPtr obj, IntPtr desc, IntPtr cb, IntPtr data);
|
|
|
|
|
2019-10-17 16:23:11 -07:00
|
|
|
[DllImport(efl.Libs.Eo)] [return: MarshalAs(UnmanagedType.U1)] internal static extern bool
|
2019-04-05 15:59:34 -07:00
|
|
|
efl_event_callback_call(IntPtr obj, IntPtr desc, IntPtr event_info);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-15 06:11:09 -07:00
|
|
|
/// <summary>Calls the callbacks associated to an event.
|
|
|
|
/// <para>For generated code use only.</para>
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj">The native pointer to the <see cref="Efl.Object" /> instance that will be the emitter
|
|
|
|
/// of the event.</param>
|
|
|
|
/// <param name="desc">The native event description.</param>
|
|
|
|
/// <param name="event_info">The native payload of the event.</param>
|
|
|
|
/// <returns><c>false</c> if one of the callbacks aborted the call. <c>true</c> otherwise.</returns>
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static bool CallEventCallback(IntPtr obj, IntPtr desc, IntPtr event_info)
|
2019-10-15 06:11:09 -07:00
|
|
|
{
|
|
|
|
return efl_event_callback_call(obj, desc, event_info);
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal const int RTLD_NOW = 2;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal delegate byte class_initializer(IntPtr klass);
|
2019-01-17 04:33:09 -08:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static T GetParamHelper<T>(Nullable<T> v) where T : struct
|
2019-02-01 11:03:02 -08:00
|
|
|
{
|
|
|
|
return v.Value;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static U GetParamHelper<U>(U v)
|
2019-02-01 11:03:02 -08:00
|
|
|
{
|
|
|
|
return v;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static bool ParamHelperCheck<T>(Nullable<T> v) where T : struct
|
2019-02-01 11:03:02 -08:00
|
|
|
{
|
|
|
|
return v.HasValue;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static bool ParamHelperCheck<U>(U v)
|
2019-02-01 11:03:02 -08:00
|
|
|
{
|
|
|
|
return v != null;
|
|
|
|
}
|
2019-02-06 00:53:25 -08:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr register_class(String class_name, IntPtr base_klass, System.Type type)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
ClassDescription description;
|
|
|
|
description.version = 2; // EO_VERSION
|
2018-04-03 09:46:45 -07:00
|
|
|
description.name = class_name;
|
2017-11-23 16:49:22 -08:00
|
|
|
description.class_type = 0; // REGULAR
|
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 13:43:11 -07:00
|
|
|
description.data_size = (UIntPtr)0;
|
2017-11-23 16:49:22 -08:00
|
|
|
description.class_initializer = IntPtr.Zero;
|
|
|
|
description.class_constructor = IntPtr.Zero;
|
|
|
|
description.class_destructor = IntPtr.Zero;
|
|
|
|
|
2019-01-17 04:33:09 -08:00
|
|
|
class_initializer init = (IntPtr kls) =>
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
return Globals.class_initializer_call(kls, type);
|
|
|
|
};
|
2019-02-06 00:53:25 -08:00
|
|
|
|
2019-01-17 04:33:09 -08:00
|
|
|
description.class_initializer = Marshal.GetFunctionPointerForDelegate(init);
|
2017-11-23 16:49:22 -08:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
IntPtr description_ptr = Eina.MemoryNative.Alloc(Marshal.SizeOf(description));
|
2017-11-23 16:49:22 -08:00
|
|
|
Marshal.StructureToPtr(description, description_ptr, false);
|
2018-12-14 09:06:12 -08:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
// FIXME: description_ptr seems to be leaking memory even after an eo_shutdown
|
|
|
|
|
2018-12-14 09:06:12 -08:00
|
|
|
var interface_list = EoG.get_efl_interfaces(type);
|
|
|
|
|
2019-02-08 02:55:58 -08:00
|
|
|
Eina.Log.Debug($"Going to register new class named {class_name}");
|
2018-12-14 09:06:12 -08:00
|
|
|
IntPtr klass = EoG.call_efl_class_new(description_ptr, base_klass, interface_list);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
if (klass == IntPtr.Zero)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
Eina.Log.Error("klass was not registered");
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
else
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
Eina.Log.Debug("Registered class successfully");
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return klass;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static List<IntPtr> get_efl_interfaces(System.Type type)
|
2018-12-14 09:06:12 -08:00
|
|
|
{
|
2019-01-17 04:33:09 -08:00
|
|
|
System.Type base_type = type.BaseType;
|
2019-02-06 00:53:25 -08:00
|
|
|
|
2018-12-14 09:06:12 -08:00
|
|
|
var ifaces_lst = new List<IntPtr>();
|
2019-01-17 04:33:09 -08:00
|
|
|
var base_ifaces = base_type.GetInterfaces();
|
2018-12-14 09:06:12 -08:00
|
|
|
var ifaces = type.GetInterfaces();
|
|
|
|
foreach (var iface in ifaces)
|
|
|
|
{
|
2019-01-17 04:33:09 -08:00
|
|
|
if (!System.Array.Exists(base_ifaces, element => element == iface))
|
2018-12-14 09:06:12 -08:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
var attrs = System.Attribute.GetCustomAttributes(iface);
|
|
|
|
foreach (var attr in attrs)
|
|
|
|
{
|
|
|
|
if (attr is Efl.Eo.NativeClass)
|
|
|
|
{
|
|
|
|
ifaces_lst.Add(((Efl.Eo.NativeClass)attr).GetEflClass());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-12-14 09:06:12 -08:00
|
|
|
}
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2018-12-14 09:06:12 -08:00
|
|
|
return ifaces_lst;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
private static Efl.Eo.NativeClass GetNativeClass(System.Type type)
|
2019-01-17 04:33:09 -08:00
|
|
|
{
|
2019-04-10 11:04:22 -07:00
|
|
|
var attrs = System.Attribute.GetCustomAttributes(type, false);
|
2019-01-17 04:33:09 -08:00
|
|
|
foreach (var attr in attrs)
|
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
if (attr is Efl.Eo.NativeClass)
|
|
|
|
{
|
2019-01-17 04:33:09 -08:00
|
|
|
return (Efl.Eo.NativeClass)attr;
|
|
|
|
}
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-01-17 04:33:09 -08:00
|
|
|
return null;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static System.Collections.Generic.List<string>
|
2019-04-09 07:16:17 -07:00
|
|
|
GetUserMethods(System.Type type)
|
|
|
|
{
|
2019-10-24 14:50:48 -07:00
|
|
|
var r = new System.Collections.Generic.List<string>();
|
|
|
|
var flags =
|
|
|
|
System.Reflection.BindingFlags.Instance
|
|
|
|
| System.Reflection.BindingFlags.DeclaredOnly
|
|
|
|
| System.Reflection.BindingFlags.Public
|
|
|
|
| System.Reflection.BindingFlags.NonPublic;
|
|
|
|
|
|
|
|
for (var base_type = type;;base_type = base_type.BaseType)
|
2019-04-09 07:16:17 -07:00
|
|
|
{
|
2019-10-24 14:50:48 -07:00
|
|
|
r.AddRange(base_type.GetMethods(flags)
|
|
|
|
.AsParallel().Select(info=>info.Name).ToList());
|
|
|
|
if (IsGeneratedClass(base_type.BaseType))
|
2019-04-09 07:16:17 -07:00
|
|
|
{
|
2019-10-24 14:50:48 -07:00
|
|
|
break;
|
2019-04-09 07:16:17 -07:00
|
|
|
}
|
|
|
|
|
2019-10-24 14:50:48 -07:00
|
|
|
if (base_type.BaseType == null)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-04-09 07:16:17 -07:00
|
|
|
}
|
2019-10-24 14:50:48 -07:00
|
|
|
|
2019-04-09 07:16:17 -07:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static byte class_initializer_call(IntPtr klass, System.Type type)
|
2019-01-17 04:33:09 -08:00
|
|
|
{
|
2019-01-15 23:29:56 -08:00
|
|
|
Eina.Log.Debug($"called with 0x{klass.ToInt64():x} {type}");
|
efl_mono: support multilevel inheritance of NativeClass
Summary:
When it creates multilevel class of NativeClass, internal c function is not
called because eo vtables aren't created
Test Plan:
Check "MyBox2 UpdateLayout" printed.
```
//mcs test_box.cs -out:test_box.exe `pkg-config --libs efl-mono`
//mono test_box.exe
using System;
public class MyBox2 : MyBox
{
public MyBox2(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox2 UpdateLayout");
base.UpdateLayout();
}
}
public class MyBox : Efl.Ui.Box
{
public MyBox(Efl.Object parent, string style = null) : base(parent, style)
{
}
public override void UpdateLayout()
{
Eina.Log.Error("MyBox UpdateLayout");
base.UpdateLayout();
}
}
public class Example : Efl.Csharp.Application
{
protected override void OnInitialize(Eina.Array<System.String> args)
{
Efl.Ui.Win win = new Efl.Ui.Win(Efl.App.AppMain);
var box = new MyBox(win);
box.SetHintSizeMin(new Eina.Size2D(360, 240));
win.SetContent(box);
var box2 = new MyBox2(win);
box2.SetHintSizeMin(new Eina.Size2D(360, 240));
box2.Pack(box);
var button = new Efl.Ui.Button(box);
button.SetText("Click");
button.ClickedEvt += (object sender, Efl.Ui.IClickableClickedEvt_Args e) =>
{
box.CalculateGroup();
box2.CalculateGroup();
};
box.Pack(button);
}
public static void Main()
{
var example = new Example();
example.Launch();
}
}
```
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, lauromoura, woohyun, Jaehyun_Cho
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9079
2019-06-18 23:59:54 -07:00
|
|
|
var derived = type.BaseType;
|
|
|
|
Efl.Eo.NativeClass nativeClass = GetNativeClass(derived);
|
|
|
|
|
|
|
|
while (nativeClass == null)
|
|
|
|
{
|
|
|
|
derived = derived.BaseType;
|
|
|
|
if (derived == null)
|
|
|
|
break;
|
|
|
|
nativeClass = GetNativeClass(derived);
|
|
|
|
}
|
2019-01-17 04:33:09 -08:00
|
|
|
|
|
|
|
if (nativeClass != null)
|
|
|
|
{
|
2019-02-08 02:55:58 -08:00
|
|
|
Eina.Log.Debug("nativeClass != null");
|
2019-09-08 18:13:40 -07:00
|
|
|
var descs = nativeClass.GetEoOps(type, true);
|
2019-01-17 04:33:09 -08:00
|
|
|
var count = descs.Count;
|
2019-04-10 11:04:22 -07:00
|
|
|
IntPtr descs_ptr = IntPtr.Zero;
|
|
|
|
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
descs_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(descs[0]) * count);
|
|
|
|
}
|
|
|
|
|
2019-01-17 04:33:09 -08:00
|
|
|
IntPtr ptr = descs_ptr;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
for (int i = 0; i != count; ++i)
|
2019-01-17 04:33:09 -08:00
|
|
|
{
|
|
|
|
Marshal.StructureToPtr(descs[i], ptr, false);
|
|
|
|
ptr = IntPtr.Add(ptr, Marshal.SizeOf(descs[0]));
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-17 09:57:22 -07:00
|
|
|
EflObjectOps ops;
|
2019-01-17 04:33:09 -08:00
|
|
|
ops.descs = descs_ptr;
|
|
|
|
ops.count = (UIntPtr)count;
|
|
|
|
IntPtr ops_ptr = Marshal.AllocHGlobal(Marshal.SizeOf(ops));
|
|
|
|
Marshal.StructureToPtr(ops, ops_ptr, false);
|
2019-01-15 23:29:56 -08:00
|
|
|
Efl.Eo.Globals.efl_class_functions_set(klass, ops_ptr, IntPtr.Zero);
|
2019-01-17 04:33:09 -08:00
|
|
|
//EoKlass = klass;
|
|
|
|
}
|
|
|
|
else
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-08 02:55:58 -08:00
|
|
|
Eina.Log.Debug("nativeClass == null");
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 00:53:25 -08:00
|
|
|
|
2019-01-17 04:33:09 -08:00
|
|
|
return 1;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr call_efl_class_new(IntPtr desc, IntPtr bk, List<IntPtr> il = null)
|
2018-12-14 09:06:12 -08:00
|
|
|
{
|
|
|
|
IntPtr nul = IntPtr.Zero;
|
|
|
|
int iface_list_count = (il == null ? 0 : il.Count);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
switch (iface_list_count)
|
|
|
|
{
|
|
|
|
default: return nul;
|
|
|
|
case 0: return EoG.efl_class_new(desc, bk, nul);
|
|
|
|
case 1: return EoG.efl_class_new(desc, bk, il[0], nul);
|
|
|
|
case 2: return EoG.efl_class_new(desc, bk, il[0], il[1], nul);
|
|
|
|
case 3: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], nul);
|
|
|
|
case 4: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], nul);
|
|
|
|
case 5: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], nul);
|
|
|
|
case 6: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], nul);
|
|
|
|
case 7: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], nul);
|
|
|
|
case 8: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], nul);
|
|
|
|
case 9: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], nul);
|
|
|
|
case 10: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], nul);
|
|
|
|
case 11: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], nul);
|
|
|
|
case 12: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], nul);
|
|
|
|
case 13: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], nul);
|
|
|
|
case 14: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], nul);
|
|
|
|
case 15: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], nul);
|
|
|
|
case 16: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], nul);
|
|
|
|
case 17: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], nul);
|
|
|
|
case 18: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], nul);
|
|
|
|
case 19: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], nul);
|
|
|
|
case 20: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], nul);
|
|
|
|
case 21: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], nul);
|
|
|
|
case 22: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], nul);
|
|
|
|
case 23: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], nul);
|
|
|
|
case 24: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], nul);
|
|
|
|
case 25: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], nul);
|
|
|
|
case 26: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], nul);
|
|
|
|
case 27: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], nul);
|
|
|
|
case 28: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], nul);
|
|
|
|
case 29: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], nul);
|
|
|
|
case 30: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], nul);
|
|
|
|
case 31: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], nul);
|
|
|
|
case 32: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], nul);
|
|
|
|
case 33: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], nul);
|
|
|
|
case 34: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], nul);
|
|
|
|
case 35: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], nul);
|
|
|
|
case 36: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], nul);
|
|
|
|
case 37: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], nul);
|
|
|
|
case 38: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], nul);
|
|
|
|
case 39: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], nul);
|
|
|
|
case 40: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], nul);
|
|
|
|
case 41: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], nul);
|
|
|
|
case 42: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], nul);
|
|
|
|
case 43: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], nul);
|
|
|
|
case 44: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], nul);
|
|
|
|
case 45: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], nul);
|
|
|
|
case 46: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], nul);
|
|
|
|
case 47: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], nul);
|
|
|
|
case 48: return EoG.efl_class_new(desc, bk, il[0], il[1], il[2], il[3], il[4], il[5], il[6], il[7], il[8], il[9], il[10], il[11], il[12], il[13], il[14], il[15], il[16], il[17], il[18], il[19], il[20], il[21], il[22], il[23], il[24], il[25], il[26], il[27], il[28], il[29], il[30], il[31], il[32], il[33], il[34], il[35], il[36], il[37], il[38], il[39], il[40], il[41], il[42], il[43], il[44], il[45], il[46], il[47], nul);
|
2018-12-14 09:06:12 -08:00
|
|
|
}
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static Efl.Eo.WrapperSupervisor WrapperSupervisorPtrToManaged(IntPtr wsPtr)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
return (Efl.Eo.WrapperSupervisor) GCHandle.FromIntPtr(wsPtr).Target;
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static Efl.Eo.WrapperSupervisor GetWrapperSupervisor(IntPtr eo)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
var wsPtr = Efl.Eo.Globals.efl_mono_wrapper_supervisor_get(eo);
|
|
|
|
if (wsPtr == IntPtr.Zero)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
return null;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
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 13:43:11 -07:00
|
|
|
|
|
|
|
return WrapperSupervisorPtrToManaged(wsPtr);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void SetWrapperSupervisor(IntPtr eo, Efl.Eo.WrapperSupervisor ws)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
GCHandle gch = GCHandle.Alloc(ws);
|
|
|
|
Efl.Eo.Globals.efl_mono_wrapper_supervisor_set(eo, GCHandle.ToIntPtr(gch));
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void free_dict_values(Dictionary<String, IntPtr> dict)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
foreach (IntPtr ptr in dict.Values)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
Eina.MemoryNative.Free(ptr);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void free_stringshare_values(Dictionary<String, IntPtr> dict)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
foreach (IntPtr ptr in dict.Values)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-06-28 06:40:52 -07:00
|
|
|
Eina.NativeMethods.eina_stringshare_del(ptr);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void free_gchandle(IntPtr ptr)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
GCHandle handle = GCHandle.FromIntPtr(ptr);
|
|
|
|
handle.Free();
|
|
|
|
}
|
2018-05-07 15:22:59 -07:00
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static System.Threading.Tasks.Task<Eina.Value> WrapAsync(Eina.Future future, CancellationToken token)
|
2018-05-07 15:22:59 -07:00
|
|
|
{
|
|
|
|
// Creates a task that will wait for SetResult for completion.
|
|
|
|
// TaskCompletionSource is used to create tasks for 'external' Task sources.
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
var tcs = new System.Threading.Tasks.TaskCompletionSource<Eina.Value>();
|
2018-05-07 15:22:59 -07:00
|
|
|
|
|
|
|
// Flag to be passed to the cancell callback
|
|
|
|
bool fulfilled = false;
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
future.Then((Eina.Value received) =>
|
|
|
|
{
|
|
|
|
lock (future)
|
|
|
|
{
|
|
|
|
// Convert an failed Future to a failed Task.
|
|
|
|
if (received.GetValueType() == Eina.ValueType.Error)
|
2018-05-07 15:22:59 -07:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
Eina.Error err;
|
|
|
|
received.Get(out err);
|
|
|
|
if (err == Eina.Error.ECANCELED)
|
2018-05-07 15:22:59 -07:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
tcs.SetCanceled();
|
2018-05-07 15:22:59 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-28 07:59:52 -07:00
|
|
|
tcs.TrySetException(new Efl.FutureException(err));
|
2018-05-07 15:22:59 -07:00
|
|
|
}
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
else
|
|
|
|
{
|
2019-06-27 15:04:59 -07:00
|
|
|
// Async receiver methods may consume the value C# wrapper, like when awaiting in the start of an
|
|
|
|
// using block. In order to continue to forward the value correctly to the next futures
|
|
|
|
// in the chain, we give the Async wrapper a copy of the received wrapper.
|
|
|
|
tcs.SetResult(new Eina.Value(received));
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fulfilled = true;
|
|
|
|
return received;
|
|
|
|
}
|
2018-05-07 15:22:59 -07:00
|
|
|
});
|
|
|
|
// Callback to be called when the token is cancelled.
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
token.Register(() =>
|
|
|
|
{
|
|
|
|
lock (future)
|
|
|
|
{
|
|
|
|
// Will trigger the Then callback above with an Eina.Error
|
|
|
|
if (!fulfilled)
|
2018-05-07 15:22:59 -07:00
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
future.Cancel();
|
2018-05-07 15:22:59 -07:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2018-05-07 15:22:59 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
return tcs.Task;
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
|
|
|
/// <summary>Returns whether the given type was generated by eolian-mono</summary>
|
|
|
|
/// <param name="managedType">The type to check.</param>
|
|
|
|
/// <returns>True if generated by eolian-mono. False otherwise.</returns>
|
|
|
|
private static bool IsGeneratedClass(System.Type managedType)
|
|
|
|
{
|
|
|
|
return GetNativeClass(managedType) != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>Creates a new wrapper for the given Eo id.
|
|
|
|
///
|
2019-07-26 06:00:17 -07:00
|
|
|
/// <para>If the Eo have a WrapperSupervisor, it returns the C# instance handle stored in its
|
|
|
|
/// WrapperSupervisor. otherwise, we use reflection to get the correct C# type to re-wrap it.</para>
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <param name="handle">The Eo id to be wrapped.</param>
|
|
|
|
/// <param name="shouldIncRef">Whether we should increase the refcount of the Eo instance.</param>
|
|
|
|
/// <returns>The C# wrapper for this instance.</returns>
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static Efl.Eo.IWrapper CreateWrapperFor(System.IntPtr handle, bool shouldIncRef=true)
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
2019-04-09 12:23:03 -07:00
|
|
|
|
|
|
|
if (handle == IntPtr.Zero)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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 13:43:11 -07:00
|
|
|
Efl.Eo.Globals.efl_ref(handle);
|
|
|
|
try
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
var ws = Efl.Eo.Globals.GetWrapperSupervisor(handle);
|
|
|
|
if (ws != null && ws.Target != null)
|
|
|
|
{
|
|
|
|
if (!shouldIncRef)
|
|
|
|
{
|
|
|
|
Efl.Eo.Globals.efl_unref(handle);
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
return ws.Target;
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
IntPtr eoKlass = efl_class_get(handle);
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
if (eoKlass == IntPtr.Zero)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException($"Can't get Eo class for object handle 0x{handle.ToInt64():x}");
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
var managedType = ClassRegister.GetManagedType(eoKlass);
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
if (managedType == null)
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
IntPtr nativeName = efl_class_name_get(eoKlass);
|
|
|
|
var name = Eina.StringConversion.NativeUtf8ToManagedString(nativeName);
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
throw new InvalidOperationException($"Can't get Managed class for object handle 0x{handle.ToInt64():x} with native class [{name}]");
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
Debug.Assert(IsGeneratedClass(managedType));
|
|
|
|
System.Reflection.ConstructorInfo constructor = null;
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
try
|
|
|
|
{
|
|
|
|
var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
2019-06-28 14:20:01 -07:00
|
|
|
constructor = managedType.GetConstructor(flags, null, new Type[1] { typeof(WrappingHandle) }, null);
|
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 13:43:11 -07:00
|
|
|
}
|
|
|
|
catch (InvalidOperationException)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException($"Can't get constructor for type {managedType}");
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
2019-06-28 14:20:01 -07:00
|
|
|
WrappingHandle wh = new WrappingHandle(handle);
|
|
|
|
var ret = (Efl.Eo.IWrapper) constructor.Invoke(new object[1] { wh });
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
if (ret == null)
|
|
|
|
{
|
|
|
|
throw new InvalidOperationException($"Can't construct type {managedType} from IntPtr handle");
|
|
|
|
}
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
if (shouldIncRef)
|
|
|
|
{
|
|
|
|
Efl.Eo.Globals.efl_ref(handle);
|
|
|
|
}
|
2019-04-05 15:59:34 -07:00
|
|
|
|
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 13:43:11 -07:00
|
|
|
return ret;
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
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 13:43:11 -07:00
|
|
|
finally
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
Efl.Eo.Globals.efl_unref(handle);
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 13:43:11 -07:00
|
|
|
private static Efl.FreeWrapperSupervisorCb FreeWrapperSupervisorCallbackDelegate = new Efl.FreeWrapperSupervisorCb(FreeWrapperSupervisorCallback);
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void FreeWrapperSupervisorCallback(IntPtr eo)
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
var wsPtr = Efl.Eo.Globals.efl_mono_wrapper_supervisor_get(eo);
|
|
|
|
if (wsPtr == IntPtr.Zero)
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
Eina.Log.Error($"Invalid wrapper supervisor [Eo pointer: {eo.ToInt64():x}]");
|
2019-04-05 15:59:34 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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 13:43:11 -07:00
|
|
|
Efl.Eo.Globals.efl_mono_wrapper_supervisor_set(eo, IntPtr.Zero);
|
|
|
|
|
|
|
|
GCHandle gch = GCHandle.FromIntPtr(wsPtr);
|
|
|
|
var ws = (Efl.Eo.WrapperSupervisor) gch.Target;
|
|
|
|
foreach (var item in ws.EoEvents)
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
if (!efl_event_callback_del(eo, item.Key.desc, item.Value.evtCallerPtr, wsPtr))
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
Eina.Log.Error($"Failed to remove event proxy for event {item.Key.desc} [eo: {eo.ToInt64():x}; cb: {item.Value.evtCallerPtr.ToInt64():x}]");
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
}
|
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 13:43:11 -07:00
|
|
|
|
|
|
|
// Free the native eo
|
|
|
|
Efl.Eo.Globals.efl_unref(eo);
|
|
|
|
|
|
|
|
// now the WrapperSupervisor can be collected, and so its member:
|
|
|
|
// - the event dictionary
|
|
|
|
// - and the EoWrapper if it is still pinned
|
|
|
|
gch.Free();
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Eina.Log.Error(e.ToString());
|
|
|
|
Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void SetNativeDisposeCallbacks()
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
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 13:43:11 -07:00
|
|
|
efl_mono_wrapper_supervisor_callbacks_set(FreeWrapperSupervisorCallbackDelegate);
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
|
2019-10-31 14:21:42 -07:00
|
|
|
internal static void ThreadSafeFreeCbExec(Eina.Callbacks.EinaFreeCb cbFreeCb, IntPtr cbData)
|
2019-04-15 10:09:49 -07:00
|
|
|
{
|
2019-10-31 14:21:42 -07:00
|
|
|
Eina.Callbacks.EinaFreeCb cb = (IntPtr gcHandlePtr) => {
|
2019-04-15 10:09:49 -07:00
|
|
|
cbFreeCb(cbData);
|
|
|
|
GCHandle gcHandle = GCHandle.FromIntPtr(gcHandlePtr);
|
|
|
|
gcHandle.Free();
|
|
|
|
};
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-04-15 10:09:49 -07:00
|
|
|
Monitor.Enter(Efl.All.InitLock);
|
|
|
|
if (Efl.All.MainLoopInitialized)
|
|
|
|
{
|
|
|
|
IntPtr cbPtr = Marshal.GetFunctionPointerForDelegate(cb);
|
|
|
|
var handle = GCHandle.Alloc(cb);
|
|
|
|
var handlePtr = GCHandle.ToIntPtr(handle);
|
2019-04-05 15:59:34 -07:00
|
|
|
|
2019-04-15 10:09:49 -07:00
|
|
|
efl_mono_thread_safe_free_cb_exec(cbPtr, handlePtr);
|
|
|
|
}
|
|
|
|
Monitor.Exit(Efl.All.InitLock);
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
|
2019-12-17 06:34:30 -08:00
|
|
|
internal static IEnumerable<T> AccessorToIEnumerable<T>(IntPtr accessor)
|
|
|
|
{
|
|
|
|
if (accessor == IntPtr.Zero)
|
|
|
|
throw new ArgumentException("accessor is null", nameof(accessor));
|
|
|
|
|
|
|
|
IntPtr data = IntPtr.Zero;
|
|
|
|
uint position = 0;
|
|
|
|
|
|
|
|
while (Eina.AccessorNativeFunctions.eina_accessor_data_get(accessor, position, out data))
|
|
|
|
{
|
|
|
|
yield return Eina.TraitFunctions.NativeToManaged<T>(data);
|
|
|
|
position += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
internal static IntPtr IEnumerableToAccessor<T>(IEnumerable<T> enumerable, bool isMoved)
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
|
|
|
if (enumerable == null)
|
2019-12-17 06:34:41 -08:00
|
|
|
{
|
2019-12-17 06:34:30 -08:00
|
|
|
throw new ArgumentException("enumerable is null", nameof(enumerable));
|
2019-12-17 06:34:41 -08:00
|
|
|
}
|
2019-12-17 06:34:30 -08:00
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
// If we are a wrapper around an existing Eina.Accessor, we can just forward
|
|
|
|
// it and avoid unnecessary copying in non-owning transfers.
|
|
|
|
var wrappedAccessor = enumerable as Eina.Accessor<T>;
|
|
|
|
|
|
|
|
if (wrappedAccessor != null && !isMoved)
|
|
|
|
{
|
|
|
|
return wrappedAccessor.Handle;
|
|
|
|
}
|
|
|
|
|
2019-12-18 05:36:29 -08:00
|
|
|
// TODO: Check if we're either an Eina.List or Eina.Collection?
|
|
|
|
// We could just rewrap their native accessors
|
|
|
|
IntPtr[] intPtrs = new IntPtr[enumerable.Count()];
|
|
|
|
|
|
|
|
int i = 0;
|
2019-12-17 06:34:30 -08:00
|
|
|
foreach (T data in enumerable)
|
|
|
|
{
|
2019-12-18 05:36:29 -08:00
|
|
|
intPtrs[i] = Eina.TraitFunctions.ManagedToNativeAlloc<T>(data);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
GCHandle pinnedArray = GCHandle.Alloc(intPtrs, GCHandleType.Pinned);
|
|
|
|
IntPtr nativeAccessor = IntPtr.Zero;
|
|
|
|
|
|
|
|
if (isMoved)
|
|
|
|
{
|
|
|
|
// We need a custom accessor that would unpin the data when freed.
|
|
|
|
nativeAccessor = Eina.AccessorNativeFunctions.eina_mono_owned_carray_length_accessor_new(pinnedArray.AddrOfPinnedObject(),
|
|
|
|
(uint)IntPtr.Size,
|
|
|
|
(uint)intPtrs.Length,
|
|
|
|
free_gchandle,
|
|
|
|
GCHandle.ToIntPtr(pinnedArray));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// FIXME: Leaking....
|
|
|
|
nativeAccessor = Eina.AccessorNativeFunctions.eina_carray_length_accessor_new(pinnedArray.AddrOfPinnedObject(),
|
|
|
|
(uint)(IntPtr.Size),
|
|
|
|
(uint)intPtrs.Length);
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
2019-12-17 06:34:41 -08:00
|
|
|
|
2019-12-18 05:36:29 -08:00
|
|
|
if (nativeAccessor == IntPtr.Zero)
|
2019-12-17 06:34:41 -08:00
|
|
|
{
|
2019-12-18 05:36:29 -08:00
|
|
|
pinnedArray.Free();
|
|
|
|
throw new InvalidOperationException("Failed to get native accessor for the given container");
|
2019-12-17 06:34:41 -08:00
|
|
|
}
|
|
|
|
|
2019-12-18 05:36:29 -08:00
|
|
|
return nativeAccessor;
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
internal static IEnumerable<T> IteratorToIEnumerable<T>(IntPtr iterator)
|
|
|
|
{
|
|
|
|
if (iterator == IntPtr.Zero)
|
|
|
|
throw new ArgumentException("iterator is null", nameof(iterator));
|
|
|
|
|
|
|
|
while (Eina.IteratorNativeFunctions.eina_iterator_next(iterator, out IntPtr data))
|
|
|
|
{
|
|
|
|
yield return Eina.TraitFunctions.NativeToManaged<T>(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
internal static IntPtr IEnumerableToIterator<T>(IEnumerable<T> enumerable, bool isMoved)
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
|
|
|
if (enumerable == null)
|
2019-12-17 06:34:41 -08:00
|
|
|
{
|
2019-12-17 06:34:30 -08:00
|
|
|
throw new ArgumentException("enumerable is null", nameof(enumerable));
|
2019-12-17 06:34:41 -08:00
|
|
|
}
|
2019-12-17 06:34:30 -08:00
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
// If we are a wrapper around an existing Eina.Iterator, we can just forward
|
|
|
|
// it and avoid unnecessary copying in non-owning transfers.
|
|
|
|
var wrappedIterator = enumerable as Eina.Iterator<T>;
|
|
|
|
|
|
|
|
if (wrappedIterator != null && !isMoved)
|
|
|
|
{
|
|
|
|
return wrappedIterator.Handle;
|
|
|
|
}
|
2019-12-17 06:34:30 -08:00
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
var list = new List<IntPtr>();
|
2019-12-17 06:34:30 -08:00
|
|
|
foreach (T data in enumerable)
|
|
|
|
{
|
|
|
|
list.Add(Eina.TraitFunctions.ManagedToNativeAlloc<T>(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
IntPtr[] dataArray = list.ToArray();
|
2019-12-17 06:34:41 -08:00
|
|
|
GCHandle pinnedArray = GCHandle.Alloc(dataArray, GCHandleType.Pinned);
|
|
|
|
IntPtr ret = Eina.IteratorNativeFunctions.eina_carray_length_iterator_new(pinnedArray.AddrOfPinnedObject(), (uint)(IntPtr.Size), (uint)dataArray.Length);
|
|
|
|
|
|
|
|
if (!isMoved)
|
|
|
|
{
|
|
|
|
// FIXME Need to free ret and unpin pinnedArray in the future.
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
|
|
|
|
2020-01-14 00:17:04 -08:00
|
|
|
internal static IList<T> NativeListToIList<T>(IntPtr nativeList)
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
2020-01-14 00:17:04 -08:00
|
|
|
if (nativeList == IntPtr.Zero)
|
|
|
|
throw new ArgumentException("nativeList is null", nameof(nativeList));
|
2019-12-17 06:34:30 -08:00
|
|
|
|
|
|
|
IntPtr l;
|
2020-01-14 00:17:04 -08:00
|
|
|
List<T> list = new List<T>();
|
|
|
|
for (l = nativeList; l != IntPtr.Zero; l = Eina.ListNativeFunctions.eina_list_next_custom_export_mono(l))
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
2020-01-14 00:17:04 -08:00
|
|
|
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ListNativeFunctions.eina_list_data_get_custom_export_mono(l)));
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
2020-01-14 00:17:04 -08:00
|
|
|
return list;
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
|
|
|
|
2020-01-14 00:17:04 -08:00
|
|
|
internal static IntPtr IListToNativeList<T>(IList<T> list, bool isMoved)
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
2020-01-14 00:17:04 -08:00
|
|
|
if (list == null)
|
|
|
|
throw new ArgumentException("list is null", nameof(list));
|
2019-12-17 06:34:30 -08:00
|
|
|
|
2020-01-14 00:17:04 -08:00
|
|
|
// If we are a wrapper around an existing Eina.List, we can just forward
|
|
|
|
// it and avoid unnecessary copying in non-owning transfers.
|
|
|
|
var wrappedList = list as Eina.List<T>;
|
|
|
|
|
|
|
|
if (wrappedList != null && !isMoved)
|
|
|
|
{
|
|
|
|
return wrappedList.Handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
IntPtr nativeList = IntPtr.Zero;
|
|
|
|
foreach (T data in list)
|
2019-12-17 06:34:30 -08:00
|
|
|
{
|
2020-01-14 00:17:04 -08:00
|
|
|
nativeList = Eina.ListNativeFunctions.eina_list_append(nativeList, Eina.TraitFunctions.ManagedToNativeAlloc(data)); //FIXME: need to free
|
2019-12-17 06:34:30 -08:00
|
|
|
}
|
2020-01-14 00:17:04 -08:00
|
|
|
|
|
|
|
if (!isMoved)
|
|
|
|
{
|
|
|
|
// FIXME Need to free ret and unpin pinnedArray in the future.
|
|
|
|
}
|
|
|
|
|
|
|
|
return nativeList;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal static IList<T> NativeArrayToIList<T>(IntPtr nativeArray)
|
|
|
|
{
|
|
|
|
if (nativeArray == IntPtr.Zero)
|
|
|
|
throw new ArgumentException("nativeArray is null", nameof(nativeArray));
|
|
|
|
|
|
|
|
List<T> list = new List<T>();
|
|
|
|
UpdateListFromNativeArray(list, nativeArray);
|
|
|
|
|
2019-12-17 06:34:41 -08:00
|
|
|
// FIXME need to free `list` if the returned list is not @moved
|
2019-12-17 06:34:30 -08:00
|
|
|
return list;
|
|
|
|
}
|
2019-06-28 14:20:01 -07:00
|
|
|
|
2020-01-14 00:17:04 -08:00
|
|
|
internal static IntPtr IListToNativeArray<T>(IList<T> list, bool isMoved)
|
|
|
|
{
|
|
|
|
if (list == null)
|
|
|
|
throw new ArgumentException("list is null", nameof(list));
|
|
|
|
|
|
|
|
// If we are a wrapper around an existing Eina.Array, we can just forward
|
|
|
|
// it and avoid unnecessary copying in non-owning transfers.
|
|
|
|
var wrappedArray = list as Eina.Array<T>;
|
|
|
|
|
|
|
|
if (wrappedArray != null && !isMoved)
|
|
|
|
{
|
|
|
|
return wrappedArray.Handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
IntPtr nativeArray = Eina.ArrayNativeFunctions.eina_array_new(4);
|
|
|
|
foreach (T data in list)
|
|
|
|
{
|
|
|
|
Eina.ArrayNativeFunctions.eina_array_push_custom_export_mono(nativeArray, Eina.TraitFunctions.ManagedToNativeAlloc(data)); //FIXME: need to free
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isMoved)
|
|
|
|
{
|
|
|
|
// FIXME Need to free ret and unpin pinnedArray in the future.
|
|
|
|
}
|
|
|
|
|
|
|
|
return nativeArray;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal static void UpdateListFromNativeArray<T>(IList<T> list, IntPtr nativeArray)
|
|
|
|
{
|
|
|
|
// Do not update if list Handle is same to nativeArray. They already updated in native code.
|
|
|
|
var wrappedArray = list as Eina.Array<T>;
|
|
|
|
if (wrappedArray != null && wrappedArray.Handle == nativeArray)
|
|
|
|
return;
|
|
|
|
|
|
|
|
list.Clear();
|
|
|
|
if (nativeArray == IntPtr.Zero)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint count = Eina.ArrayNativeFunctions.eina_array_count_custom_export_mono(nativeArray);
|
|
|
|
for (uint i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
list.Add(Eina.TraitFunctions.NativeToManaged<T>(Eina.ArrayNativeFunctions.eina_array_data_get_custom_export_mono(nativeArray, i)));
|
|
|
|
}
|
|
|
|
}
|
2019-06-28 14:20:01 -07:00
|
|
|
|
2019-04-15 10:09:49 -07:00
|
|
|
} // Globals
|
|
|
|
|
2019-11-04 09:40:18 -08:00
|
|
|
/// <summary>
|
|
|
|
/// Internal struct used by the binding to pass the native handle pointer
|
|
|
|
/// to the managed object wrapping constructor.
|
|
|
|
/// Internal usage only: do not use this class in inherited classes.
|
|
|
|
/// </summary>
|
|
|
|
internal struct WrappingHandle
|
|
|
|
{
|
|
|
|
public WrappingHandle(IntPtr h)
|
|
|
|
{
|
|
|
|
NativeHandle = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IntPtr NativeHandle { get; private set; }
|
|
|
|
}
|
|
|
|
|
2019-12-20 00:44:41 -08:00
|
|
|
/// <summary>
|
|
|
|
/// Manage the initialization and cleanup for the Efl object subsystem.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
2019-04-15 10:09:49 -07:00
|
|
|
public static class Config
|
|
|
|
{
|
2019-12-20 00:44:41 -08:00
|
|
|
/// <summary>
|
|
|
|
/// Initialize the EFL object subsystem.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public static void Init()
|
|
|
|
{
|
|
|
|
Globals.efl_object_init();
|
2019-04-05 15:59:34 -07:00
|
|
|
Globals.SetNativeDisposeCallbacks();
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-12-20 00:44:41 -08:00
|
|
|
/// <summary>
|
|
|
|
/// Shutdown the EFL object subsystem.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public static void Shutdown()
|
|
|
|
{
|
|
|
|
Globals.efl_object_shutdown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-14 09:06:12 -08:00
|
|
|
[System.AttributeUsage(System.AttributeTargets.Class |
|
|
|
|
System.AttributeTargets.Interface,
|
|
|
|
AllowMultiple = false,
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
Inherited = false)
|
2018-12-14 09:06:12 -08:00
|
|
|
]
|
2019-10-28 14:48:26 -07:00
|
|
|
abstract class NativeClass : System.Attribute
|
2018-12-14 09:06:12 -08:00
|
|
|
{
|
2019-10-28 14:48:26 -07:00
|
|
|
internal abstract IntPtr GetEflClass();
|
|
|
|
internal abstract System.Collections.Generic.List<EflOpDescription> GetEoOps(System.Type type, bool includeInherited);
|
2018-12-14 09:06:12 -08:00
|
|
|
}
|
|
|
|
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
/// <summary>Attribute for private native classes.
|
|
|
|
///
|
|
|
|
/// <para>For internal usage by generated code only.</para></summary>
|
2019-10-28 14:48:26 -07:00
|
|
|
class PrivateNativeClass : NativeClass
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
2019-10-28 14:48:26 -07:00
|
|
|
internal override IntPtr GetEflClass()
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
|
|
|
return IntPtr.Zero;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:48:26 -07:00
|
|
|
internal override System.Collections.Generic.List<EflOpDescription> GetEoOps(System.Type type, bool includeInherited)
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 11:50:33 -07:00
|
|
|
[System.AttributeUsage(System.AttributeTargets.Class |
|
|
|
|
System.AttributeTargets.Interface |
|
|
|
|
System.AttributeTargets.Enum |
|
|
|
|
System.AttributeTargets.Delegate |
|
|
|
|
System.AttributeTargets.Struct,
|
|
|
|
AllowMultiple = false,
|
|
|
|
Inherited = false)
|
|
|
|
]
|
2019-12-20 02:24:29 -08:00
|
|
|
internal class BindingEntityAttribute: System.Attribute
|
2019-07-11 11:50:33 -07:00
|
|
|
{
|
|
|
|
public static bool IsBindingEntity(System.Type t)
|
|
|
|
{
|
2019-12-17 05:56:42 -08:00
|
|
|
return Attribute.GetCustomAttribute(t, typeof(BindingEntityAttribute), false) != null;
|
2019-07-11 11:50:33 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
public interface IWrapper
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/// <summary>Pointer to internal Eo instance.</summary>
|
|
|
|
IntPtr NativeHandle
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
get;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/// <summary>Pointer to internal Eo class.</summary>
|
2019-02-06 00:53:25 -08:00
|
|
|
IntPtr NativeClass
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
get;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static class ClassRegister
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static System.Type GetManagedType(IntPtr klass)
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
|
|
|
System.Type t;
|
|
|
|
if (Efl.Eo.ClassRegister.typeFromKlass.TryGetValue(klass, out t))
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
return t;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
|
|
|
|
// If it isn't on the dictionary then it is a Native binding class
|
|
|
|
IntPtr namePtr = Efl.Eo.Globals.efl_class_name_get(klass);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
if (namePtr == IntPtr.Zero)
|
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
throw new System.InvalidOperationException($"Could not get Native class name. Handle: {klass}");
|
|
|
|
}
|
2019-11-20 11:57:14 -08:00
|
|
|
#pragma warning disable CA1307
|
2019-02-06 11:50:28 -08:00
|
|
|
string name = Eina.StringConversion.NativeUtf8ToManagedString(namePtr)
|
2019-11-20 11:57:14 -08:00
|
|
|
.Replace("_", ""); // Convert Efl C name to C# name
|
|
|
|
#pragma warning restore CA1307
|
2019-02-06 11:50:28 -08:00
|
|
|
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
// Check if this is an internal implementation of an abstract class
|
|
|
|
var abstract_impl_suffix = "Realized";
|
2019-11-20 11:57:14 -08:00
|
|
|
if (name.EndsWith(abstract_impl_suffix, StringComparison.Ordinal))
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
{
|
|
|
|
name = name.Substring(0, name.Length - abstract_impl_suffix.Length);
|
2019-11-20 11:57:14 -08:00
|
|
|
var lastDot = name.LastIndexOf(".", StringComparison.Ordinal);
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
var klassName = name.Substring(lastDot + 1);
|
|
|
|
name += "+" + klassName + abstract_impl_suffix; // '+' is the separator for nested classes
|
|
|
|
}
|
|
|
|
|
2019-03-21 10:38:45 -07:00
|
|
|
// When converting to managed, interfaces and mixins gets the 'I' prefix.
|
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 13:43:11 -07:00
|
|
|
var klass_type = Efl.Eo.Globals.efl_class_type_get(klass);
|
2019-03-21 10:38:45 -07:00
|
|
|
if (klass_type == Efl.Eo.Globals.EflClassType.Interface || klass_type == Efl.Eo.Globals.EflClassType.Mixin)
|
|
|
|
{
|
2019-11-20 11:57:14 -08:00
|
|
|
var pos = name.LastIndexOf(".", StringComparison.Ordinal);
|
2019-03-21 10:38:45 -07:00
|
|
|
name = name.Insert(pos + 1, "I"); // -1 if not found, inserts at 0 normally
|
|
|
|
}
|
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
var curr_asm = typeof(IWrapper).Assembly;
|
|
|
|
t = curr_asm.GetType(name);
|
|
|
|
if (t == null)
|
|
|
|
{
|
|
|
|
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
|
|
|
{
|
|
|
|
if (assembly == curr_asm)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
continue;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
|
|
|
|
t = assembly.GetType(name);
|
|
|
|
if (t != null)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
break;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
|
|
|
if (t == null)
|
|
|
|
{
|
2019-09-24 07:36:34 -07:00
|
|
|
return typeof(Efl.ObjectRealized);
|
2019-02-06 11:50:28 -08:00
|
|
|
}
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
AddToKlassTypeBiDictionary(klass, t); // Cache it in the dictionary
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr GetKlass(System.Type objectType)
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
|
|
|
IntPtr klass;
|
|
|
|
if (klassFromType.TryGetValue(objectType, out klass))
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
return klass;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
|
|
|
|
// Check if it is a Native binding class
|
|
|
|
klass = GetNativeKlassPtr(objectType);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
if (klass != IntPtr.Zero)
|
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
// Add to the dictionary cache
|
|
|
|
AddToKlassTypeBiDictionary(klass, objectType);
|
|
|
|
return klass;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unregistered Inherited class, let's register it
|
|
|
|
IntPtr baseKlass = GetNativeBaseKlassPtr(objectType);
|
|
|
|
if (baseKlass == IntPtr.Zero)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
throw new System.InvalidOperationException($"Could not get base C# binding class for Inherited type: {objectType.FullName}");
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
return RegisterKlass(baseKlass, objectType);
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static IntPtr GetInheritKlassOrRegister(IntPtr baseKlass, System.Type objectType)
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
|
|
|
IntPtr klass;
|
|
|
|
if (klassFromType.TryGetValue(objectType, out klass))
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
return klass;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
|
|
|
|
return RegisterKlass(baseKlass, objectType);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static IntPtr RegisterKlass(IntPtr baseKlass, System.Type objectType)
|
|
|
|
{
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
lock (klassAllocLock)
|
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
IntPtr newKlass = Efl.Eo.Globals.register_class(objectType.FullName, baseKlass, objectType);
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
if (newKlass == IntPtr.Zero)
|
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
throw new System.InvalidOperationException($"Failed to register class '{objectType.FullName}'");
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
AddToKlassTypeBiDictionary(newKlass, objectType);
|
|
|
|
return newKlass;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static IntPtr GetNativeBaseKlassPtr(System.Type objectType)
|
|
|
|
{
|
|
|
|
for (System.Type t = objectType.BaseType; t != null; t = t.BaseType)
|
|
|
|
{
|
2019-03-15 07:30:24 -07:00
|
|
|
var ptr = GetNativeKlassPtr(t);
|
|
|
|
if (ptr != IntPtr.Zero)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-03-15 07:30:24 -07:00
|
|
|
return ptr;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-02-06 11:50:28 -08:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
throw new System.InvalidOperationException($"Class '{objectType.FullName}' is not an Efl object");
|
|
|
|
}
|
|
|
|
|
|
|
|
private static IntPtr GetNativeKlassPtr(System.Type objectType)
|
|
|
|
{
|
2019-03-15 07:30:24 -07:00
|
|
|
if (objectType == null)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-03-15 07:30:24 -07:00
|
|
|
return IntPtr.Zero;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
2019-03-15 07:30:24 -07:00
|
|
|
|
|
|
|
if (objectType.IsInterface)
|
|
|
|
{
|
2020-01-22 14:30:13 -08:00
|
|
|
// Try to get the *NativeMethods class
|
|
|
|
var nativeMethods = (Efl.Eo.NativeClass)System.Attribute.GetCustomAttributes(objectType)?.FirstOrDefault(attr => attr is Efl.Eo.NativeClass);
|
|
|
|
if (nativeMethods == null)
|
2019-03-15 07:30:24 -07:00
|
|
|
return IntPtr.Zero;
|
2020-01-22 14:30:13 -08:00
|
|
|
|
|
|
|
return nativeMethods.GetEflClass();
|
2019-03-15 07:30:24 -07:00
|
|
|
}
|
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
var method = objectType.GetMethod("GetEflClassStatic",
|
|
|
|
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
|
2019-03-15 07:30:24 -07:00
|
|
|
|
|
|
|
if (method == null)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-03-15 07:30:24 -07:00
|
|
|
return IntPtr.Zero;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return (IntPtr)(method.Invoke(null, null));
|
2019-02-06 11:50:28 -08:00
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static void AddToKlassTypeBiDictionary(IntPtr klassPtr, System.Type objectType)
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
|
|
|
klassFromType[objectType] = klassPtr;
|
|
|
|
typeFromKlass[klassPtr] = objectType;
|
|
|
|
}
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static readonly System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr> klassFromType
|
2019-02-06 11:50:28 -08:00
|
|
|
= new System.Collections.Concurrent.ConcurrentDictionary<System.Type, System.IntPtr>();
|
|
|
|
|
2019-10-29 07:56:38 -07:00
|
|
|
internal static readonly System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type> typeFromKlass
|
2019-02-06 11:50:28 -08:00
|
|
|
= new System.Collections.Concurrent.ConcurrentDictionary<System.IntPtr, System.Type>();
|
|
|
|
|
|
|
|
private static readonly object klassAllocLock = new object();
|
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>Custom marshaler for Eo objects that do not move ownership between native and managed code.
|
|
|
|
///
|
|
|
|
/// <para>For internal usage by generated code.</para>
|
|
|
|
///
|
2019-12-17 03:04:01 -08:00
|
|
|
/// <para>Since EFL 1.24.</para>
|
2019-11-01 06:04:04 -07:00
|
|
|
/// </summary>
|
|
|
|
class MarshalEoNoMove : ICustomMarshaler
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-11-01 06:04:04 -07:00
|
|
|
private static ICustomMarshaler instance = new MarshalEoNoMove();
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Gets an instance of this marshaler.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="cookie">Cookie to identify the marshaler. Unused.</param>
|
|
|
|
/// <returns>The marshaler instance.</returns>
|
|
|
|
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "The same marshaler is used for all cases.")]
|
|
|
|
public static ICustomMarshaler GetInstance(string cookie) => instance;
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Clean ups the managed data.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ManagedObj">The object to be cleaned.</param>
|
|
|
|
public void CleanUpManagedData(object ManagedObj)
|
|
|
|
{
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Clean ups the native data if it was created.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pNativeData">The native data to be cleaned.</param>
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the native data size.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The data size in bytes.</returns>
|
|
|
|
public int GetNativeDataSize() => -1;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Marshals the given managed object to its native handle.
|
|
|
|
/// <para>As this marshaler does not move the reference, the managed code
|
|
|
|
/// can keep its reference and does not need to incref.</para>
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ManagedObj">The object to be marshalled.</param>
|
|
|
|
/// <returns>The marshalled native data.</returns>
|
|
|
|
public IntPtr MarshalManagedToNative(object ManagedObj)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
2019-11-01 06:04:04 -07:00
|
|
|
if (ManagedObj == null)
|
|
|
|
{
|
|
|
|
return IntPtr.Zero;
|
|
|
|
}
|
|
|
|
|
|
|
|
IWrapper wrapper = ManagedObj as IWrapper;
|
|
|
|
|
|
|
|
if (wrapper == null)
|
|
|
|
{
|
|
|
|
throw new ArgumentException("Managed object to be marshalled must be an IWrapper.");
|
|
|
|
}
|
|
|
|
|
|
|
|
return wrapper.NativeHandle;
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Marshals the given native pointer into a managed object.
|
|
|
|
/// <para>The given native object has its reference count incremented in order to make
|
|
|
|
/// the C# wrapper capable of accessing it while the wrapper is alive.</para>
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pNativeData">The native pointer to the EO object.</param>
|
|
|
|
/// <returns>The managed wrapper for the given native object.</returns>
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
|
|
|
return Efl.Eo.Globals.CreateWrapperFor(pNativeData, shouldIncRef : true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>Custom marshaler for Eo objects that move ownership between native and managed code.
|
|
|
|
///
|
|
|
|
/// <para>For internal usage by generated code.</para>
|
|
|
|
///
|
2019-12-17 03:04:01 -08:00
|
|
|
/// <para>Since EFL 1.24.</para>
|
2019-11-01 06:04:04 -07:00
|
|
|
/// </summary>
|
|
|
|
class MarshalEoMove : ICustomMarshaler
|
|
|
|
{
|
|
|
|
private static ICustomMarshaler instance = new MarshalEoMove();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets an instance of this marshaler.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="cookie">Cookie to identify the marshaler. Unused.</param>
|
|
|
|
/// <returns>The marshaler instance.</returns>
|
|
|
|
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", Justification = "The same marshaler is used for all cases.")]
|
|
|
|
public static ICustomMarshaler GetInstance(string cookie) => instance;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Clean ups the managed data.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ManagedObj">The object to be cleaned.</param>
|
|
|
|
public void CleanUpManagedData(object ManagedObj)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Clean ups the native data if it was created.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pNativeData">The native data to be cleaned.</param>
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
2017-11-23 16:49:22 -08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the native data size.
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The data size in bytes.</returns>
|
|
|
|
public int GetNativeDataSize() => -1;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Marshals the given managed object to its native handle.
|
|
|
|
/// <para>The wrapper given as parameter needs to keep a reference to the native
|
|
|
|
/// object, so the EO has its refcount incremented.</para>
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="ManagedObj">The object to be marshalled.</param>
|
|
|
|
/// <returns>The marshalled native data.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
public IntPtr MarshalManagedToNative(object ManagedObj)
|
|
|
|
{
|
csharp: Make classes abstract and rework casting
Summary:
Abstract Eo classes are now proper C# abstract classes.
As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.
Instead of `var window = Efl.Ui.Win.static_cast(widget.GetParent());`
Use `var window = widget.GetParent() as Efl.Ui.Win;`
Another side effect was that `efl_constructor` was removed from the list
of supported `Efl.Object` overrides. It is invoked inside
`efl_add_internal_start`, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.
Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.
Fixes T7778
Fixes T7757
Reviewers: vitor.sousa, felipealmeida, segfaultxavi
Reviewed By: vitor.sousa, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7778, T7757, T7702
Differential Revision: https://phab.enlightenment.org/D8550
2019-04-05 15:53:37 -07:00
|
|
|
if (ManagedObj == null)
|
|
|
|
{
|
|
|
|
return IntPtr.Zero;
|
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
IWrapper wrapper = ManagedObj as IWrapper;
|
|
|
|
|
|
|
|
if (wrapper == null)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-11-01 06:04:04 -07:00
|
|
|
throw new ArgumentException("Managed object to be marshalled must be an IWrapper.");
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
return Efl.Eo.Globals.efl_ref(wrapper.NativeHandle);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
2019-11-01 06:04:04 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Marshals the given native pointer into a managed object.
|
|
|
|
/// <para>The returned wrapper "steals" the reference to keep it alive.</para>
|
|
|
|
/// <para>Since EFL 1.24.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pNativeData">The native pointer to the EO object.</param>
|
|
|
|
/// <returns>The managed wrapper for the given native object.</returns>
|
2017-11-23 16:49:22 -08:00
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
2019-11-01 06:04:04 -07:00
|
|
|
return Efl.Eo.Globals.CreateWrapperFor(pNativeData, shouldIncRef : false);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
///<summary>Marshals between System.Type instances and Eo classes (IntPtrs).</summary>
|
2019-10-28 14:08:01 -07:00
|
|
|
class MarshalEflClass : ICustomMarshaler
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
2019-02-06 11:50:28 -08:00
|
|
|
{
|
2019-04-15 11:29:08 -07:00
|
|
|
Eina.Log.Debug("MarshalEflClass.GetInstance cookie " + cookie);
|
2019-02-06 11:50:28 -08:00
|
|
|
return new MarshalEflClass();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
public void CleanUpManagedData(object ManagedObj)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2019-04-15 11:29:08 -07:00
|
|
|
Eina.Log.Debug("MarshalEflClass.GetNativeDataSize");
|
2019-02-06 11:50:28 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IntPtr MarshalManagedToNative(object ManagedObj)
|
|
|
|
{
|
2019-04-15 11:29:08 -07:00
|
|
|
Eina.Log.Debug("MarshalEflClass.MarshallManagedToNative");
|
2019-02-06 11:50:28 -08:00
|
|
|
if (ManagedObj == null)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
return IntPtr.Zero;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
var t = (System.Type)ManagedObj;
|
2019-02-06 11:50:28 -08:00
|
|
|
return Efl.Eo.ClassRegister.GetKlass(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
2019-04-15 11:29:08 -07:00
|
|
|
Eina.Log.Debug("MarshalEflClass.MarshalNativeToManaged");
|
2019-02-06 11:50:28 -08:00
|
|
|
if (pNativeData == IntPtr.Zero)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
2019-02-06 11:50:28 -08:00
|
|
|
return null;
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
}
|
|
|
|
|
2019-02-06 11:50:28 -08:00
|
|
|
return Efl.Eo.ClassRegister.GetManagedType(pNativeData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StringPassOwnershipMarshaler : ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
|
|
|
|
Eina.MemoryNative.Free(pNativeData);
|
2017-11-23 16:49:22 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return Eina.MemoryNative.StrDup((string)managedObj);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
// No need to cleanup. C will take care of it.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
marshaler = new StringPassOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
static private StringPassOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2020-02-28 07:58:08 -08:00
|
|
|
|
|
|
|
class StringOutMarshaler: ICustomMarshaler
|
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
|
|
|
return Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
|
|
|
|
}
|
|
|
|
|
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
|
|
|
return Eina.MemoryNative.SlstrCopyNew((string)managedObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
|
|
|
marshaler = new StringOutMarshaler();
|
|
|
|
}
|
|
|
|
|
|
|
|
return marshaler;
|
|
|
|
}
|
|
|
|
|
|
|
|
static private StringOutMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StringKeepOwnershipMarshaler: ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return Eina.StringConversion.ManagedStringToNativeUtf8Alloc((string)managedObj);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
// No need to free. The Native side will keep the ownership.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
marshaler = new StringKeepOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
static private StringKeepOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StringsharePassOwnershipMarshaler : ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
var ret = Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
|
2019-06-28 06:40:52 -07:00
|
|
|
Eina.NativeMethods.eina_stringshare_del(pNativeData);
|
2017-11-23 16:49:22 -08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
2019-06-28 06:40:52 -07:00
|
|
|
return Eina.MemoryNative.AddStringshare((string)managedObj);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
// No need to free as it's for own() parameters.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
marshaler = new StringsharePassOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
static private StringsharePassOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StringshareKeepOwnershipMarshaler : ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return Eina.StringConversion.NativeUtf8ToManagedString(pNativeData);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
2019-06-28 06:40:52 -07:00
|
|
|
return Eina.MemoryNative.AddStringshare((string)managedObj);
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
// No need to free, as the native side will keep ownership.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2017-11-23 16:49:22 -08:00
|
|
|
marshaler = new StringshareKeepOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
static private StringshareKeepOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StrbufPassOwnershipMarshaler : ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return new Eina.Strbuf(pNativeData, Eina.Ownership.Managed);
|
2018-01-26 12:01:03 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
Eina.Strbuf buf = managedObj as Eina.Strbuf;
|
2018-01-26 12:01:03 -08:00
|
|
|
buf.ReleaseOwnership();
|
|
|
|
return buf.Handle;
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
// No need to cleanup. C will take care of it.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
marshaler = new StrbufPassOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2018-01-26 12:01:03 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2018-01-26 12:01:03 -08:00
|
|
|
static private StrbufPassOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
class StrbufKeepOwnershipMarshaler: ICustomMarshaler
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
public object MarshalNativeToManaged(IntPtr pNativeData)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return new Eina.Strbuf(pNativeData, Eina.Ownership.Unmanaged);
|
2018-01-26 12:01:03 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public IntPtr MarshalManagedToNative(object managedObj)
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
Eina.Strbuf buf = managedObj as Eina.Strbuf;
|
2018-01-26 12:01:03 -08:00
|
|
|
return buf.Handle;
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpNativeData(IntPtr pNativeData)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
// No need to free. The Native side will keep the ownership.
|
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public void CleanUpManagedData(object managedObj)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
}
|
|
|
|
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
public int GetNativeDataSize()
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-28 14:08:01 -07:00
|
|
|
internal static ICustomMarshaler GetInstance(string cookie)
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
{
|
|
|
|
if (marshaler == null)
|
|
|
|
{
|
2018-01-26 12:01:03 -08:00
|
|
|
marshaler = new StrbufKeepOwnershipMarshaler();
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2018-01-26 12:01:03 -08:00
|
|
|
return marshaler;
|
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2018-01-26 12:01:03 -08:00
|
|
|
static private StrbufKeepOwnershipMarshaler marshaler;
|
|
|
|
}
|
|
|
|
|
2017-11-23 16:49:22 -08:00
|
|
|
} // namespace eo
|
|
|
|
|
2018-05-07 15:22:59 -07:00
|
|
|
/// <summary>General exception for errors inside the binding.</summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public class EflException : Exception
|
|
|
|
{
|
2019-10-28 07:59:52 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Default Constructor.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
public EflException()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-24 08:10:57 -07:00
|
|
|
/// <summary>Create a new EflException with the given message.</summary>
|
2017-11-23 16:49:22 -08:00
|
|
|
public EflException(string message) : base(message)
|
|
|
|
{
|
|
|
|
}
|
2019-10-28 07:59:52 -07:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new EflException with the given message and inner exception.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="message">The message of the exception.</param>
|
|
|
|
/// <param name="innerException">The inner exception.</param>
|
|
|
|
public EflException(string message, Exception innerException)
|
|
|
|
: base(message, innerException)
|
|
|
|
{
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
}
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/// <summary>Exception to be raised when a Task fails due to a failed Eina.Future.</summary>
|
2018-05-07 15:22:59 -07:00
|
|
|
public class FutureException : EflException
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/// <summary>The error code returned by the failed Eina.Future.</summary>
|
|
|
|
public Eina.Error Error { get; private set; }
|
2018-05-07 15:22:59 -07:00
|
|
|
|
2019-10-28 07:59:52 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Default constructor.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
public FutureException() : this(Eina.Error.UNHANDLED_EXCEPTION)
|
2018-05-07 15:22:59 -07:00
|
|
|
{
|
2019-10-28 07:59:52 -07:00
|
|
|
}
|
mono: fix space and brace warnings of StyleCop
Summary:
The following warning rules of StyleCop are checked.
Space rules : SA1000, SA1003, SA1008, SA1009, SA1010, SA1011
Brace rules : SA1500, SA1501, SA1502, SA1503, SA1513
Indentation is also applied.
Reviewers: lauromoura, felipealmeida, vitor.sousa, woohyun
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8485
2019-04-02 07:51:05 -07:00
|
|
|
|
2019-10-28 07:59:52 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Construct a new exception from the <see cref="Eina.Error" />
|
|
|
|
/// with a given message
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="message">The message of the exception.</param>
|
|
|
|
public FutureException(string message)
|
|
|
|
: this(Eina.Error.UNHANDLED_EXCEPTION, message)
|
|
|
|
{
|
2018-05-07 15:22:59 -07:00
|
|
|
}
|
|
|
|
|
2019-10-28 07:59:52 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Construct a new exception from the <see cref="Eina.Error" />
|
|
|
|
/// with a given message and inner exception.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="message">The message of the exception.</param>
|
|
|
|
/// <param name="innerException">The inner exception.</param>
|
|
|
|
public FutureException(string message, Exception innerException)
|
|
|
|
: this(Eina.Error.UNHANDLED_EXCEPTION, message, innerException)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Construct a new exception from the <see cref="Eina.Error" />
|
|
|
|
/// with a given error.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="error">The error of the exception..</param>
|
|
|
|
public FutureException(Eina.Error error)
|
|
|
|
: this(error, "Future failed.")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Construct a new exception from the <see cref="Eina.Error" />
|
|
|
|
/// with a given error and message.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="error">The error of the exception..</param>
|
|
|
|
/// <param name="message">The message of the exception.</param>
|
|
|
|
public FutureException(Eina.Error error, string message)
|
|
|
|
: this(error, message, null)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Construct a new exception from the <see cref="Eina.Error" />
|
|
|
|
/// with a given error, message and innerException.
|
|
|
|
/// <para>Since EFL 1.23.</para>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="error">The error of the exception..</param>
|
|
|
|
/// <param name="message">The message of the exception.</param>
|
|
|
|
/// <param name="innerException">The inner exception.</param>
|
|
|
|
public FutureException(Eina.Error error, string message,
|
|
|
|
Exception innerException)
|
|
|
|
: base(message, innerException) => Error = error;
|
|
|
|
}
|
2017-11-23 16:49:22 -08:00
|
|
|
} // namespace efl
|