perfapps/memspyui/ui/avkon/src/MemSpyViewThreads.cpp
changeset 53 819e59dfc032
parent 52 36d60d12b4af
equal deleted inserted replaced
52:36d60d12b4af 53:819e59dfc032
    44     }
    44     }
    45 
    45 
    46 
    46 
    47 CMemSpyViewThreads::~CMemSpyViewThreads()
    47 CMemSpyViewThreads::~CMemSpyViewThreads()
    48     {
    48     {
    49 	iThreads.Reset();
    49     iThreads.ResetAndDestroy();
    50     }
    50     }
    51 
    51 
    52  
    52  
    53 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
    53 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
    54     {
    54     {
    55     TInt error = KErrNone; 
    55     TInt error = KErrNone;
    56 	TRAP( error, iMemSpySession.GetThreadsL( iParentProcessId, iThreads ) );
    56     RArray<CMemSpyApiThread*> threads;
       
    57 	TRAP( error, iMemSpySession.GetThreadsL( iParentProcessId, threads ) );
    57 	
    58 	
    58 	if( error == KErrNone )
    59 	if( error == KErrNone )
    59 	    {
    60 	    {
       
    61 	    CleanupClosePushL( threads );
       
    62         for (TInt i=0; i<threads.Count(); i++)
       
    63             {
       
    64             iThreads.Append( threads[i] );
       
    65             }
       
    66         CleanupStack::PopAndDestroy( &threads );
       
    67         
    60 	    _LIT( KTitle, "Threads" );
    68 	    _LIT( KTitle, "Threads" );
    61 	    SetTitleL( KTitle );
    69 	    SetTitleL( KTitle );
    62 	    //
    70 	    //
    63 	    CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
    71 	    CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
    64 	    //    
    72 	    //    
   348 	iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId );	
   356 	iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId );	
   349     }
   357     }
   350 
   358 
   351 
   359 
   352 void CMemSpyViewThreads::SetListBoxModelL()
   360 void CMemSpyViewThreads::SetListBoxModelL()
   353     {		
   361     {
   354 	iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items
   362     RArray<CMemSpyApiThread*> threads;
   355 		
   363     iMemSpySession.GetThreadsL( iParentProcessId, threads );
       
   364     CleanupClosePushL( threads );
       
   365     iThreads.ResetAndDestroy();
       
   366     for (TInt i=0; i<threads.Count(); i++)
       
   367         {
       
   368         iThreads.Append( threads[i] );
       
   369         }
       
   370     CleanupStack::PopAndDestroy( &threads );
       
   371     
       
   372     CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items
       
   373     CleanupStack::PushL( model );
       
   374     
   356 	_LIT( KTab, "\t" );
   375 	_LIT( KTab, "\t" );
   357 	_LIT( KTTab, "\t\t" );
   376 	_LIT( KTTab, "\t\t" );
   358 			
   377 			
   359 	for( TInt i=0; i < iThreads.Count(); i++ )
   378 	for( TInt i=0; i < iThreads.Count(); i++ )
   360 	    {
   379 	    {
   365 	    tempNamePtr.Append( iThreads[i]->Name() );
   384 	    tempNamePtr.Append( iThreads[i]->Name() );
   366 	    tempNamePtr.Append( KTTab );
   385 	    tempNamePtr.Append( KTTab );
   367 	    
   386 	    
   368 	    AppendPriority( tempNamePtr, iThreads[i]->ThreadPriority() );
   387 	    AppendPriority( tempNamePtr, iThreads[i]->ThreadPriority() );
   369 	    
   388 	    
   370 	    iModel->AppendL( tempNamePtr );
   389 	    model->AppendL( tempNamePtr );
   371 	    	
   390 	    	
   372 	    CleanupStack::PopAndDestroy( tempName ); 
   391 	    CleanupStack::PopAndDestroy( tempName ); 
   373 	    }			
   392 	    }			
   374 	
   393 	
   375     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );    
   394     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );    
   376     listbox->Model()->SetItemTextArray( iModel );
   395     listbox->Model()->SetItemTextArray( model );
   377     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
   396     listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
       
   397     
       
   398     CleanupStack::Pop( model );
   378     }
   399     }
   379 
   400 
   380 
   401 
   381 void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ )
   402 void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ )
   382     {
   403     {