memspyui/source/MemSpyViewKernelHeap.cpp
branchRCL_3
changeset 22 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "MemSpyViewKernelHeap.h"
       
    19 
       
    20 // Engine includes
       
    21 #include <memspy/engine/memspyengine.h>
       
    22 #include <memspy/engine/memspyengineobjectprocess.h>
       
    23 #include <memspy/engine/memspyengineobjectthread.h>
       
    24 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    25 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    26 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    27 #include <memspy/engine/memspyenginehelperheap.h>
       
    28 #include <memspy/engine/memspyengineoutputlist.h>
       
    29 
       
    30 // User includes
       
    31 #include "MemSpyUiUtils.h"
       
    32 #include "MemSpyViewKernel.h"
       
    33 #include "MemSpyContainerObserver.h"
       
    34 
       
    35 // Literal constants
       
    36 
       
    37 
       
    38 
       
    39 CMemSpyViewKernelHeap::CMemSpyViewKernelHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
       
    40 :   CMemSpyViewBase( aEngine, aObserver )
       
    41     {
       
    42     }
       
    43 
       
    44 
       
    45 CMemSpyViewKernelHeap::~CMemSpyViewKernelHeap()
       
    46     {
       
    47     }
       
    48 
       
    49 
       
    50 void CMemSpyViewKernelHeap::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
    51     {
       
    52     _LIT( KTitle, "Kernel Heap" );
       
    53     SetTitleL( KTitle );
       
    54     //
       
    55     CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
       
    56     }
       
    57 
       
    58 
       
    59 void CMemSpyViewKernelHeap::RefreshL()
       
    60     {
       
    61     SetListBoxModelL();
       
    62     CMemSpyViewBase::RefreshL();
       
    63     }
       
    64 
       
    65 
       
    66 TMemSpyViewType CMemSpyViewKernelHeap::ViewType() const
       
    67     {
       
    68     return EMemSpyViewTypeKernelHeap;
       
    69     }
       
    70 
       
    71 
       
    72 CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareParentViewL()
       
    73     {
       
    74     CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
       
    75     CleanupStack::PushL( parent );
       
    76     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
    77     CleanupStack::Pop( parent );
       
    78     return parent;
       
    79     }
       
    80 
       
    81 
       
    82 CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareChildViewL()
       
    83     {
       
    84     CMemSpyViewBase* child = NULL;
       
    85     return child;
       
    86     }
       
    87 
       
    88 
       
    89 void CMemSpyViewKernelHeap::SetListBoxModelL()
       
    90     {
       
    91     // Get list contents
       
    92     TMemSpyHeapInfo heapInfo;
       
    93     iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo );
       
    94     CMemSpyEngineOutputList* list = iEngine.HelperHeap().NewHeapSummaryShortLC( heapInfo );
       
    95 
       
    96     // Set up list box
       
    97     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
    98     listbox->Model()->SetItemTextArray( list );
       
    99     listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
       
   100     CleanupStack::Pop( list );
       
   101     }
       
   102 
       
   103 
       
   104 TBool CMemSpyViewKernelHeap::HandleCommandL( TInt aCommand )
       
   105     {
       
   106     TBool handled = ETrue;
       
   107     //
       
   108     switch ( aCommand )
       
   109         {
       
   110     case EMemSpyCmdKernelHeapDump:
       
   111         OnCmdDumpKernelHeapL();
       
   112         break;
       
   113 
       
   114     default:
       
   115         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   116         break;
       
   117         }
       
   118     //
       
   119     return handled;
       
   120     }
       
   121 
       
   122 
       
   123 void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL()
       
   124     {
       
   125     iEngine.HelperHeap().OutputHeapDataKernelL();
       
   126     }
       
   127 
       
   128 
       
   129 
       
   130