27 #include <memspy/engine/memspyengineobjectthread.h> |
27 #include <memspy/engine/memspyengineobjectthread.h> |
28 #include <memspy/engine/memspyengineobjectcontainer.h> |
28 #include <memspy/engine/memspyengineobjectcontainer.h> |
29 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
29 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
30 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
30 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
31 #include <memspy/engine/memspyenginehelperprocess.h> |
31 #include <memspy/engine/memspyenginehelperprocess.h> |
|
32 #include <memspysession.h> |
32 |
33 |
33 // User includes |
34 // User includes |
34 #include "MemSpyContainerObserver.h" |
35 #include "MemSpyContainerObserver.h" |
35 #include "MemSpyViewThreadInfoItemList.h" |
36 #include "MemSpyViewThreadInfoItemList.h" |
|
37 #include "MemSpyUiUtils.h" |
36 |
38 |
37 // Constants |
39 // Constants |
38 const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second |
40 const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second |
39 |
41 |
40 |
42 CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType ) |
41 |
43 : CMemSpyViewBase( aSession, aObserver )//, iThreadId( aId ), iType( aType ) //iContainer( aInfoContainer ) |
42 CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType ) |
44 { |
43 : CMemSpyViewBase( aEngine, aObserver ), iContainer( aInfoContainer ) |
45 iParentProcessId = aProcessId; |
44 { |
46 iThreadId = aId; |
45 iContainer.Thread().Process().Open(); |
47 iType = aType; |
46 iContainer.Thread().Open(); |
|
47 iContainer.Open(); |
|
48 // |
|
49 iInfoItem = &iContainer.Item( aType ); |
|
50 __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); |
|
51 iInfoItem->Open(); |
|
52 } |
48 } |
53 |
49 |
54 |
50 |
55 CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric() |
51 CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric() |
56 { |
52 {/* TODO: |
57 if ( iInfoItem ) |
53 if ( iInfoItem ) |
58 { |
54 { |
59 iInfoItem->Close(); |
55 iInfoItem->Close(); |
60 } |
56 } |
61 // |
57 DestroyWaitNote(); |
62 DestroyWaitNote(); |
58 */ |
63 // |
|
64 iContainer.Close(); |
|
65 iContainer.Thread().Close(); |
|
66 iContainer.Thread().Process().Close(); |
|
67 } |
59 } |
68 |
60 |
69 |
61 |
70 void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
62 void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
71 { |
63 { |
72 const TPtrC pTitle( iInfoItem->Name().Mid( 1 ) ); |
64 const TPtrC pTitle( MemSpyUiUtils::ThreadInfoItemNameByType( iType ) ); |
73 SetTitleL( pTitle ); |
65 SetTitleL( pTitle ); |
74 // |
66 // |
|
67 /* TODO: |
75 if ( iInfoItem->IsReady() == EFalse ) |
68 if ( iInfoItem->IsReady() == EFalse ) |
76 { |
69 { |
77 #ifdef _DEBUG |
70 #ifdef _DEBUG |
78 RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::ConstructL() - show wait note - item not ready, iType: %d", iInfoItem->Type() ); |
71 RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::ConstructL() - show wait note - item not ready, iType: %d", iInfoItem->Type() ); |
79 #endif |
72 #endif |
80 |
73 |
81 // Wait for engine data to be made ready... |
74 // Wait for engine data to be made ready... |
82 ShowWaitNoteL(); |
75 ShowWaitNoteL(); |
83 } |
76 } |
84 |
77 */ |
85 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
78 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
86 } |
79 } |
87 |
80 |
88 |
81 |
89 CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const |
82 CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const |
90 { |
83 { |
91 return iContainer.Thread().Process(); |
84 // return iContainer.Thread().Process(); |
92 } |
85 } |
93 |
86 |
94 |
87 |
95 CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const |
88 CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const |
96 { |
89 { |
97 return iContainer.Thread(); |
90 // return iContainer.Thread(); |
98 } |
91 } |
99 |
92 |
100 |
93 |
101 CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const |
94 CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const |
102 { |
95 { |
103 return iContainer; |
96 // return iContainer; |
104 } |
97 } |
105 |
98 |
106 |
99 |
107 CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const |
100 CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const |
108 { |
101 { |
109 __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); |
102 // __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); |
110 return *iInfoItem; |
103 // return *iInfoItem; |
111 } |
104 } |
112 |
105 |
113 |
106 |
114 void CMemSpyViewThreadInfoItemGeneric::RefreshL() |
107 void CMemSpyViewThreadInfoItemGeneric::RefreshL() |
115 { |
108 { |
116 iInfoItem->RebuildL(); |
109 // iInfoItem->RebuildL(); //TODO |
117 SetListBoxModelL(); |
110 SetListBoxModelL(); |
118 CMemSpyViewBase::RefreshL(); |
111 CMemSpyViewBase::RefreshL(); |
119 } |
112 } |
120 |
113 |
121 |
114 |
122 TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const |
115 TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const |
123 { |
116 { |
124 TMemSpyViewType type = EMemSpyViewTypeNone; |
117 TMemSpyViewType type = EMemSpyViewTypeNone; |
125 // |
118 // |
126 switch( iInfoItem->Type() ) |
119 //switch( iInfoItem->Type() ) |
|
120 switch( iType ) |
127 { |
121 { |
128 case EMemSpyThreadInfoItemTypeHeap: |
122 case EMemSpyThreadInfoItemTypeHeap: |
129 type = EMemSpyViewTypeThreadInfoItemHeap; |
123 type = EMemSpyViewTypeThreadInfoItemHeap; |
130 break; |
124 break; |
131 case EMemSpyThreadInfoItemTypeStack: |
125 case EMemSpyThreadInfoItemTypeStack: |
194 case EMemSpyThreadInfoItemTypeOwnedProcessHandles: |
188 case EMemSpyThreadInfoItemTypeOwnedProcessHandles: |
195 type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles; |
189 type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles; |
196 break; |
190 break; |
197 |
191 |
198 default: |
192 default: |
199 __ASSERT_DEBUG( EFalse, User::Invariant() ); |
193 //__ASSERT_DEBUG( EFalse, User::Invariant() ); |
200 break; |
194 break; |
201 } |
195 } |
202 // |
196 // |
203 return type; |
197 return type; |
204 } |
198 } |
205 |
199 |
206 |
200 |
207 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL() |
201 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL() |
208 { |
202 { |
209 CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, Thread() ); |
203 CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iThreadId ); |
210 CleanupStack::PushL( parent ); |
204 CleanupStack::PushL( parent ); |
211 parent->ConstructL( Rect(), *Parent(), iInfoItem ); |
205 parent->ConstructL( Rect(), *Parent() ); //TODO: arguent removed: iInfoItem |
212 CleanupStack::Pop( parent ); |
206 CleanupStack::Pop( parent ); |
213 return parent; |
207 return parent; |
214 } |
208 } |
215 |
209 |
216 |
210 |
217 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL() |
211 CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL() |
218 { |
212 { |
219 __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); |
213 //__ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); |
220 CMemSpyViewBase* child = NULL; |
214 CMemSpyViewBase* child = NULL; |
221 // |
215 // |
222 return child; |
216 return child; |
223 } |
217 } |
224 |
218 |
230 } |
224 } |
231 |
225 |
232 |
226 |
233 void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL() |
227 void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL() |
234 { |
228 { |
|
229 iMemSpySession.GetThreadInfoItems( iThreadInfoItems, iThreadId, iType ); |
|
230 |
|
231 iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 ); |
|
232 |
|
233 for( TInt i=0; i<iThreadInfoItems.Count(); i++) |
|
234 { |
|
235 HBufC* iCombined = HBufC::NewL( iThreadInfoItems[i]->Caption().Length() + iThreadInfoItems[i]->Value().Length() + 30 ); |
|
236 /* |
|
237 else if ( iCombined->Des().MaxLength() < requiredLength ) |
|
238 { |
|
239 iCombined = iCombined->ReAllocL( requiredLength ); |
|
240 }*/ |
|
241 |
|
242 CleanupStack::PushL( iCombined ); |
|
243 |
|
244 TPtr pCombined( iCombined->Des() ); |
|
245 pCombined.Zero(); |
|
246 pCombined.Copy( _L("\t") ); |
|
247 if( iThreadInfoItems[i]->Caption() != KNullDesC ) |
|
248 pCombined.Append( iThreadInfoItems[i]->Caption() ); |
|
249 if( iType != EMemSpyThreadInfoItemTypeChunk ) |
|
250 { |
|
251 pCombined.Append( _L("\t\t") ); |
|
252 pCombined.Append( iThreadInfoItems[i]->Value() ); |
|
253 } |
|
254 |
|
255 iModel->AppendL( pCombined ); |
|
256 |
|
257 CleanupStack::PopAndDestroy( iCombined ); |
|
258 } |
|
259 |
235 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
260 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
236 listbox->Model()->SetItemTextArray( iInfoItem ); |
261 //listbox->Model()->SetItemTextArray( iInfoItem ); |
|
262 listbox->Model()->SetItemTextArray( iModel ); |
237 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
263 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
238 } |
264 } |
239 |
265 |
240 |
266 |
241 void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ ) |
267 void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ ) |
254 |
280 |
255 |
281 |
256 void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL() |
282 void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL() |
257 { |
283 { |
258 // Ugly, but I'm not adding an observer mechanism just for this wait dialog. |
284 // Ugly, but I'm not adding an observer mechanism just for this wait dialog. |
259 __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() ); |
285 // __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() ); |
260 iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow ); |
286 iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow ); |
261 iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod, |
287 iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod, |
262 KMemSpyConstructionCheckerTimerPeriod, |
288 KMemSpyConstructionCheckerTimerPeriod, |
263 TCallBack( CheckForItemConstructionComplete, this ) ); |
289 TCallBack( CheckForItemConstructionComplete, this ) ); |
264 |
290 |