summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjong Lee <yj34.lee@samsung.com>2019-09-08 22:13:40 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-09-08 22:14:21 -0300
commitf4d9188ca75b1961d1936abf47fb2685c35d5ee2 (patch)
tree657f3d6e64e98b64e8bba4dddc9dbc1b69fd32fe
parentf6747d68225aa066e1cb088eb75ed851cdc44e91 (diff)
eolian_mono: remove redundant code in NativeMethods
Summary: Duplicated interface's NativeMethods code will be removed. they are called in `GetInterfaces`. Size of efl_mono.dll 6,587,392 bytes(6.6MB) -> 4,112,384 bytes (4.1MB) Test Plan: ninja test Reviewers: felipealmeida, lauromoura, vitor.sousa Reviewed By: lauromoura Subscribers: cedric, #reviewers, woohyun, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9752
-rw-r--r--src/bin/eolian_mono/eolian/mono/klass.hh20
-rw-r--r--src/bindings/mono/eo_mono/EoWrapper.cs2
-rw-r--r--src/bindings/mono/eo_mono/iwrapper.cs24
3 files changed, 21 insertions, 25 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/klass.hh b/src/bin/eolian_mono/eolian/mono/klass.hh
index f1b89abc71..c10bfb3fda 100644
--- a/src/bin/eolian_mono/eolian/mono/klass.hh
+++ b/src/bin/eolian_mono/eolian/mono/klass.hh
@@ -398,7 +398,7 @@ struct klass
398 context); 398 context);
399 auto native_inherit_name = name_helpers::klass_native_inherit_name(cls); 399 auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
400 auto inherit_name = name_helpers::klass_inherit_name(cls); 400 auto inherit_name = name_helpers::klass_inherit_name(cls);
401 auto implementable_methods = helpers::get_all_implementable_methods(cls, context); 401 auto implementable_methods = cls.functions;
402 bool root = !helpers::has_regular_ancestor(cls); 402 bool root = !helpers::has_regular_ancestor(cls);
403 auto const& indent = current_indentation(inative_cxt); 403 auto const& indent = current_indentation(inative_cxt);
404 404
@@ -430,7 +430,7 @@ struct klass
430 if(!as_generator( 430 if(!as_generator(
431 indent << scope_tab << "/// <summary>Gets the list of Eo operations to override.</summary>\n" 431 indent << scope_tab << "/// <summary>Gets the list of Eo operations to override.</summary>\n"
432 << indent << scope_tab << "/// <returns>The list of Eo operations to be overload.</returns>\n" 432 << indent << scope_tab << "/// <returns>The list of Eo operations to be overload.</returns>\n"
433 << indent << scope_tab << "public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)\n" 433 << indent << scope_tab << "public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type, bool includeInherited)\n"
434 << indent << scope_tab << "{\n" 434 << indent << scope_tab << "{\n"
435 << indent << scope_tab << scope_tab << "var descs = new System.Collections.Generic.List<Efl_Op_Description>();\n" 435 << indent << scope_tab << scope_tab << "var descs = new System.Collections.Generic.List<Efl_Op_Description>();\n"
436 ) 436 )
@@ -452,8 +452,22 @@ struct klass
452 ).generate(sink, attributes::unused, inative_cxt)) 452 ).generate(sink, attributes::unused, inative_cxt))
453 return false; 453 return false;
454 454
455 if(!as_generator(
456 indent << scope_tab << scope_tab << "if (includeInherited)\n"
457 << indent << scope_tab(2) << "{\n"
458 << indent << scope_tab(3) << "var all_interfaces = type.GetInterfaces();\n"
459 << indent << scope_tab(3) << "foreach (var iface in all_interfaces)\n"
460 << indent << scope_tab(3) << "{\n"
461 << indent << scope_tab(4) << "var moredescs = ((Efl.Eo.NativeClass)iface.GetCustomAttributes(false)?.FirstOrDefault(attr => attr is Efl.Eo.NativeClass))?.GetEoOps(type, false);\n"
462 << indent << scope_tab(4) << "if (moredescs != null)\n"
463 << indent << scope_tab(5) << "descs.AddRange(moredescs);\n"
464 << indent << scope_tab(3) << "}\n"
465 << indent << scope_tab(2) << "}\n"
466 ).generate(sink, attributes::unused, inative_cxt))
467 return false;
468
455 if (!root || context_find_tag<class_context>(context).current_wrapper_kind != class_context::concrete) 469 if (!root || context_find_tag<class_context>(context).current_wrapper_kind != class_context::concrete)
456 if(!as_generator(indent << scope_tab << scope_tab << "descs.AddRange(base.GetEoOps(type));\n").generate(sink, attributes::unused, inative_cxt)) 470 if(!as_generator(indent << scope_tab << scope_tab << "descs.AddRange(base.GetEoOps(type, false));\n").generate(sink, attributes::unused, inative_cxt))
457 return false; 471 return false;
458 472
459 if(!as_generator( 473 if(!as_generator(
diff --git a/src/bindings/mono/eo_mono/EoWrapper.cs b/src/bindings/mono/eo_mono/EoWrapper.cs
index 688de85cae..1805071175 100644
--- a/src/bindings/mono/eo_mono/EoWrapper.cs
+++ b/src/bindings/mono/eo_mono/EoWrapper.cs
@@ -357,7 +357,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
357 357
358 /// <summary>Gets the list of Eo operations to override.</summary> 358 /// <summary>Gets the list of Eo operations to override.</summary>
359 /// <returns>The list of Eo operations to be overload.</returns> 359 /// <returns>The list of Eo operations to be overload.</returns>
360 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(Type type) 360 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(Type type, bool includeInherited)
361 { 361 {
362 var descs = new System.Collections.Generic.List<Efl_Op_Description>(); 362 var descs = new System.Collections.Generic.List<Efl_Op_Description>();
363 363
diff --git a/src/bindings/mono/eo_mono/iwrapper.cs b/src/bindings/mono/eo_mono/iwrapper.cs
index 6b7719e61f..a03e48a326 100644
--- a/src/bindings/mono/eo_mono/iwrapper.cs
+++ b/src/bindings/mono/eo_mono/iwrapper.cs
@@ -351,26 +351,8 @@ public class Globals
351 if (nativeClass != null) 351 if (nativeClass != null)
352 { 352 {
353 Eina.Log.Debug("nativeClass != null"); 353 Eina.Log.Debug("nativeClass != null");
354 var descs = nativeClass.GetEoOps(type); 354 var descs = nativeClass.GetEoOps(type, true);
355 var count = descs.Count; 355 var count = descs.Count;
356
357 var all_interfaces = type.GetInterfaces();
358 var base_interfaces = type.BaseType.GetInterfaces();
359 foreach (var iface in all_interfaces)
360 {
361 if (!System.Array.Exists(base_interfaces, element => element == iface))
362 {
363 var nc = GetNativeClass(iface);
364 if (nc != null)
365 {
366 var moredescs = nc.GetEoOps(type);
367 Eina.Log.Debug($"adding {moredescs.Count} more descs to registration");
368 descs.AddRange(moredescs);
369 count = descs.Count;
370 }
371 }
372 }
373
374 IntPtr descs_ptr = IntPtr.Zero; 356 IntPtr descs_ptr = IntPtr.Zero;
375 357
376 if (count > 0) 358 if (count > 0)
@@ -753,7 +735,7 @@ public static class Config
753public abstract class NativeClass : System.Attribute 735public abstract class NativeClass : System.Attribute
754{ 736{
755 public abstract IntPtr GetEflClass(); 737 public abstract IntPtr GetEflClass();
756 public abstract System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type); 738 public abstract System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type, bool includeInherited);
757} 739}
758 740
759/// <summary>Attribute for private native classes. 741/// <summary>Attribute for private native classes.
@@ -766,7 +748,7 @@ public class PrivateNativeClass : NativeClass
766 return IntPtr.Zero; 748 return IntPtr.Zero;
767 } 749 }
768 750
769 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type) 751 public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type, bool includeInherited)
770 { 752 {
771 return null; 753 return null;
772 } 754 }