Add unreleased controls logs for debugging
authorJaewon Cho <jaewon7.cho@samsung.com>
Thu, 11 Jul 2013 13:21:06 +0000 (22:21 +0900)
committerJaewon Cho <jaewon7.cho@samsung.com>
Fri, 12 Jul 2013 03:07:58 +0000 (12:07 +0900)
Change-Id: I1202250d50fc925cd2ee2eea6af958a8ce88a906
Signed-off-by: Jaewon Cho <jaewon7.cho@samsung.com>
src/ui/FUi_Control.cpp
src/ui/FUi_ControlManager.cpp
src/ui/inc/FUi_ControlManager.h

index a011c5f..24a9a53 100644 (file)
@@ -4821,7 +4821,6 @@ _Control::SetVisualElement(_ControlVisualElement* pVisualElement)
 _VisualElement*
 _Control::GetVisualElement(void) const
 {
-       //SysAssert(__pVisualElement);
        return __pVisualElement;
 }
 
@@ -4830,7 +4829,7 @@ _Control::PrintDescription(bool printChildren, int level)
 {
        int count = PrintDescription(printChildren, 0, level);
 
-       SysLog(NID_UI, "%d controls were printed.", count);
+       SysSecureLog(NID_UI, "%d controls were printed.", count);
 }
 
 int
@@ -4853,13 +4852,13 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
        indent.Append(format);
 
        String delimiter(L"-------------------------------------------------------------------------------------------");
-       SysLog(NID_UI, "%ls", delimiter.GetPointer());
+       SysSecureLog(NID_UI, "%ls", delimiter.GetPointer());
 
        // Public
        String publicDescription = GetControlDelegate().GetDescription();
        if (!publicDescription.IsEmpty())
        {
-               SysLog(NID_UI, "%ls %ls", indent.GetPointer(), publicDescription.GetPointer());
+               SysSecureLog(NID_UI, "%ls %ls", indent.GetPointer(), publicDescription.GetPointer());
        }
 
        _ControlManager* pControlManager = _ControlManager::GetInstance();
@@ -4873,7 +4872,7 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
        }
 
        // Core
