Skip to content

Commit

Permalink
[NUI] Add API for ProcessController without Initialize
Browse files Browse the repository at this point in the history
To keep the backword stability, let we use previous API (CSharp_Dali_new_ProcessorController) call Initialize internally
and new API (CSharp_Dali_new_ProcessorController_Without_Initialize) will not call this.

Signed-off-by: Eunki, Hong <[email protected]>
  • Loading branch information
Eunki, Hong authored and bshsqa committed Dec 11, 2023
1 parent 16963f3 commit 6a16c7e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/Tizen.NUI/src/internal/Common/DisposeQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class DisposeQueue
private EventThreadCallback eventThreadCallback;
private EventThreadCallback.CallbackDelegate disposeQueueProcessDisposablesDelegate;

private bool initialied = false;
private bool initialized = false;
private bool processorRegistered = false;
private bool eventThreadCallbackTriggered = false;

Expand All @@ -51,7 +51,7 @@ private DisposeQueue()
~DisposeQueue()
{
Tizen.Log.Debug("NUI", $"DisposeQueue is destroyed\n");
initialied = false;
initialized = false;
if (processorRegistered && ProcessorController.Instance.Initialized)
{
processorRegistered = false;
Expand All @@ -78,11 +78,11 @@ public bool FullyDisposeNextCollect

public void Initialize()
{
if (!initialied)
if (!initialized)
{
disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables);
eventThreadCallback = new EventThreadCallback(disposeQueueProcessDisposablesDelegate);
initialied = true;
initialized = true;

DebugFileLogging.Instance.WriteLog("DiposeTest START");
}
Expand All @@ -95,7 +95,7 @@ public void Add(IDisposable disposable)
disposables.Add(disposable);
}

if (initialied && eventThreadCallback != null)
if (initialized && eventThreadCallback != null)
{
if (!eventThreadCallbackTriggered)
{
Expand All @@ -115,7 +115,7 @@ public void TriggerProcessDisposables(object o, EventArgs e)
{
processorRegistered = false;

if (initialied && eventThreadCallback != null)
if (initialized && eventThreadCallback != null)
{
if (!eventThreadCallbackTriggered)
{
Expand Down
18 changes: 11 additions & 7 deletions src/Tizen.NUI/src/internal/Common/ProcessorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ namespace Tizen.NUI
internal sealed class ProcessorController : Disposable
{
private static ProcessorController instance = null;
private bool initialied = false;
private bool initialized = false;

private ProcessorController() : this(Interop.ProcessorController.New(), true)
private ProcessorController() : this(true)
{
}

private ProcessorController(bool initializeOnConstructor) : this(initializeOnConstructor ? Interop.ProcessorController.New() : Interop.ProcessorController.NewWithoutInitialize(), true)
{
}

Expand Down Expand Up @@ -67,25 +71,25 @@ public event EventHandler ProcessorOnceEvent
public event EventHandler ProcessorEvent;
public event EventHandler LayoutProcessorEvent;

public bool Initialized => initialied;
public bool Initialized => initialized;

public static ProcessorController Instance
{
get
{
if (instance == null)
{
instance = new ProcessorController();
instance = new ProcessorController(false);
}
return instance;
}
}

public void Initialize()
{
if (initialied == false)
if (initialized == false)
{
initialied = true;
initialized = true;

Interop.ProcessorController.Initialize(SwigCPtr);

Expand Down Expand Up @@ -129,7 +133,7 @@ protected override void Dispose(DisposeTypes type)
internalProcessorOnceEvent[1] = null;
ProcessorEvent = null;
LayoutProcessorEvent = null;
initialied = false;
initialized = false;

GC.SuppressFinalize(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ internal static partial class ProcessorController
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ProcessorController")]
public static extern global::System.IntPtr New();

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_ProcessorController_Without_Initialize")]
public static extern global::System.IntPtr NewWithoutInitialize();

[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_ProcessorController")]
public static extern global::System.IntPtr DeleteProcessorController(global::System.Runtime.InteropServices.HandleRef processorController);

Expand Down

0 comments on commit 6a16c7e

Please sign in to comment.