Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Preload some static values #5649

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Tizen.NUI/src/internal/Common/Disposable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ namespace Tizen.NUI
/// <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>
Expand Down
8 changes: 8 additions & 0 deletions src/Tizen.NUI/src/internal/Interop/NDalicPINVOKE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ static NDalicPINVOKE()
{
}

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);

Expand Down
5 changes: 5 additions & 0 deletions src/Tizen.NUI/src/public/Animation/Animatable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ namespace Tizen.NUI
/// <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.
Expand Down
16 changes: 16 additions & 0 deletions src/Tizen.NUI/src/public/Application/NUIApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,22 @@ protected override void OnCreate()
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;
}

Expand Down
14 changes: 14 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/ImageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public partial class ImageView : View
{
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;
Expand Down Expand Up @@ -1882,6 +1891,11 @@ public ResourceLoadingStatusType Status
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
Expand Down
13 changes: 13 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public partial class TextEditor : View

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>
Expand Down Expand Up @@ -2767,6 +2775,11 @@ private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
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
Expand Down
13 changes: 13 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/TextField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public partial class TextField : View

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>
Expand Down Expand Up @@ -2765,6 +2773,11 @@ private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
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
Expand Down
13 changes: 13 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ protected override void OnMeasure(MeasureSpecification widthMeasureSpec, Measure

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";
Expand Down Expand Up @@ -1847,6 +1855,11 @@ private void RequestLayout()
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)
Expand Down
10 changes: 10 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ static View()
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,
Expand Down
5 changes: 5 additions & 0 deletions src/Tizen.NUI/src/public/Common/BaseHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace Tizen.NUI
/// <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>
Expand Down
8 changes: 8 additions & 0 deletions src/Tizen.NUI/src/public/Common/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ public abstract class Container : Animatable, IResourcesProvider
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
Expand Down
Loading