-       SysLog(NID_UI, "%ls 0x%x(%d %ls) enable(%d) enableState(%d) visible(%d) visibleState(%d) focusable(%d) focused(%d) clip(%d) movable(%d) resizable(%d) inputEnableState(%d)",
+       SysSecureLog(NID_UI, "%ls 0x%x(%d %ls) enable(%d) enableState(%d) visible(%d) visibleState(%d) focusable(%d) focused(%d) clip(%d) movable(%d) resizable(%d) inputEnableState(%d)",
                indent.GetPointer(), this, __controlHandle.ToInt(), GetName().GetPointer(), IsEnabled(), GetEnableState(), IsVisible(), GetVisibleState(),
                IsFocusable(), focused, IsClipToParent(), IsMovable(), IsResizable(), GetInputEnableState());
 
@@ -4883,14 +4882,14 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
        Rectangle clientBounds = GetClientBounds();
        Rectangle absoluteBounds = GetAbsoluteBounds();
 
-       SysLog(NID_UI, "%ls bounds(%d %d %d %d) min(%d %d) max(%d %d) scrollPos(%.2f %.2f) cbounds(%d %d %d %d) abounds(%d %d %d %d)",
+       SysSecureLog(NID_UI, "%ls bounds(%d %d %d %d) min(%d %d) max(%d %d) scrollPos(%.2f %.2f) cbounds(%d %d %d %d) abounds(%d %d %d %d)",
                indent.GetPointer(), bounds.x, bounds.y, bounds.width, bounds.height,
                min.width, min.height, max.width, max.height,
                GetVerticalScrollPosition(), GetHorizontalScrollPosition(),
                clientBounds.x, clientBounds.y, clientBounds.width, clientBounds.height,
                absoluteBounds.x, absoluteBounds.y, absoluteBounds.width, absoluteBounds.height);
 
-       SysLog(NID_UI, "%ls bgColor(0x%x) layoutable(%d) orientation(%d) drag(%d) drop(%d) area(%d) layer(%d)",
+       SysSecureLog(NID_UI, "%ls bgColor(0x%x) layoutable(%d) orientation(%d) drag(%d) drop(%d) area(%d) layer(%d)",
                indent.GetPointer(), __backgroundColor.GetRGB32(), IsLayoutable(), GetOrientation(), IsDragEnabled(), IsDropEnabled(), GetArea(), GetLayer());
 
        Canvas* pCanvas = GetCanvasN();
@@ -4900,13 +4899,13 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
                Color canvasBackgroundColor = pCanvas->GetBackgroundColor();
                Color canvasForegroundColor = pCanvas->GetForegroundColor();
 
-               SysLog(NID_UI, "%ls canvas.bounds(%d %d %d %d) canvas.bgColor(0x%x) canvas.fgColor(0x%x)",
+               SysSecureLog(NID_UI, "%ls canvas.bounds(%d %d %d %d) canvas.bgColor(0x%x) canvas.fgColor(0x%x)",
                        indent.GetPointer(), canvasBounds.x, canvasBounds.y, canvasBounds.width, canvasBounds.height, canvasBackgroundColor.GetRGB32(), canvasForegroundColor.GetRGB32());
 
                delete pCanvas;
        }
 
-       SysLog(NID_UI, "%ls DataBindingContext(0x%x) ControlDelegate(0x%x) UserData(0x%x) destroying(%d)",
+       SysSecureLog(NID_UI, "%ls DataBindingContext(0x%x) ControlDelegate(0x%x) UserData(0x%x) destroying(%d)",
                indent.GetPointer(), __pDataBindingContext, __pControlDelegate, __pUserData, __destroying);
 
        // Ownees
@@ -4925,23 +4924,23 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
 
        if (!ownees.IsEmpty())
        {
-               SysLog(NID_UI, "%ls Ownees(%ls)", indent.GetPointer(), ownees.GetPointer());
+               SysSecureLog(NID_UI, "%ls Ownees(%ls)", indent.GetPointer(), ownees.GetPointer());
        }
 
        _VisualElementImpl* pVisualElementImpl = _VisualElementImpl::GetInstance(*__pVisualElement);
 
-       SysLog(NID_UI, "%ls _VisualElement(0x%x) _VisualElementImpl(0x%x) VisualElementContentProvider(0x%x) VisualElementEventListener(0x%x)",
+       SysSecureLog(NID_UI, "%ls _VisualElement(0x%x) _VisualElementImpl(0x%x) VisualElementContentProvider(0x%x) VisualElementEventListener(0x%x)",
                indent.GetPointer(), __pVisualElement, pVisualElementImpl, __pVisualElementContentProvider, __pVisualElementEventListener);
 
        // Layout
-       SysLog(NID_UI, "%ls LayoutItemHandler(0x%x) PortraitLayout(0x%x) LandscapeLayout(0x%x) LayoutContainer(0x%x)",
+       SysSecureLog(NID_UI, "%ls LayoutItemHandler(0x%x) PortraitLayout(0x%x) LandscapeLayout(0x%x) LayoutContainer(0x%x)",
                indent.GetPointer(), __pLayoutItemHandler, __pPortraitLayout, __pLandscapeLayout, __pLayoutContainer);
 
        // Derived class
        String description = GetDescription();
        if (!description.IsEmpty())
        {
-               SysLog(NID_UI, "%ls %ls", indent.GetPointer(), description.GetPointer());
+               SysSecureLog(NID_UI, "%ls %ls", indent.GetPointer(), description.GetPointer());
        }
 
        // Print Gesture List
@@ -4957,7 +4956,7 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
                pEnumerator->GetCurrent(pGestureDetector);
                if (pGestureDetector)
                {
-                       SysLog(NID_UI, "%ls AddedGesture : %ls", indent.GetPointer(), pGestureDetector->GetDescription().GetPointer());
+                       SysSecureLog(NID_UI, "%ls AddedGesture : %ls", indent.GetPointer(), pGestureDetector->GetDescription().GetPointer());
                }
        }
 
@@ -4973,7 +4972,7 @@ _Control::PrintDescription(bool printChildren, int depth, int level)
                pStartedGestureEnumerator->GetKey(pStartedGestureDetector);
                if (pStartedGestureDetector)
                {
-                       SysLog(NID_UI, "%ls StartedGesture : %ls", indent.GetPointer(), pStartedGestureDetector->GetDescription().GetPointer());
+                       SysSecureLog(NID_UI, "%ls StartedGesture : %ls", indent.GetPointer(), pStartedGestureDetector->GetDescription().GetPointer());
                }
        }
 
index 9f68545..659a71b 100644 (file)
@@ -138,6 +138,28 @@ _UiPrintTree(int level)
                _UiPrintControl(*pWindow, true, level);
        }
 }
+
+_OSP_EXPORT_ void
+_UiPrintControlList(int level)
+{
+       _ControlManager* pControlManager = _ControlManager::GetInstance();
+       SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+       int count = pControlManager->GetControlCount();
+       for (int i = 0; i< count; i++)
+       {
+               _Control* pControl = pControlManager->GetControl((count-1) - i);
+               if (pControl != null)
+               {
+                       SysSecureLog(NID_UI, "[Control Manager] pControl index %d", i);
+                       _UiPrintControl(*pControl, true, level);
+               }
+               else
+               {
+                       SysSecureLog(NID_UI, "[Control Manager] pControl is null");
+               }
+       }
+}
 }
 
 namespace Tizen { namespace Ui
@@ -207,6 +229,11 @@ _ControlManager::Register(_Control* pObject)
                return _ControlHandle();
        }
 
+       if (__pAllControlList)
+       {
+               __pAllControlList->Add(pObject);
+       }
+
        return __objectManager.Register(*pObject);
 }
 
@@ -219,6 +246,11 @@ _ControlManager::Release(const _ControlHandle& handle)
                SysLog(NID_UI, "A _Control Released()");
        }
 
