memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp
branchRCL_3
changeset 22 fad26422216a
parent 21 b3cee849fa46
child 23 f8280f3bfeb7
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 "MemSpyViewThreadInfoItemMemoryTracking.h"
       
    19 
       
    20 // System includes
       
    21 #include <AknQueryDialog.h>
       
    22 
       
    23 // Engine includes
       
    24 #include <memspy/engine/memspyengine.h>
       
    25 #include <memspy/engine/memspyengineobjectprocess.h>
       
    26 #include <memspy/engine/memspyengineobjectthread.h>
       
    27 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    28 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    29 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    30 #include <memspy/engine/memspyengineprocessmemorytracker.h>
       
    31 #include <memspy/engine/memspyenginehelperprocess.h>
       
    32 
       
    33 // User includes
       
    34 #include "MemSpyContainerObserver.h"
       
    35 
       
    36 
       
    37 CMemSpyViewThreadInfoItemMemoryTracking::CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
       
    38 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
       
    39     {
       
    40     }
       
    41 
       
    42 
       
    43 void CMemSpyViewThreadInfoItemMemoryTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
    44     {
       
    45     CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
       
    46     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
    47     item->TrackingObserverAddL( *this );
       
    48 
       
    49     // Reset the title
       
    50     _LIT( KCustomTitle, "Memory Statistics" );
       
    51     SetTitleL( KCustomTitle );
       
    52     
       
    53     // Select the appropriate view
       
    54     const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune );
       
    55     const TInt index = IndexByViewType( viewType );
       
    56     //
       
    57 #ifdef _DEBUG
       
    58     RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::ConstructL() - aSelectionRune: 0x%08x, viewType: %d, index: %d", aSelectionRune, viewType, index );
       
    59 #endif
       
    60     //
       
    61     if  ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
       
    62         {
       
    63         iListBox->SetCurrentItemIndex( index );
       
    64         HandleListBoxItemSelectedL( index );
       
    65         }
       
    66     }
       
    67 
       
    68 
       
    69 TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTracking::ViewType() const
       
    70     {
       
    71     return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics;
       
    72     }
       
    73 
       
    74 
       
    75 CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareParentViewL()
       
    76     {
       
    77     CMemSpyViewBase* parent = CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL();
       
    78     
       
    79     // Stop observing changes
       
    80     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
    81     item->TrackingObserverRemove( *this );
       
    82 
       
    83     return parent;
       
    84     }
       
    85 
       
    86 
       
    87 CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareChildViewL()
       
    88     {
       
    89     CMemSpyViewBase* child = NULL;
       
    90     //
       
    91     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
    92     const TInt index = iListBox->CurrentItemIndex();
       
    93     if  ( index == 1 )
       
    94         {
       
    95         child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingCurrent( iEngine, iObserver, Container() );
       
    96         }
       
    97     else if ( index == 2 )
       
    98         {
       
    99         child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingHWM( iEngine, iObserver, Container() );
       
   100         }
       
   101     else if ( index == 3 )
       
   102         {
       
   103         child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingPeak( iEngine, iObserver, Container() );
       
   104         }
       
   105     //        
       
   106     if  ( child )
       
   107         {
       
   108         CleanupStack::PushL( child );
       
   109         child->ConstructL( Rect(), *Parent() );
       
   110         CleanupStack::Pop( child );
       
   111            
       
   112         // Stop observing changes
       
   113         item->TrackingObserverRemove( *this );
       
   114         }
       
   115     //
       
   116     return child;
       
   117     }
       
   118 
       
   119 
       
   120 TBool CMemSpyViewThreadInfoItemMemoryTracking::HandleCommandL( TInt aCommand )
       
   121     {
       
   122     TBool handled = ETrue;
       
   123     //
       
   124     switch ( aCommand )
       
   125         {
       
   126     case EMemSpyCmdMemoryTrackingStart:
       
   127         OnCmdTrackingStartL();
       
   128         break;
       
   129     case EMemSpyCmdMemoryTrackingStop:
       
   130         OnCmdTrackingStopL();
       
   131         break;
       
   132     case EMemSpyCmdMemoryTrackingHWMReset:
       
   133         OnCmdHWMResetL();
       
   134         break;
       
   135     case EMemSpyCmdMemoryTrackingTotalWithSharedMem:
       
   136         OnCmdTotalWithSharedMemL();
       
   137         break;
       
   138     case EMemSpyCmdMemoryTrackingTotalWithoutSharedMem:
       
   139         OnCmdTotalWithoutSharedMemL();
       
   140         break;
       
   141     default:
       
   142         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   143         break;
       
   144         }
       
   145     //
       
   146     return handled;
       
   147     }
       
   148 
       
   149 
       
   150 TInt CMemSpyViewThreadInfoItemMemoryTracking::IndexByViewType( TMemSpyViewType aType )
       
   151     {
       
   152     TInt index = 0;
       
   153     //
       
   154     switch( aType )
       
   155         {
       
   156     default:
       
   157     case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent:
       
   158         index = 1;
       
   159         break;
       
   160     case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM:
       
   161         index = 2;
       
   162         break;
       
   163     case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak:
       
   164         index = 3;
       
   165         break;
       
   166         }
       
   167     //
       
   168     return index;
       
   169     }
       
   170 
       
   171 
       
   172 void CMemSpyViewThreadInfoItemMemoryTracking::HandleListBoxItemActionedL( TInt aIndex )
       
   173     {
       
   174     if  ( aIndex == 0 )
       
   175         {
       
   176         CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   177         if  ( item->TrackingActive() )
       
   178             {
       
   179             OnCmdTrackingStopL();
       
   180             }
       
   181         else
       
   182             {
       
   183             OnCmdTrackingStartL();
       
   184             }
       
   185         }
       
   186 
       
   187     // Notify observer about item selection
       
   188     ReportEventL( MMemSpyViewObserver::EEventItemActioned );
       
   189 
       
   190     // Ensure we refresh the listbox content
       
   191     iListBox->DrawDeferred();
       
   192     }
       
   193 
       
   194 
       
   195 void CMemSpyViewThreadInfoItemMemoryTracking::RefreshL()
       
   196     {
       
   197     SetListBoxModelL();
       
   198     CMemSpyViewBase::RefreshL();
       
   199     iListBox->DrawDeferred();
       
   200     }
       
   201 
       
   202 
       
   203 void CMemSpyViewThreadInfoItemMemoryTracking::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
       
   204     {
       
   205     if  ( aResourceId == MenuCascadeResourceId() )
       
   206         {
       
   207         CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   208         //
       
   209         if  ( !item->TrackerExists() || item->TrackingActive() )
       
   210             {
       
   211             aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStart, ETrue );
       
   212             }
       
   213         else
       
   214             {
       
   215             aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStop, ETrue );
       
   216             }
       
   217         //
       
   218         if ( item->TotalIncludesSharedMemory() )
       
   219             {
       
   220             aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithSharedMem, ETrue );
       
   221             }
       
   222         else
       
   223             {
       
   224             aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, ETrue );
       
   225             }
       
   226 
       
   227         aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingHWMReset, Thread().IsDead() );
       
   228         }
       
   229     else if ( aResourceId == R_MEMSPY_MENUPANE )
       
   230         {
       
   231         aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTracking, Thread().IsDead() );
       
   232         aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStart, Thread().IsDead() );
       
   233         }
       
   234     }
       
   235 
       
   236 
       
   237 void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStartedL()
       
   238     {
       
   239     RefreshL();
       
   240     }
       
   241 
       
   242 
       
   243 void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStoppedL()
       
   244     {
       
   245     RefreshL();
       
   246     }
       
   247 
       
   248 
       
   249 void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
       
   250     {
       
   251 #ifdef _DEBUG
       
   252     RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this );
       
   253 #endif 
       
   254 
       
   255     CMemSpyViewBase::RefreshL();
       
   256     iListBox->DrawDeferred();
       
   257 
       
   258 #ifdef _DEBUG
       
   259     RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this );
       
   260 #endif 
       
   261     }
       
   262 
       
   263 
       
   264 void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStartL()
       
   265     {
       
   266     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   267     item->TrackingStartL();
       
   268     }
       
   269 
       
   270 
       
   271 void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStopL()
       
   272     {
       
   273     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   274     item->TrackingStopL();
       
   275     }
       
   276 
       
   277 
       
   278 void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdHWMResetL()
       
   279     {
       
   280     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   281     item->TrackingResetHWML();
       
   282     RefreshL();
       
   283     }
       
   284 
       
   285 
       
   286 void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithSharedMemL()
       
   287     {
       
   288     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   289     item->TrackingSetTotalIncludesSharedMemoryL( ETrue );
       
   290     RefreshL();
       
   291     }
       
   292 
       
   293 
       
   294 void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithoutSharedMemL()
       
   295     {
       
   296     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   297     item->TrackingSetTotalIncludesSharedMemoryL( EFalse );
       
   298     RefreshL();
       
   299     }
       
   300 
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 
       
   306 
       
   307 
       
   308 
       
   309 
       
   310 
       
   311 
       
   312 
       
   313 
       
   314 
       
   315 
       
   316 
       
   317 
       
   318 
       
   319 
       
   320 
       
   321 
       
   322 
       
   323 
       
   324 
       
   325 
       
   326 
       
   327 
       
   328 
       
   329 
       
   330 
       
   331 
       
   332 
       
   333 
       
   334 
       
   335 
       
   336 
       
   337 
       
   338 
       
   339 
       
   340 
       
   341 CMemSpyViewThreadInfoItemMemoryTrackingCurrent::CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
       
   342 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
       
   343     {
       
   344     }
       
   345 
       
   346 
       
   347 void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
   348     {
       
   349     CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
       
   350 
       
   351     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   352     item->TrackingObserverAddL( *this );
       
   353 
       
   354     // Reset the title
       
   355     _LIT( KCustomTitle, "Current Statistics" );
       
   356     SetTitleL( KCustomTitle );
       
   357     }
       
   358 
       
   359 
       
   360 TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ViewType() const
       
   361     {
       
   362     return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent;
       
   363     }
       
   364 
       
   365 
       
   366 CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingCurrent::PrepareParentViewL()
       
   367     {
       
   368     CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
       
   369     CleanupStack::PushL( parent );
       
   370     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
   371     CleanupStack::Pop( parent );
       
   372     
       
   373     // Stop observing changes
       
   374     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   375     item->TrackingObserverRemove( *this );
       
   376 
       
   377     return parent;
       
   378     }
       
   379 
       
   380 
       
   381 void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::RefreshL()
       
   382     {
       
   383     SetListBoxModelL();
       
   384     CMemSpyViewBase::RefreshL();
       
   385     }
       
   386 
       
   387 
       
   388 void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::SetListBoxModelL()
       
   389     {
       
   390     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   391     MDesCArray* model = &item->InfoCurrent();
       
   392 
       
   393     // Set up list box
       
   394     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   395     listbox->Model()->SetItemTextArray( model );
       
   396     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   397     }
       
   398     
       
   399 
       
   400 void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
       
   401     {
       
   402     CMemSpyViewBase::RefreshL();
       
   403     }
       
   404 
       
   405 
       
   406 
       
   407 
       
   408 
       
   409 
       
   410 
       
   411 
       
   412 
       
   413 
       
   414 
       
   415 
       
   416 
       
   417 
       
   418 
       
   419 
       
   420 
       
   421 
       
   422 
       
   423 
       
   424 
       
   425 
       
   426 
       
   427 
       
   428 
       
   429 
       
   430 
       
   431 
       
   432 
       
   433 
       
   434 
       
   435 
       
   436 
       
   437 
       
   438 
       
   439 
       
   440 
       
   441 
       
   442 
       
   443 
       
   444 
       
   445 
       
   446 CMemSpyViewThreadInfoItemMemoryTrackingHWM::CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
       
   447 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
       
   448     {
       
   449     }
       
   450 
       
   451 
       
   452 void CMemSpyViewThreadInfoItemMemoryTrackingHWM::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
   453     {
       
   454     CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
       
   455 
       
   456     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   457     item->TrackingObserverAddL( *this );
       
   458 
       
   459     // Reset the title
       
   460     _LIT( KCustomTitle, "HWM Statistics" );
       
   461     SetTitleL( KCustomTitle );
       
   462     }
       
   463 
       
   464 
       
   465 TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingHWM::ViewType() const
       
   466     {
       
   467     return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM;
       
   468     }
       
   469 
       
   470 
       
   471 CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingHWM::PrepareParentViewL()
       
   472     {
       
   473     CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
       
   474     CleanupStack::PushL( parent );
       
   475     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
   476     CleanupStack::Pop( parent );
       
   477     
       
   478     // Stop observing changes
       
   479     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   480     item->TrackingObserverRemove( *this );
       
   481 
       
   482     return parent;
       
   483     }
       
   484 
       
   485 
       
   486 TBool CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleCommandL( TInt aCommand )
       
   487     {
       
   488     TBool handled = ETrue;
       
   489     //
       
   490     switch ( aCommand )
       
   491         {
       
   492     case EMemSpyCmdMemoryTrackingHWMReset:
       
   493         OnCmdHWMResetL();
       
   494         break;
       
   495     default:
       
   496         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   497         break;
       
   498         }
       
   499     //
       
   500     return handled;
       
   501     }
       
   502 
       
   503 
       
   504 void CMemSpyViewThreadInfoItemMemoryTrackingHWM::RefreshL()
       
   505     {
       
   506     SetListBoxModelL();
       
   507     CMemSpyViewBase::RefreshL();
       
   508     }
       
   509 
       
   510 
       
   511 void CMemSpyViewThreadInfoItemMemoryTrackingHWM::SetListBoxModelL()
       
   512     {
       
   513     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   514     MDesCArray* model = &item->InfoHWM();
       
   515 
       
   516     // Set up list box
       
   517     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   518     listbox->Model()->SetItemTextArray( model );
       
   519     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   520     }
       
   521     
       
   522 
       
   523 void CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
       
   524     {
       
   525     CMemSpyViewBase::RefreshL();
       
   526     }
       
   527 
       
   528 
       
   529 void CMemSpyViewThreadInfoItemMemoryTrackingHWM::OnCmdHWMResetL()
       
   530     {
       
   531     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   532     item->TrackingResetHWML();
       
   533     }
       
   534 
       
   535 
       
   536 
       
   537 
       
   538 
       
   539 
       
   540 
       
   541 
       
   542 
       
   543 
       
   544 
       
   545 
       
   546 
       
   547 
       
   548 
       
   549 
       
   550 
       
   551 
       
   552 
       
   553 
       
   554 
       
   555 
       
   556 
       
   557 
       
   558 
       
   559 
       
   560 CMemSpyViewThreadInfoItemMemoryTrackingPeak::CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer )
       
   561 :   CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking )
       
   562     {
       
   563     }
       
   564 
       
   565 
       
   566 void CMemSpyViewThreadInfoItemMemoryTrackingPeak::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
   567     {
       
   568     CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune );
       
   569 
       
   570     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   571     item->TrackingObserverAddL( *this );
       
   572 
       
   573     // Reset the title
       
   574     _LIT( KCustomTitle, "Peak Statistics" );
       
   575     SetTitleL( KCustomTitle );
       
   576     }
       
   577 
       
   578 
       
   579 TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingPeak::ViewType() const
       
   580     {
       
   581     return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak;
       
   582     }
       
   583 
       
   584 
       
   585 CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingPeak::PrepareParentViewL()
       
   586     {
       
   587     CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() );
       
   588     CleanupStack::PushL( parent );
       
   589     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
   590     CleanupStack::Pop( parent );
       
   591     
       
   592     // Stop observing changes
       
   593     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   594     item->TrackingObserverRemove( *this );
       
   595 
       
   596     return parent;
       
   597     }
       
   598 
       
   599 
       
   600 TBool CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleCommandL( TInt aCommand )
       
   601     {
       
   602     TBool handled = ETrue;
       
   603     //
       
   604     switch ( aCommand )
       
   605         {
       
   606     default:
       
   607         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   608         break;
       
   609         }
       
   610     //
       
   611     return handled;
       
   612     }
       
   613 
       
   614 
       
   615 void CMemSpyViewThreadInfoItemMemoryTrackingPeak::RefreshL()
       
   616     {
       
   617     SetListBoxModelL();
       
   618     CMemSpyViewBase::RefreshL();
       
   619     }
       
   620 
       
   621 
       
   622 void CMemSpyViewThreadInfoItemMemoryTrackingPeak::SetListBoxModelL()
       
   623     {
       
   624     CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem );
       
   625     MDesCArray* model = &item->InfoPeak();
       
   626 
       
   627     // Set up list box
       
   628     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   629     listbox->Model()->SetItemTextArray( model );
       
   630     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   631     }
       
   632     
       
   633 
       
   634 void CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ )
       
   635     {
       
   636     CMemSpyViewBase::RefreshL();
       
   637     }
       
   638 
       
   639 
       
   640 
       
   641 
       
   642 
       
   643 
       
   644 
       
   645 
       
   646 
       
   647 
       
   648 
       
   649 
       
   650 
       
   651 
       
   652 
       
   653 
       
   654 
       
   655 
       
   656 
       
   657 
       
   658 
       
   659 
       
   660 
       
   661 
       
   662 
       
   663 
       
   664