[NUI] Add AliveCount property to get currently alived View number
authordongsug.song <dongsug.song@samsung.com>
Tue, 14 Nov 2023 13:14:33 +0000 (22:14 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Wed, 15 Nov 2023 07:09:04 +0000 (16:09 +0900)
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs

index 601d553..947edad 100755 (executable)
@@ -85,6 +85,8 @@ namespace Tizen.NUI.BaseComponents
         private Vector4 internalCurrentWorldColor = null;
         private Vector2 internalCurrentScreenPosition = null;
 
+        private static int aliveCount = 0;
+
         static View()
         {
             RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
@@ -208,6 +210,8 @@ namespace Tizen.NUI.BaseComponents
             {
                 SetVisible(false);
             }
+
+            aliveCount++;
         }
 
         internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
@@ -3496,5 +3500,11 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         public Vector3 CurrentScale => GetCurrentScale();
 
+        /// <summary>
+        /// Gets the number of currently alived View object.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static int AliveCount => aliveCount;
+
     }
 }
index eabb666..bb0449c 100755 (executable)
@@ -403,6 +403,7 @@ namespace Tizen.NUI.BaseComponents
                 {
                     // at this case, implicit nor explicit dispose is not required. No native object is made.
                     disposed = true;
+                    aliveCount--;
                     return;
                 }
             }
index 9e68a77..47b4dec 100755 (executable)
@@ -1468,6 +1468,8 @@ namespace Tizen.NUI.BaseComponents
             NUILog.Debug($"=============================");
 
             base.Dispose(type);
+            
+            aliveCount--;
         }
 
         /// This will not be public opened.