Preload some static values
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 24 Oct 2023 01:47:09 +0000 (10:47 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Tue, 31 Oct 2023 14:07:28 +0000 (23:07 +0900)
Since C# initialize static values when that namespace / class access first time,
We need to access some static values at static Preload() timing.

Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
src/Tizen.NUI/src/internal/Common/Disposable.cs
src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs
src/Tizen.NUI/src/public/Animation/Animatable.cs
src/Tizen.NUI/src/public/Application/NUIApplication.cs
src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
src/Tizen.NUI/src/public/BaseComponents/TextField.cs
src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/Common/BaseHandle.cs
src/Tizen.NUI/src/public/Common/Container.cs

index 7884c30..72d1dc8 100644 (file)
@@ -25,6 +25,11 @@ namespace Tizen.NUI
     /// <since_tizen> 6 </since_tizen>
     public class Disposable : global::System.IDisposable
     {
     /// <since_tizen> 6 </since_tizen>
     public class Disposable : global::System.IDisposable
     {
+        static internal void Preload()
+        {
+            // Do nothing. Just call for load static values.
+        }
+
         /// <summary>
         /// The flag to check if it is already disposed of.
         /// </summary>
         /// <summary>
         /// The flag to check if it is already disposed of.
         /// </summary>
index a55f622..560684c 100755 (executable)
@@ -245,6 +245,14 @@ namespace Tizen.NUI
         {
         }
 
         {
         }
 
+        static internal void Preload()
+        {
+            // Do nothing. Just call for load static values.
+            var temporalSwigExceptionHelper = swigExceptionHelper;
+            var temporalSwigStringHelper = swigStringHelper;
+            ThrowExceptionIfExists();
+        }
+
         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
         public static extern void DeleteBaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
 
         [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_BaseHandle")]
         public static extern void DeleteBaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1);
 
index 91233e6..b587488 100755 (executable)
@@ -26,6 +26,11 @@ namespace Tizen.NUI
     /// <since_tizen> 3 </since_tizen>
     public class Animatable : BaseHandle
     {
     /// <since_tizen> 3 </since_tizen>
     public class Animatable : BaseHandle
     {
+        static internal new void Preload()
+        {
+            BaseHandle.Preload();
+            // Do nothing. Just call for load static values.
+        }
 
         /// <summary>
         /// Create an instance of animatable.
 
         /// <summary>
         /// Create an instance of animatable.
index 457b591..eabcdef 100755 (executable)
@@ -640,6 +640,22 @@ namespace Tizen.NUI
         static public void Preload()
         {
             Interop.Application.PreInitialize();
         static public void Preload()
         {
             Interop.Application.PreInitialize();
+
+            // Initialize some static utility
+            var disposalbeQueue = DisposeQueue.Instance;
+            var registry = Registry.Instance;
+
+            // Initialize some BaseComponent static variables now
+            BaseComponents.View.Preload();
+            BaseComponents.ImageView.Preload();
+            BaseComponents.TextLabel.Preload();
+            BaseComponents.TextEditor.Preload();
+            BaseComponents.TextField.Preload();
+            Disposable.Preload();
+
+            // Initialize exception tasks. It must be called end of Preload()
+            NDalicPINVOKE.Preload();
+
             IsPreload = true;
         }
 
             IsPreload = true;
         }
 
index dd9f625..407d042 100755 (executable)
@@ -32,6 +32,15 @@ namespace Tizen.NUI.BaseComponents
     {
         static ImageView() { }
 
     {
         static ImageView() { }
 
+        static internal new void Preload()
+        {
+            // Do not call View.Preload(), since we already call it
+
+            Property.Preload();
+            // Do nothing. Just call for load static values.
+            var temporalCachedImagePropertyKeyList = cachedImagePropertyKeyList;
+        }
+
         private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
         private ResourceReadyEventCallbackType _resourceReadyEventCallback;
         private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
         private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
         private ResourceReadyEventCallbackType _resourceReadyEventCallback;
         private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
@@ -1882,6 +1891,11 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int PixelArea = Interop.ImageView.PixelAreaGet();
             internal static readonly int PlaceHolderUrl = Interop.ImageView.PlaceHolderImageGet();
             internal static readonly int TransitionEffect = Interop.ImageView.TransitionEffectGet();
             internal static readonly int PixelArea = Interop.ImageView.PixelAreaGet();
             internal static readonly int PlaceHolderUrl = Interop.ImageView.PlaceHolderImageGet();
             internal static readonly int TransitionEffect = Interop.ImageView.TransitionEffectGet();
+
+            internal static void Preload()
+            {
+                // Do nothing. Just call for load static values.
+            }
         }
 
         private enum ImageType
         }
 
         private enum ImageType
index 85f6d98..61b4159 100755 (executable)
@@ -57,6 +57,14 @@ namespace Tizen.NUI.BaseComponents
 
         static TextEditor() { }
 
 
         static TextEditor() { }
 
+        static internal new void Preload()
+        {
+            // Do not call View.Preload(), since we already call it
+
+            Property.Preload();
+            // Do nothing. Just call for load static values.
+        }
+
         /// <summary>
         /// Creates the TextEditor control.
         /// </summary>
         /// <summary>
         /// Creates the TextEditor control.
         /// </summary>
@@ -2767,6 +2775,11 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
             internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
             internal static readonly int InputFilter = Interop.TextEditor.InputFilterGet();
             internal static readonly int Strikethrough = Interop.TextEditor.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextEditor.CharacterSpacingGet();
+
+            internal static void Preload()
+            {
+                // Do nothing. Just call for load static values.
+            }
         }
 
         internal class InputStyle
         }
 
         internal class InputStyle
index 36f50b0..e2506a7 100755 (executable)
@@ -57,6 +57,14 @@ namespace Tizen.NUI.BaseComponents
 
         static TextField() { }
 
 
         static TextField() { }
 
+        static internal new void Preload()
+        {
+            // Do not call View.Preload(), since we already call it
+
+            Property.Preload();
+            // Do nothing. Just call for load static values.
+        }
+
         /// <summary>
         /// Creates the TextField control.
         /// </summary>
         /// <summary>
         /// Creates the TextField control.
         /// </summary>
@@ -2765,6 +2773,11 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
             internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
             internal static readonly int InputFilter = Interop.TextField.InputFilterGet();
             internal static readonly int Strikethrough = Interop.TextField.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextField.CharacterSpacingGet();
+
+            internal static void Preload()
+            {
+                // Do nothing. Just call for load static values.
+            }
         }
 
         internal class InputStyle
         }
 
         internal class InputStyle
index 1c97921..98474f4 100755 (executable)
@@ -84,6 +84,14 @@ namespace Tizen.NUI.BaseComponents
 
         static TextLabel() { }
 
 
         static TextLabel() { }
 
+        static internal new void Preload()
+        {
+            // Do not call View.Preload(), since we already call it
+
+            Property.Preload();
+            // Do nothing. Just call for load static values.
+        }
+
         private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
         private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
         static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
         private static SystemFontTypeChanged systemFontTypeChanged = new SystemFontTypeChanged();
         private static SystemLocaleLanguageChanged systemLocaleLanguageChanged = new SystemLocaleLanguageChanged();
         static private string defaultStyleName = "Tizen.NUI.BaseComponents.TextLabel";
@@ -1847,6 +1855,11 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
             internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
             internal static readonly int EllipsisPosition = Interop.TextLabel.EllipsisPositionGet();
             internal static readonly int Strikethrough = Interop.TextLabel.StrikethroughGet();
             internal static readonly int CharacterSpacing = Interop.TextLabel.CharacterSpacingGet();
+
+            internal static void Preload()
+            {
+                // Do nothing. Just call for load static values.
+            }
         }
 
         private void OnShadowColorChanged(float x, float y, float z, float w)
         }
 
         private void OnShadowColorChanged(float x, float y, float z, float w)