+       if (__pAllControlList)
+       {
+               __pAllControlList->Remove(pObject);
+       }
+
        return __objectManager.Unregister(handle);
 }
 
@@ -305,6 +337,7 @@ _ControlManager::GetLogicalBaseScreenSize(void) const
 _ControlManager::_ControlManager(void) // [ToDo] exception check.
        : __pWindowList(null)
        , __pAllWindowList(null)
+       , __pAllControlList(null)
        , __isCoordinateSystemLogical(true)
        , __logicalCoordinateSystem(0)
        , __logicalBaseScreenSize(BASE_SCREEN_SIZE_NONE)
@@ -347,6 +380,9 @@ _ControlManager::_ControlManager(void) // [ToDo] exception check.
        __pAllWindowList = new (std::nothrow)LinkedListT<_Window*>;
        SysTryCatch(NID_UI, __pAllWindowList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
 
+       __pAllControlList = new (std::nothrow)LinkedListT<_Control*>;
+       SysTryCatch(NID_UI, __pAllControlList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
        __pGestureList = new (std::nothrow)LinkedListT<_TouchGestureDetector*>;
        SysTryCatch(NID_UI, __pGestureList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
 
@@ -375,6 +411,12 @@ CATCH:
                __pAllWindowList = null;
        }
 
+       if (__pAllControlList)
+       {
+               delete __pAllControlList;
+               __pAllControlList = null;
+       }
+
        if (__pGestureList)
        {
                delete __pGestureList;
@@ -386,6 +428,16 @@ _ControlManager::~_ControlManager(void)
 {
        _Clipboard::ReleaseInstance();
 
+       if (GetUsedHandleCount() != 0)
+       {
+               SysLog(NID_UI, "[Control Manager] The number of unreleased handle: %d", GetUsedHandleCount());
+       }
+
+       if (GetControlCount() != 0)
+       {
+               SysLog(NID_UI, "[Control Manager] The number of unreleased control: %d", GetControlCount());
+       }
+
        if (__pWindowList)
        {
                delete __pWindowList;
@@ -398,6 +450,12 @@ _ControlManager::~_ControlManager(void)
                __pAllWindowList = null;
        }
 
+       if (__pAllControlList)
+       {
+               delete __pAllControlList;
+               __pAllControlList = null;
+       }
+
        if (__pGestureList)
        {
                delete __pGestureList;
@@ -406,12 +464,6 @@ _ControlManager::~_ControlManager(void)
 
        DestroyEcoreEvasMgr();
 
-       if (GetUsedHandleCount() != 0)
-       {
-               SysLog(NID_UI, "[Control Manager] The number of unreleased controls: %d", GetUsedHandleCount());
-       }
-
-
        _IndicatorManager::ReleaseInstance();
 
        _DisplayManager::ReleaseInstance();
@@ -720,7 +772,7 @@ _ControlManager::CallOnDetachingFromMainTree(_Control& control)
                        pTop->SetFocusTraversalControl(&control, false);
                }
        }
-       
+
        r = control.GetControlDelegate().OnDetachingFromMainTree();
        SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -805,6 +857,21 @@ _ControlManager::CloseWindow(_Window& window) // [ToDo] exception check.
        return E_SUCCESS;
 }
 
+_Control*
+_ControlManager::GetControl(int index) const
+{
+       _Control* pControl;
+       __pAllControlList->GetAt(index, pControl);
+
+       return pControl;
+}
+
+int
+_ControlManager::GetControlCount(void) const
+{
+       return __pAllControlList->GetCount();
+}
+
 _Window*
 _ControlManager::GetWindow(int index) const
 {
@@ -820,6 +887,7 @@ _ControlManager::GetWindowCount(void) const
        return __pWindowList->GetCount();
 }
 
+
 _Window*
 _ControlManager::GetAllWindow(int index) const
 {
@@ -866,7 +934,6 @@ _ControlManager::AttachWindow(_Window& window)
                        _DisplayManager::GetInstance()->RegisterRoot(*pRootVE);
                }
        }
-
        __pAllWindowList->Add(&window);
 
        return __pWindowList->Add(&window);
index f63957f..2453f2a 100644 (file)
@@ -74,6 +74,10 @@ public:
        result OpenWindow(_Window& window, bool invalidate);
        result CloseWindow(_Window& window);
 
+// For control list
+       _Control* GetControl(int index) const;
+       int GetControlCount(void) const;
+
 // Orientation
        _ControlOrientation GetOrientation(void) const;
        void SetOrientation(_ControlOrientation orientation);
@@ -170,6 +174,7 @@ private:
        Tizen::Base::_ObjectManagerT <_Control> __objectManager;
        Tizen::Base::Collection::LinkedListT<_Window*>* __pWindowList;
        Tizen::Base::Collection::LinkedListT<_Window*>* __pAllWindowList;
+       Tizen::Base::Collection::LinkedListT<_Control*>* __pAllControlList;
 
        bool __isCoordinateSystemLogical;
        int __logicalCoordinateSystem;