[NUI] Remove unused codes
authordongsug.song <dongsug.song@samsung.com>
Thu, 13 Mar 2025 11:07:27 +0000 (20:07 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 18 Mar 2025 06:08:52 +0000 (15:08 +0900)
src/Tizen.NUI/src/internal/Common/DebugFileLogging.cs [deleted file]
src/Tizen.NUI/src/internal/Common/DisposeQueue.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/Common/BaseHandle.cs
test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSDebugFileLogging.cs [deleted file]

diff --git a/src/Tizen.NUI/src/internal/Common/DebugFileLogging.cs b/src/Tizen.NUI/src/internal/Common/DebugFileLogging.cs
deleted file mode 100755 (executable)
index 77f6cb5..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/*
- * Copyright(c) 2022 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-using global::System;
-using global::System.IO;
-using global::System.Diagnostics;
-
-namespace Tizen.NUI
-{
-    internal class DebugFileLogging : Disposable
-    {
-        #region Constant Fields
-        private string logFolderPath;
-        #endregion //Constant Fields
-
-        #region Fields
-        public static DebugFileLogging Instance => instance;
-        private static readonly DebugFileLogging instance = new DebugFileLogging();
-        private string filePath;
-        private FileStream file;
-        #endregion //Fields
-
-        #region Constructors
-        private DebugFileLogging()
-        {
-            if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
-            {
-                logFolderPath = Environment.GetEnvironmentVariable("HOME") + "/nui/";
-            }
-            else
-            {
-                logFolderPath = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%") + "/owner/share/nui/";
-            }
-
-            Directory.CreateDirectory(logFolderPath);
-
-            using var process = Process.GetCurrentProcess();
-            var id = process.Id;
-            filePath = logFolderPath + id.ToString();
-            file = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
-        }
-        #endregion //Constructors
-
-        #region Methods
-        [Conditional("NUI_DISPOSE_DEBUG_ON")]
-        internal void WriteLog(string log)
-        {
-            TimeSpan curr = DateTime.Now.TimeOfDay;
-
-            FileStream file = new FileStream(filePath, FileMode.Append, FileAccess.Write);
-            StreamWriter write = new StreamWriter(file);
-            var time = String.Format("[{0,-13}] ", curr.TotalMilliseconds);
-            write.WriteLine(time + log);
-            write.Close();
-        }
-        #endregion //Methods
-    }
-}
index 8c97f4a9cb65b389bdb25a605a603540ead5e2e6..d4c837df6e81a245004ec8e8884a10fba5559ce1 100755 (executable)
@@ -83,8 +83,6 @@ namespace Tizen.NUI
                 disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables);
                 eventThreadCallback = new EventThreadCallback(disposeQueueProcessDisposablesDelegate);
                 initialized = true;
-
-                DebugFileLogging.Instance.WriteLog("DiposeTest START");
             }
         }
 
@@ -143,7 +141,6 @@ namespace Tizen.NUI
             {
                 if (disposables.Count > 0)
                 {
-                    DebugFileLogging.Instance.WriteLog($"Newly add {disposables.Count} count of disposables. Total disposables count is {incrementallyDisposedQueue.Count + disposables.Count}.\n");
                     // Move item from end, due to the performance issue.
                     while (disposables.Count > 0)
                     {
@@ -172,8 +169,6 @@ namespace Tizen.NUI
             var disposeCount = fullCollectRequested ? incrementallyDisposedQueue.Count
                                                     : Math.Min(incrementallyDisposedQueue.Count, Math.Max(minimumIncrementalCount, incrementallyDisposedQueue.Count * minimumIncrementalRate / 100));
 
-            DebugFileLogging.Instance.WriteLog((fullCollectRequested ? "Fully" : "Incrementally") + $" dispose {disposeCount} disposables. Will remained disposables count is {incrementallyDisposedQueue.Count - disposeCount}.\n");
-
             fullCollectRequested = false;
 
             // Dispose item from end, due to the performance issue.
@@ -182,8 +177,6 @@ namespace Tizen.NUI
                 --disposeCount;
                 var disposable = incrementallyDisposedQueue.Last();
                 incrementallyDisposedQueue.RemoveAt(incrementallyDisposedQueue.Count - 1);
-
-                DebugFileLogging.Instance.WriteLog($"disposable.Dispose(); type={disposable.GetType().FullName}, hash={disposable.GetHashCode()}");
                 disposable.Dispose();
             }
 
@@ -196,8 +189,6 @@ namespace Tizen.NUI
                     ProcessorController.Instance.Awake();
                 }
             }
-
-            DebugFileLogging.Instance.WriteLog($"Incrementally dispose finished.\n");
         }
     }
 }
index b243b024816e328d9612a97b2ad69a603f5b8060..43e13f42dc897bff2c921fa6678a7732253a3f8e 100755 (executable)
@@ -1361,8 +1361,6 @@ namespace Tizen.NUI.BaseComponents
                 return;
             }
 
-            disposeDebugging(type);
-
             if (SwigCMemOwn && !IsNativeHandleInvalid())
             {
                 Interop.ControlDevel.DaliAccessibilityDetachAccessibleObject(SwigCPtr);
@@ -1939,21 +1937,6 @@ namespace Tizen.NUI.BaseComponents
             return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
         }
 
-        [Conditional("NUI_DISPOSE_DEBUG_ON")]
-        private void disposeDebugging(DisposeTypes type)
-        {
-            DebugFileLogging.Instance.WriteLog($"View.Dispose({type}) START");
-            DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{GetBaseHandleCPtrHandleRef.Handle.ToString("X8")}");
-            if (HasBody())
-            {
-                DebugFileLogging.Instance.WriteLog($"ID:{Interop.Actor.GetId(GetBaseHandleCPtrHandleRef)} Name:{Interop.Actor.GetName(GetBaseHandleCPtrHandleRef)}");
-            }
-            else
-            {
-                DebugFileLogging.Instance.WriteLog($"has no native body!");
-            }
-        }
-
         private void NotifyBackgroundChanged()
         {
             // NOTE
index 97b344c46dbdf15399e9a94d99dee5767c48f810..5d42ca5a350dddc26b4ab433826b74ee71ceee4b 100755 (executable)
@@ -89,8 +89,6 @@ namespace Tizen.NUI
             //to catch derived classes dali native exceptions
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.contructor with cMemeryOwn:{cMemoryOwn} and cRegister:{cRegister} START");
-
             registerMe = cRegister;
             swigCMemOwn = cMemoryOwn;
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
@@ -104,10 +102,6 @@ namespace Tizen.NUI
                     registerMe = false;
                 }
             }
-
-            disposeDebuggingCtor();
-            DebugFileLogging.Instance.WriteLog($" BaseHandle.contructor with cMemeryOwn and cRegister END");
-            DebugFileLogging.Instance.WriteLog($"=============================");
         }
 
         internal BaseHandle(global::System.IntPtr cPtr, bool cMemoryOwn)
@@ -115,8 +109,6 @@ namespace Tizen.NUI
             //to catch derived classes dali native exceptions
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
 
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.contructor with cMemeryOwn:{cMemoryOwn} START");
-
             registerMe = swigCMemOwn = cMemoryOwn;
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -129,16 +121,10 @@ namespace Tizen.NUI
                     registerMe = false;
                 }
             }
-
-            disposeDebuggingCtor();
-            DebugFileLogging.Instance.WriteLog($" BaseHandle.contructor with cMemeryOwn END");
-            DebugFileLogging.Instance.WriteLog($"=============================");
         }
 
         internal BaseHandle(global::System.IntPtr cPtr)
         {
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.contructor START");
-
             registerMe = swigCMemOwn = true;
 
             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
@@ -152,10 +138,6 @@ namespace Tizen.NUI
                     registerMe = false;
                 }
             }
-
-            disposeDebuggingCtor();
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.contructor END");
-            DebugFileLogging.Instance.WriteLog($"=============================");
         }
 
         /// <summary>
@@ -408,9 +390,6 @@ namespace Tizen.NUI
                     var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
                     var me = this.GetType().FullName;
 
-                    DebugFileLogging.Instance.WriteLog("[NUI][BaseHandle] This API called from separate thread. This API must be called from MainThread. \n" +
-                        $" process:{processId} thread:{thread}, disposing:{disposing}, isDisposed:{this.disposed}, isDisposeQueued:{this.isDisposeQueued}, me:{me}\n");
-
                     Tizen.Log.Fatal("NUI", $"[NUI][BaseHandle] This API called from separate thread. This API must be called from MainThread. \n" +
                         $" process:{processId} thread:{thread}, disposing:{disposing}, isDisposed:{this.disposed}, isDisposeQueued:{this.isDisposeQueued}, me:{me}\n");
 
@@ -421,8 +400,6 @@ namespace Tizen.NUI
 
                 if (isDisposeQueued)
                 {
-                    DebugFileLogging.Instance.WriteLog($"should not be here! (dead code) this will be removed!");
-
                     Tizen.Log.Fatal("NUI", $"[NUI] should not be here! (dead code) this will be removed!");
 
                     //to fix ArtApp black screen issue. this will be enabled after talking with ArtApp team and fixing it.
@@ -608,8 +585,6 @@ namespace Tizen.NUI
                 return;
             }
 
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.Dispose({type}) START");
-
             if (type == DisposeTypes.Explicit)
             {
                 //Called by User
@@ -625,8 +600,6 @@ namespace Tizen.NUI
             //Unreference this instance from Registry.
             UnregisterFromRegistry();
 
-            disposeDebuggingDispose(type);
-
             if (SwigCPtr.Handle != IntPtr.Zero)
             {
                 var nativeSwigCPtr = swigCPtr.Handle;
@@ -643,13 +616,10 @@ namespace Tizen.NUI
             else
             {
                 var me = this.GetType().FullName;
-                DebugFileLogging.Instance.WriteLog($"[ERR] SwigCPtr is NULL, need to check! me:{me}");
                 Log.Error("NUI", $"[ERR] SwigCPtr is NULL, need to check! me:{me}");
             }
 
             disposed = true;
-            DebugFileLogging.Instance.WriteLog($"BaseHandle.Dispose({type}) END");
-            DebugFileLogging.Instance.WriteLog($"=============================");
             NUILog.Debug($"BaseHandle.Dispose({type}) END");
             NUILog.Debug($"=============================");
         }
@@ -789,59 +759,5 @@ namespace Tizen.NUI
         {
             nativeBindedHolder.Remove(handle);
         }
-
-        [Conditional("NUI_DISPOSE_DEBUG_ON")]
-        private void disposeDebuggingCtor()
-        {
-            DebugFileLogging.Instance.WriteLog($"type:{GetType()} copyNativeHandle:{swigCPtr.Handle.ToString("X8")}");
-            if (this is BaseComponents.View view)
-            {
-                DebugFileLogging.Instance.WriteLog($"ID:{view.ID} Name:{view.Name}");
-                //back trace
-                global::System.Diagnostics.StackTrace st = new global::System.Diagnostics.StackTrace(true);
-                for (int i = 0; i < st.FrameCount; i++)
-                {
-                    global::System.Diagnostics.StackFrame sf = st.GetFrame(i);
-                    DebugFileLogging.Instance.WriteLog($"[{i}] {sf.GetMethod()}:{sf.GetFileName()}:{sf.GetFileLineNumber()}");
-                }
-            }
-        }
-
-        [Conditional("NUI_DISPOSE_DEBUG_ON")]
-        private void disposeDebuggingDispose(DisposeTypes type)
-        {
-            DebugFileLogging.Instance.WriteLog($"swigCMemOwn:{swigCMemOwn} type:{GetType()} copyNativeHandle:{swigCPtr.Handle.ToString("X8")} HasBody:{HasBody()}");
-
-            if (HasBody())
-            {
-                using var currentProcess = global::System.Diagnostics.Process.GetCurrentProcess();
-                var process = currentProcess.Id;
-                var thread = global::System.Threading.Thread.CurrentThread.ManagedThreadId;
-                var me = this.GetType().FullName;
-                var daliId = "unknown";
-                var hash = this.GetType().GetHashCode();
-                var name = "unknown";
-
-                if (this is BaseComponents.View)
-                {
-                    daliId = Interop.Actor.GetId(swigCPtr).ToString();
-                    name = Interop.Actor.GetName(swigCPtr);
-                    BaseObject tmp = new BaseObject(Interop.BaseHandle.GetBaseObject(swigCPtr), false);
-                    var refCnt = tmp.ReferenceCount();
-                    tmp.Dispose();
-                    if (refCnt > 2)
-                    {
-                        DebugFileLogging.Instance.WriteLog($"[ERR] reference count is over than 2. Could be a memory leak. Need to check! \n" +
-                            $" process:{process} thread:{thread}, isDisposed:{this.disposed}, isDisposeQueued:{this.isDisposeQueued}, me:{me} \n" +
-                            $" disposeType:{type}, name:{name}, daliID:{daliId}, hash:{hash}, refCnt:{refCnt}");
-
-                        Log.Error("NUI", $"[ERR] reference count is over than 2. Could be a memory leak. Need to check! \n" +
-                            $" process:{process} thread:{thread}, isDisposed:{this.disposed}, isDisposeQueued:{this.isDisposeQueued}, me:{me} \n" +
-                            $" disposeType:{type}, name:{name}, daliID:{daliId}, hash:{hash}, refCnt:{refCnt}");
-                    }
-                }
-            }
-        }
-
     }
 }
diff --git a/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSDebugFileLogging.cs b/test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/internal/Common/TSDebugFileLogging.cs
deleted file mode 100755 (executable)
index 7941b45..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-using global::System;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.NUI.Components;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Devel.Tests
-{
-    using tlog = Tizen.Log;
-
-    [TestFixture]
-    [Description("internal/Common/DebugFileLogging")]
-    public class TSDebugFileLogging
-    {
-        private const string tag = "NUITEST";
-
-        [SetUp]
-        public void Init()
-        {
-            tlog.Info(tag, "Init() is called!");
-        }
-
-        [TearDown]
-        public void Destroy()
-        {
-            tlog.Info(tag, "Destroy() is called!");
-        }
-    }
-}
\ No newline at end of file