index afd9545..0876bf7 100755 (executable)
@@ -105,6 +105,16 @@ namespace Tizen.NUI.BaseComponents
             RegisterAccessibilityDelegate();
         }
 
             RegisterAccessibilityDelegate();
         }
 
+        static internal new void Preload()
+        {
+            Container.Preload();
+
+            // Do nothing. Just call for load static values.
+            var temporalPositionPropertyGroup = positionPropertyGroup;
+            var temporalSizePropertyGroup = sizePropertyGroup;
+            var temporalScalePropertyGroup = scalePropertyGroup;
+        }
+
         /// <summary>
         /// Accessibility mode for controlling View's Accessible implementation.
         /// It is only relevant when deriving custom controls from View directly,
         /// <summary>
         /// Accessibility mode for controlling View's Accessible implementation.
         /// It is only relevant when deriving custom controls from View directly,
index 5f85509..b8e7eb3 100755 (executable)
@@ -28,6 +28,11 @@ namespace Tizen.NUI
     /// <since_tizen> 3 </since_tizen>
     public class BaseHandle : Element, global::System.IDisposable
     {
     /// <since_tizen> 3 </since_tizen>
     public class BaseHandle : Element, global::System.IDisposable
     {
+        static internal void Preload()
+        {
+            // Do nothing. Just call for load static values.
+        }
+
         /// <summary>
         /// swigCMemOwn
         /// </summary>
         /// <summary>
         /// swigCMemOwn
         /// </summary>
index 13577bf..fdfbf2c 100755 (executable)
@@ -41,6 +41,14 @@ namespace Tizen.NUI
         ResourceDictionary _resources;
         bool IResourcesProvider.IsResourcesCreated => _resources != null;
 
         ResourceDictionary _resources;
         bool IResourcesProvider.IsResourcesCreated => _resources != null;
 
+        static internal new void Preload()
+        {
+            Animatable.Preload();
+
+            // Do nothing. Just call for load static values.
+            var temporalXamlStyleProperty = XamlStyleProperty;
+        }
+
         internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
             // No un-managed data hence no need to store a native ptr
         internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
         {
             // No un-managed data hence no need to store a native ptr