|
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 "MemSpyViewProcesses.h" |
|
19 |
|
20 // System includes |
|
21 #include <aknsfld.h> |
|
22 #include <AknQueryDialog.h> |
|
23 #include <memspyui.rsg> |
|
24 |
|
25 // Engine includes |
|
26 #include <memspy/engine/memspyengine.h> |
|
27 #include <memspy/engine/memspyengineobjectprocess.h> |
|
28 #include <memspy/engine/memspyengineobjectthread.h> |
|
29 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
30 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
31 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
32 #include <memspy/engine/memspyenginehelperprocess.h> |
|
33 #include <memspysession.h> |
|
34 #include <memspy/engine/memspyengineutils.h> |
|
35 |
|
36 // User includes |
|
37 #include "MemSpyViewThreads.h" |
|
38 #include "MemSpyViewMainMenu.h" |
|
39 #include "MemSpyContainerObserver.h" |
|
40 #include "MemSpyUiUtils.h" |
|
41 |
|
42 // Constants |
|
43 const TInt KMemSpyMaxSearchTextLength = 30; |
|
44 const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4; |
|
45 |
|
46 |
|
47 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) |
|
48 : CMemSpyViewBase( aSession, aObserver ) |
|
49 { |
|
50 } |
|
51 |
|
52 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId ) |
|
53 : CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId ) |
|
54 { |
|
55 } |
|
56 |
|
57 CMemSpyViewProcesses::~CMemSpyViewProcesses() |
|
58 { |
|
59 iProcesses.Close(); |
|
60 delete iSearchField; |
|
61 delete iMatcherBuffer; |
|
62 } |
|
63 |
|
64 |
|
65 //void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
66 void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune ) |
|
67 { |
|
68 iMemSpySession.GetProcessesL(iProcesses); // get processes array; |
|
69 |
|
70 _LIT( KTitle, "Processes\n& Threads" ); |
|
71 SetTitleL( KTitle ); |
|
72 // |
|
73 //CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
74 CMemSpyViewBase::ConstructL( aRect, aContainer ); |
|
75 // |
|
76 iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards ); |
|
77 // |
|
78 iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength ); |
|
79 |
|
80 iSearchField->SetObserver( this ); |
|
81 iSearchField->SetFocus( ETrue ); |
|
82 iSearchField->SetComponentsToInheritVisibility( ETrue ); |
|
83 // |
|
84 if ( iCurrentProcessId > 0 ) |
|
85 { |
|
86 TInt index = 0; |
|
87 // TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune ); |
|
88 for( TInt i=0; i<iProcesses.Count();i++) |
|
89 { |
|
90 if( iProcesses[i]->Id() == iCurrentProcessId ) |
|
91 { |
|
92 index = i; |
|
93 } |
|
94 } |
|
95 |
|
96 if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) |
|
97 { |
|
98 iListBox->SetCurrentItemIndex( index ); |
|
99 HandleListBoxItemSelectedL( index ); |
|
100 } |
|
101 } |
|
102 else if ( iProcesses.Count() > 0 ) |
|
103 { |
|
104 iListBox->SetCurrentItemIndex( 0 ); |
|
105 HandleListBoxItemSelectedL( 0 ); |
|
106 } |
|
107 // |
|
108 SizeChanged(); |
|
109 ActivateL(); |
|
110 } |
|
111 |
|
112 |
|
113 CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const |
|
114 { |
|
115 /* |
|
116 __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() ); |
|
117 return *iCurrentProcess; |
|
118 */ |
|
119 } |
|
120 |
|
121 |
|
122 void CMemSpyViewProcesses::RefreshL() |
|
123 { |
|
124 SetListBoxModelL(); |
|
125 CMemSpyViewBase::RefreshL(); |
|
126 } |
|
127 |
|
128 |
|
129 TMemSpyViewType CMemSpyViewProcesses::ViewType() const |
|
130 { |
|
131 return EMemSpyViewTypeProcesses; |
|
132 } |
|
133 |
|
134 |
|
135 CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL() |
|
136 { |
|
137 CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver ); |
|
138 CleanupStack::PushL( parent ); |
|
139 parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); |
|
140 CleanupStack::Pop( parent ); |
|
141 return parent; |
|
142 } |
|
143 |
|
144 |
|
145 CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL() |
|
146 { |
|
147 CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 ); |
|
148 CleanupStack::PushL( child ); |
|
149 child->ConstructL( Rect(), *Parent() ); |
|
150 CleanupStack::Pop( child ); |
|
151 return child; |
|
152 |
|
153 return 0; |
|
154 } |
|
155 |
|
156 |
|
157 void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
158 { |
|
159 if ( aResourceId == MenuCascadeResourceId() ) |
|
160 { |
|
161 CMemSpyProcess& process = CurrentProcess(); |
|
162 //const TBool hide = ( iEngine.Container().Count() == 0 ) || process.IsDead(); //TODO |
|
163 // |
|
164 const TBool hide = EFalse; //to replace |
|
165 |
|
166 aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); |
|
167 aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide ); |
|
168 } |
|
169 } |
|
170 |
|
171 |
|
172 TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand ) |
|
173 { |
|
174 TBool handled = ETrue; |
|
175 // |
|
176 switch ( aCommand ) |
|
177 { |
|
178 // Sorting |
|
179 case EMemSpyCmdProcessSortById: |
|
180 OnCmdSortByIdL(); |
|
181 break; |
|
182 case EMemSpyCmdProcessSortByName: |
|
183 OnCmdSortByNameL(); |
|
184 break; |
|
185 case EMemSpyCmdProcessSortByThreadCount: |
|
186 OnCmdSortByThreadCountL(); |
|
187 break; |
|
188 case EMemSpyCmdProcessSortByCodeSegs: |
|
189 OnCmdSortByCodeSegsL(); |
|
190 break; |
|
191 case EMemSpyCmdProcessSortByHeapUsage: |
|
192 OnCmdSortByHeapUsageL(); |
|
193 break; |
|
194 case EMemSpyCmdProcessSortByStackUsage: |
|
195 OnCmdSortByStackUsageL(); |
|
196 break; |
|
197 // End |
|
198 case EMemSpyCmdProcessEndTerminate: |
|
199 OnCmdEndTerminateL(); |
|
200 break; |
|
201 case EMemSpyCmdProcessEndKill: |
|
202 OnCmdEndKillL(); |
|
203 break; |
|
204 case EMemSpyCmdProcessEndPanic: |
|
205 OnCmdEndPanicL(); |
|
206 break; |
|
207 // Info |
|
208 case EMemSpyCmdProcessInfoSummary: |
|
209 OnCmdInfoSummaryL(); |
|
210 break; |
|
211 case EMemSpyCmdProcessInfoHandles: |
|
212 OnCmdInfoHandlesL(); |
|
213 break; |
|
214 |
|
215 default: |
|
216 handled = CMemSpyViewBase::HandleCommandL( aCommand ); |
|
217 break; |
|
218 } |
|
219 // |
|
220 return handled; |
|
221 } |
|
222 |
|
223 |
|
224 void CMemSpyViewProcesses::OnCmdSortByIdL() |
|
225 { |
|
226 //iEngine.Container().SortById(); |
|
227 RefreshL(); |
|
228 } |
|
229 |
|
230 |
|
231 void CMemSpyViewProcesses::OnCmdSortByNameL() |
|
232 { |
|
233 //iEngine.Container().SortByName(); |
|
234 RefreshL(); |
|
235 } |
|
236 |
|
237 |
|
238 void CMemSpyViewProcesses::OnCmdSortByThreadCountL() |
|
239 { |
|
240 //iEngine.Container().SortByThreadCount(); |
|
241 RefreshL(); |
|
242 } |
|
243 |
|
244 |
|
245 void CMemSpyViewProcesses::OnCmdSortByCodeSegsL() |
|
246 { |
|
247 //iEngine.Container().SortByCodeSegs(); |
|
248 RefreshL(); |
|
249 } |
|
250 |
|
251 |
|
252 void CMemSpyViewProcesses::OnCmdSortByHeapUsageL() |
|
253 { |
|
254 //iEngine.Container().SortByHeapUsage(); |
|
255 RefreshL(); |
|
256 } |
|
257 |
|
258 |
|
259 void CMemSpyViewProcesses::OnCmdSortByStackUsageL() |
|
260 { |
|
261 // iEngine.Container().SortByStackUsage(); |
|
262 RefreshL(); |
|
263 } |
|
264 |
|
265 |
|
266 void CMemSpyViewProcesses::OnCmdInfoSummaryL() |
|
267 { |
|
268 //CMemSpyProcess& process = CurrentProcess(); |
|
269 //iEngine.HelperProcess().OutputProcessInfoL( process ); |
|
270 } |
|
271 |
|
272 |
|
273 void CMemSpyViewProcesses::OnCmdInfoHandlesL() |
|
274 { |
|
275 /* |
|
276 CMemSpyProcess& process = CurrentProcess(); |
|
277 // |
|
278 const TInt threadCount = process.Count(); |
|
279 for( TInt i=0; i<threadCount; i++ ) |
|
280 { |
|
281 CMemSpyThread& thread = process.At( i ); |
|
282 thread.InfoContainerForceSyncronousConstructionL().PrintL(); |
|
283 } |
|
284 */ |
|
285 } |
|
286 |
|
287 |
|
288 void CMemSpyViewProcesses::OnCmdEndTerminateL() |
|
289 { |
|
290 /* |
|
291 TBool doTerminate = ETrue; |
|
292 CMemSpyProcess& process = CurrentProcess(); |
|
293 // |
|
294 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
|
295 { |
|
296 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
|
297 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
|
298 } |
|
299 // |
|
300 if ( doTerminate ) |
|
301 { |
|
302 process.TerminateL(); |
|
303 RefreshL(); |
|
304 } |
|
305 */ |
|
306 } |
|
307 |
|
308 |
|
309 void CMemSpyViewProcesses::OnCmdEndPanicL() |
|
310 {/* |
|
311 TBool doTerminate = ETrue; |
|
312 CMemSpyProcess& process = CurrentProcess(); |
|
313 // |
|
314 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
|
315 { |
|
316 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
|
317 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
|
318 } |
|
319 // |
|
320 if ( doTerminate ) |
|
321 { |
|
322 process.PanicL(); |
|
323 RefreshL(); |
|
324 } |
|
325 */ |
|
326 } |
|
327 |
|
328 |
|
329 void CMemSpyViewProcesses::OnCmdEndKillL() |
|
330 {/* |
|
331 TBool doTerminate = ETrue; |
|
332 CMemSpyProcess& process = CurrentProcess(); |
|
333 // |
|
334 if ( process.IsSystemPermanent() || process.IsSystemCritical() ) |
|
335 { |
|
336 CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); |
|
337 doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); |
|
338 } |
|
339 // |
|
340 if ( doTerminate ) |
|
341 { |
|
342 process.KillL(); |
|
343 RefreshL(); |
|
344 } |
|
345 */ |
|
346 } |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 void CMemSpyViewProcesses::SetListBoxModelL() |
|
352 { |
|
353 if( iProcesses.Count() > 0 ) |
|
354 { |
|
355 iProcesses.Close(); |
|
356 } |
|
357 |
|
358 iMemSpySession.GetProcessesL(iProcesses); // get processes array; |
|
359 iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items |
|
360 |
|
361 _LIT( KTab, "\t" ); |
|
362 iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting |
|
363 |
|
364 /* |
|
365 for( TInt i=0; i < iProcesses.Count(); i++ ) |
|
366 { |
|
367 HBufC* tempName = HBufC::NewL( iProcesses[i]->Name().Length() + 16 ); |
|
368 CleanupStack::PushL( tempName ); |
|
369 TPtr tempNamePtr( tempName->Des() ); |
|
370 tempNamePtr.Copy( KTab ); |
|
371 tempNamePtr.Append( iProcesses[i]->Name() ); |
|
372 iModel->AppendL( tempNamePtr ); |
|
373 |
|
374 CleanupStack::PopAndDestroy( tempName ); |
|
375 } |
|
376 */ |
|
377 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
378 //listbox->Model()->SetItemTextArray( &iEngine.Container() ); |
|
379 listbox->Model()->SetItemTextArray( iModel ); |
|
380 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
381 } |
|
382 |
|
383 |
|
384 void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ ) |
|
385 { |
|
386 // Notify observer about an item being 'fired' |
|
387 ReportEventL( MMemSpyViewObserver::EEventItemActioned ); |
|
388 } |
|
389 |
|
390 |
|
391 void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex ) |
|
392 {/* |
|
393 if ( iCurrentProcess ) |
|
394 { |
|
395 iCurrentProcess->Close(); |
|
396 } |
|
397 |
|
398 // Obtain the process that corresponds to the selected item |
|
399 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
|
400 CMemSpyProcess& process = container.At( aIndex ); |
|
401 iCurrentProcess = &process; |
|
402 iCurrentProcess->Open(); |
|
403 |
|
404 // Notify observer about item selection |
|
405 ReportEventL( MMemSpyViewObserver::EEventItemSelected );*/ |
|
406 } |
|
407 |
|
408 |
|
409 void CMemSpyViewProcesses::SizeChanged() |
|
410 { |
|
411 const TRect rect( Rect() ); |
|
412 |
|
413 if ( iListBox && iSearchField ) |
|
414 { |
|
415 const TInt lafIndex_H = 1; |
|
416 AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) ); |
|
417 AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() ); |
|
418 } |
|
419 else |
|
420 { |
|
421 CMemSpyViewBase::SizeChanged(); |
|
422 } |
|
423 |
|
424 /* |
|
425 // Search field |
|
426 TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!? |
|
427 searchFieldSize.SetWidth( rect.Width() ); |
|
428 const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize ); |
|
429 iSearchField->SetRect( searchFieldRect ); |
|
430 |
|
431 // Listbox |
|
432 TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) ); |
|
433 iListBox->SetRect( rect.iTl, listBoxSize ); |
|
434 */ |
|
435 } |
|
436 |
|
437 |
|
438 TInt CMemSpyViewProcesses::CountComponentControls() const |
|
439 { |
|
440 TInt count = 0; |
|
441 // |
|
442 if ( iListBox != NULL ) |
|
443 { |
|
444 ++count; |
|
445 } |
|
446 if ( iSearchField != NULL ) |
|
447 { |
|
448 ++count; |
|
449 } |
|
450 // |
|
451 return count; |
|
452 } |
|
453 |
|
454 |
|
455 CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const |
|
456 { |
|
457 CCoeControl* ret = iListBox; |
|
458 // |
|
459 if ( aIndex == 1 ) |
|
460 { |
|
461 ret = iSearchField; |
|
462 } |
|
463 // |
|
464 return ret; |
|
465 } |
|
466 |
|
467 |
|
468 TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
469 { |
|
470 TKeyResponse resp = EKeyWasNotConsumed; |
|
471 // |
|
472 if ( aType == EEventKey ) |
|
473 { |
|
474 switch( aKeyEvent.iCode ) |
|
475 { |
|
476 case EKeyUpArrow: |
|
477 case EKeyDownArrow: |
|
478 case EKeyEnter: |
|
479 case EKeyOK: |
|
480 if ( iListBox ) |
|
481 { |
|
482 resp = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
483 } |
|
484 break; |
|
485 default: |
|
486 break; |
|
487 } |
|
488 // |
|
489 if ( resp == EKeyWasNotConsumed ) |
|
490 { |
|
491 // Do we need to show the find field? |
|
492 resp = iSearchField->OfferKeyEventL( aKeyEvent, aType ); |
|
493 } |
|
494 } |
|
495 // |
|
496 return resp; |
|
497 } |
|
498 |
|
499 |
|
500 void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
|
501 { |
|
502 CMemSpyViewBase::HandleControlEventL( aControl, aEventType ); |
|
503 // |
|
504 if ( aEventType == MCoeControlObserver::EEventStateChanged ) |
|
505 { |
|
506 if ( aControl == iSearchField ) |
|
507 { |
|
508 SelectListBoxItemByFindTextL(); |
|
509 } |
|
510 } |
|
511 } |
|
512 |
|
513 |
|
514 void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ ) |
|
515 { |
|
516 if ( iListBox ) |
|
517 { |
|
518 iListBox->SetFocus( IsFocused() ); |
|
519 } |
|
520 if ( iSearchField ) |
|
521 { |
|
522 iSearchField->SetFocus( IsFocused() ); |
|
523 } |
|
524 } |
|
525 |
|
526 |
|
527 void CMemSpyViewProcesses::SelectListBoxItemByFindTextL() |
|
528 { |
|
529 /* |
|
530 _LIT( KMemSpyWildcardCharacter, "*" ); |
|
531 |
|
532 TPtr pBuffer( iMatcherBuffer->Des() ); |
|
533 iSearchField->GetSearchText( pBuffer ); |
|
534 //pBuffer.Insert( 0, KMemSpyWildcardCharacter ); |
|
535 pBuffer.Append( KMemSpyWildcardCharacter ); |
|
536 |
|
537 CMemSpyEngineObjectContainer& container = iEngine.Container(); |
|
538 const TInt count = container.Count(); |
|
539 // |
|
540 TInt index = 0; |
|
541 while( index < count ) |
|
542 { |
|
543 CMemSpyProcess& process = container.At( index ); |
|
544 const TPtrC processName( process.Name() ); |
|
545 // |
|
546 if ( processName.MatchF( pBuffer ) >= 0 ) |
|
547 { |
|
548 HandleListBoxItemSelectedL( index ); |
|
549 iListBox->ScrollToMakeItemVisible( index ); |
|
550 iListBox->SetCurrentItemIndexAndDraw( index ); |
|
551 return; |
|
552 } |
|
553 |
|
554 ++index; |
|
555 } |
|
556 */ |
|
557 } |
|
558 |
|
559 //Model formating methods |
|
560 //TODO: to be debbuged |
|
561 |
|
562 CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses ) |
|
563 { |
|
564 model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items |
|
565 _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " ); |
|
566 |
|
567 for( TInt i=0; i < aProcesses.Count(); i++ ) |
|
568 { |
|
569 HBufC* tempName = HBufC::NewL( KMaxFullName ); //aProcesses[i]->Name().Length() + 16 |
|
570 CleanupStack::PushL( tempName ); |
|
571 TPtr tempNamePtr( tempName->Des() ); |
|
572 tempNamePtr.Copy( aProcesses[i]->Name() ); |
|
573 |
|
574 TBuf<10> priority; |
|
575 TProcessPriority tempPriority = aProcesses[i]->Priority(); |
|
576 MemSpyUiUtils::AppendPriority( priority, tempPriority ); |
|
577 |
|
578 // Convert the full name to the format we want in the UI |
|
579 TBuf<KMaxFullName + 60> name; |
|
580 TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there |
|
581 TUint32 tempSID = aProcesses[i]->SID(); |
|
582 name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID ); //tempNamePtr |
|
583 |
|
584 if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method |
|
585 { |
|
586 MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() ); |
|
587 } |
|
588 else |
|
589 { |
|
590 _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" ); |
|
591 name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority ); |
|
592 } |
|
593 |
|
594 model->AppendL( name ); |
|
595 |
|
596 CleanupStack::PopAndDestroy( tempName ); |
|
597 } |
|
598 |
|
599 return model; |
|
600 } |
|
601 /* |
|
602 void CMemSpyViewProcesses::AppendPriority( TDes& aDes, TProcessPriority aPriority ) |
|
603 { |
|
604 switch( aPriority ) |
|
605 { |
|
606 case EPriorityLow: |
|
607 aDes += _L("[L]"); |
|
608 break; |
|
609 case EPriorityBackground: |
|
610 aDes += _L("[B]"); |
|
611 break; |
|
612 case EPriorityForeground: |
|
613 aDes += _L("[F]"); |
|
614 break; |
|
615 case EPriorityHigh: |
|
616 aDes += _L("[H]"); |
|
617 break; |
|
618 case EPriorityWindowServer: |
|
619 aDes += _L("[WS]"); |
|
620 break; |
|
621 case EPriorityFileServer: |
|
622 aDes += _L("[FS]"); |
|
623 break; |
|
624 case EPriorityRealTimeServer: |
|
625 aDes += _L("[RTS]"); |
|
626 break; |
|
627 case EPrioritySupervisor: |
|
628 aDes += _L("[SUP]"); |
|
629 break; |
|
630 default: |
|
631 aDes += _L("[?]"); |
|
632 break; |
|
633 } |
|
634 } |
|
635 |
|
636 void CMemSpyViewProcesses::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory ) |
|
637 { |
|
638 aDes.Append( '[' ); |
|
639 const TInt length = aDes.Length(); |
|
640 AppendExitType( aDes, aType ); |
|
641 aDes.SetLength( length + 1 ); // Remove all but the first letter |
|
642 aDes.Append( ']' ); |
|
643 |
|
644 if ( aType == EExitKill || aType == EExitPending ) |
|
645 { |
|
646 // Kill implies "clean" exit. Pending implies not yet dead. |
|
647 } |
|
648 else |
|
649 { |
|
650 TMemSpyTruncateOverflow overflow; |
|
651 |
|
652 // Terminate or Panic implies abnormal exit condition, so |
|
653 // show full exit info. |
|
654 _LIT( KAbnormalFormatSpec, " %S-%d" ); |
|
655 aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason ); |
|
656 } |
|
657 } |
|
658 */ |
|
659 /* |
|
660 void CMemSpyViewProcesses::AppendExitType( TDes& aDes, TExitType aType ) |
|
661 { |
|
662 _LIT( KExitTypeKilled, "Killed" ); |
|
663 _LIT( KExitTypeTerminated, "Terminated" ); |
|
664 _LIT( KExitTypePanicked, "Panicked" ); |
|
665 _LIT( KExitTypePending, "Pending" ); |
|
666 |
|
667 // Panic and Terminate are exceptional exit conditions. |
|
668 // Kill, is ironically, not an exceptional condition. |
|
669 switch( aType ) |
|
670 { |
|
671 case EExitKill: |
|
672 aDes += KExitTypeKilled; |
|
673 break; |
|
674 case EExitTerminate: |
|
675 aDes += KExitTypeTerminated; |
|
676 break; |
|
677 case EExitPanic: |
|
678 aDes += KExitTypePanicked; |
|
679 break; |
|
680 default: |
|
681 case EExitPending: |
|
682 aDes += KExitTypePending; |
|
683 break; |
|
684 } |
|
685 } |
|
686 */ |
|
687 |