From: Eunki, Hong Date: Tue, 24 Oct 2023 01:47:09 +0000 (+0900) Subject: [NUI] Preload some static values X-Git-Tag: submit/tizen/20231025.151412~1^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bee9ece00e8b1b034863d07c5d853d62a8e239e1;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Preload some static values 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 --- diff --git a/src/Tizen.NUI/src/internal/Common/Disposable.cs b/src/Tizen.NUI/src/internal/Common/Disposable.cs index 7884c303e..72d1dc8ef 100644 --- a/src/Tizen.NUI/src/internal/Common/Disposable.cs +++ b/src/Tizen.NUI/src/internal/Common/Disposable.cs @@ -25,6 +25,11 @@ namespace Tizen.NUI /// 6 public class Disposable : global::System.IDisposable { + static internal void Preload() + { + // Do nothing. Just call for load static values. + } + /// /// The flag to check if it is already disposed of. /// diff --git a/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs index a55f62275..560684c28 100755 --- a/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs @@ -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); diff --git a/src/Tizen.NUI/src/public/Animation/Animatable.cs b/src/Tizen.NUI/src/public/Animation/Animatable.cs index 91233e65d..b587488e5 100755 --- a/src/Tizen.NUI/src/public/Animation/Animatable.cs +++ b/src/Tizen.NUI/src/public/Animation/Animatable.cs @@ -26,6 +26,11 @@ namespace Tizen.NUI /// 3 public class Animatable : BaseHandle { + static internal new void Preload() + { + BaseHandle.Preload(); + // Do nothing. Just call for load static values. + } /// /// Create an instance of animatable. diff --git a/src/Tizen.NUI/src/public/Application/NUIApplication.cs b/src/Tizen.NUI/src/public/Application/NUIApplication.cs index 457b5916e..eabcdef9e 100755 --- a/src/Tizen.NUI/src/public/Application/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/Application/NUIApplication.cs @@ -640,6 +640,22 @@ namespace Tizen.NUI 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; } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index dd9f62548..407d042d4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -32,6 +32,15 @@ namespace Tizen.NUI.BaseComponents { 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 _resourceReadyEventHandler; private ResourceReadyEventCallbackType _resourceReadyEventCallback; private EventHandler _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 void Preload() + { + // Do nothing. Just call for load static values. + } } private enum ImageType diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 85f6d9880..61b415983 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -57,6 +57,14 @@ namespace Tizen.NUI.BaseComponents 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. + } + /// /// Creates the TextEditor control. /// @@ -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 void Preload() + { + // Do nothing. Just call for load static values. + } } internal class InputStyle diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index 36f50b05b..e2506a78f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -57,6 +57,14 @@ namespace Tizen.NUI.BaseComponents 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. + } + /// /// Creates the TextField control. /// @@ -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 void Preload() + { + // Do nothing. Just call for load static values. + } } internal class InputStyle diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 1c979212c..98474f4e8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -84,6 +84,14 @@ namespace Tizen.NUI.BaseComponents 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"; @@ -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 void Preload() + { + // Do nothing. Just call for load static values. + } } private void OnShadowColorChanged(float x, float y, float z, float w) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 059284387..a2ca05465 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -105,6 +105,16 @@ namespace Tizen.NUI.BaseComponents 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; + } + /// /// Accessibility mode for controlling View's Accessible implementation. /// It is only relevant when deriving custom controls from View directly, diff --git a/src/Tizen.NUI/src/public/Common/BaseHandle.cs b/src/Tizen.NUI/src/public/Common/BaseHandle.cs index 5f8550918..b8e7eb3ce 100755 --- a/src/Tizen.NUI/src/public/Common/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/Common/BaseHandle.cs @@ -28,6 +28,11 @@ namespace Tizen.NUI /// 3 public class BaseHandle : Element, global::System.IDisposable { + static internal void Preload() + { + // Do nothing. Just call for load static values. + } + /// /// swigCMemOwn /// diff --git a/src/Tizen.NUI/src/public/Common/Container.cs b/src/Tizen.NUI/src/public/Common/Container.cs index 13577bf0c..fdfbf2c9c 100755 --- a/src/Tizen.NUI/src/public/Common/Container.cs +++ b/src/Tizen.NUI/src/public/Common/Container.cs @@ -41,6 +41,14 @@ namespace Tizen.NUI 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