36 #include "MemSpyViewProcesses.h" |
36 #include "MemSpyViewProcesses.h" |
37 #include "MemSpyViewThreadInfoItemList.h" |
37 #include "MemSpyViewThreadInfoItemList.h" |
38 |
38 |
39 |
39 |
40 |
40 |
41 /* |
41 CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId ) |
42 CMemSpyViewThreads::CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) |
42 : CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ), iCurrentThreadId( aThreadId ) |
43 : CMemSpyViewBase( aEngine, aObserver ), iParentProcess( aProcess ) |
|
44 { |
|
45 iParentProcess.Open(); |
|
46 } |
|
47 */ |
|
48 CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId ) |
|
49 : CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ) |
|
50 { |
43 { |
51 } |
44 } |
52 |
45 |
53 |
46 |
54 CMemSpyViewThreads::~CMemSpyViewThreads() |
47 CMemSpyViewThreads::~CMemSpyViewThreads() |
56 } |
49 } |
57 |
50 |
58 |
51 |
59 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
52 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
60 { |
53 { |
|
54 iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
|
55 |
61 _LIT( KTitle, "Threads" ); |
56 _LIT( KTitle, "Threads" ); |
62 SetTitleL( KTitle ); |
57 SetTitleL( KTitle ); |
63 // |
58 // |
64 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
59 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
65 // |
60 // |
66 if ( aSelectionRune ) |
61 if( iCurrentThreadId > 0 ) |
67 { |
62 { |
68 iListBox->SetCurrentItemIndex( 0 ); //for now |
63 for( TInt i = 0; i < iThreads.Count() ; i++ ) |
|
64 { |
|
65 if( iThreads[i]->Id() == iCurrentThreadId ) |
|
66 { |
|
67 const TInt index = i; |
|
68 if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) |
|
69 { |
|
70 iListBox->SetCurrentItemIndex( index ); |
|
71 HandleListBoxItemSelectedL( index ); |
|
72 } |
|
73 } |
|
74 } |
|
75 } |
|
76 else if( iThreads.Count() > 0 ) |
|
77 { |
|
78 iListBox->SetCurrentItemIndex( 0 ); |
69 HandleListBoxItemSelectedL( 0 ); |
79 HandleListBoxItemSelectedL( 0 ); |
70 /* TODO: |
80 } |
71 CMemSpyThread* selectedItem = reinterpret_cast< CMemSpyThread* >( aSelectionRune ); |
|
72 const TInt index = iParentProcess.ThreadIndexById( selectedItem->Id() ); |
|
73 if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) |
|
74 { |
|
75 iListBox->SetCurrentItemIndex( index ); |
|
76 HandleListBoxItemSelectedL( index ); |
|
77 } |
|
78 */ |
|
79 } |
|
80 //else if ( iParentProcess.Count() > 0 ) |
|
81 // { |
|
82 iListBox->SetCurrentItemIndex( 0 ); |
|
83 HandleListBoxItemSelectedL( 0 ); |
|
84 // } |
|
85 } |
81 } |
86 |
82 |
87 |
83 |
88 TProcessId CMemSpyViewThreads::Process() const |
84 TProcessId CMemSpyViewThreads::Process() const |
89 { |
85 { |
123 |
119 |
124 CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() |
120 CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() |
125 { |
121 { |
126 CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId ); |
122 CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId ); |
127 CleanupStack::PushL( child ); |
123 CleanupStack::PushL( child ); |
128 child->ConstructL( Rect(), *Parent() ); |
124 child->ConstructL( Rect(), *Parent(), EMemSpyThreadInfoItemTypeFirst ); |
129 CleanupStack::Pop( child ); |
125 CleanupStack::Pop( child ); |
130 return child; |
126 return child; |
131 } |
127 } |
132 |
128 |
133 |
129 |
329 } |
325 } |
330 |
326 |
331 |
327 |
332 void CMemSpyViewThreads::OnCmdInfoHandlesL() |
328 void CMemSpyViewThreads::OnCmdInfoHandlesL() |
333 { |
329 { |
334 /* |
330 iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId ); |
335 CMemSpyThread& thread = CurrentThread(); |
|
336 thread.InfoContainerForceSyncronousConstructionL().PrintL(); |
|
337 */ |
|
338 } |
331 } |
339 |
332 |
340 |
333 |
341 void CMemSpyViewThreads::SetListBoxModelL() |
334 void CMemSpyViewThreads::SetListBoxModelL() |
342 { |
335 { |
343 iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
336 //iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
344 |
337 |
345 iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items |
338 iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items |
346 |
339 |
347 _LIT( KTab, "\t" ); |
340 _LIT( KTab, "\t" ); |
348 |
341 |
357 iModel->AppendL( tempNamePtr ); |
350 iModel->AppendL( tempNamePtr ); |
358 |
351 |
359 CleanupStack::PopAndDestroy( tempName ); |
352 CleanupStack::PopAndDestroy( tempName ); |
360 } |
353 } |
361 |
354 |
362 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
355 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
363 //listbox->Model()->SetItemTextArray( &iParentProcess ); |
|
364 listbox->Model()->SetItemTextArray( iModel ); |
356 listbox->Model()->SetItemTextArray( iModel ); |
365 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
357 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
366 } |
358 } |
367 |
359 |
368 |
360 |