51
|
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 |
{
|
53
|
59 |
iProcesses.ResetAndDestroy();
|
51
|
60 |
delete iMatcherBuffer;
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
//void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
|
|
65 |
void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune )
|
|
66 |
{
|
53
|
67 |
RArray<CMemSpyApiProcess*> processes;
|
|
68 |
iMemSpySession.GetProcessesL( processes ); // get processes array;
|
|
69 |
CleanupClosePushL( processes );
|
|
70 |
iProcesses.ResetAndDestroy();
|
|
71 |
for (TInt i=0; i<processes.Count(); i++)
|
|
72 |
{
|
|
73 |
iProcesses.Append(processes[i]);
|
|
74 |
}
|
|
75 |
CleanupStack::PopAndDestroy( &processes );
|
51
|
76 |
|
|
77 |
_LIT( KTitle, "Processes\n& Threads" );
|
|
78 |
SetTitleL( KTitle );
|
|
79 |
//
|
|
80 |
//CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
|
|
81 |
CMemSpyViewBase::ConstructL( aRect, aContainer );
|
|
82 |
//
|
|
83 |
iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards );
|
|
84 |
//
|
|
85 |
/* TODO: to restore the Search field functionality
|
|
86 |
iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength );
|
|
87 |
|
|
88 |
iSearchField->SetObserver( this );
|
|
89 |
iSearchField->SetFocus( ETrue );
|
|
90 |
iSearchField->SetComponentsToInheritVisibility( ETrue );
|
|
91 |
*/
|
|
92 |
//
|
|
93 |
if ( iCurrentProcessId > 0 )
|
|
94 |
{
|
|
95 |
TInt index = 0;
|
|
96 |
// TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune );
|
|
97 |
for( TInt i=0; i<iProcesses.Count();i++)
|
|
98 |
{
|
|
99 |
if( iProcesses[i]->Id() == iCurrentProcessId )
|
|
100 |
{
|
|
101 |
index = i;
|
|
102 |
}
|
|
103 |
}
|
|
104 |
|
|
105 |
if ( index >= 0 && index < iListBox->Model()->NumberOfItems() )
|
|
106 |
{
|
|
107 |
iListBox->SetCurrentItemIndex( index );
|
|
108 |
HandleListBoxItemSelectedL( index );
|
|
109 |
}
|
|
110 |
}
|
|
111 |
else if ( iProcesses.Count() > 0 )
|
|
112 |
{
|
|
113 |
iListBox->SetCurrentItemIndex( 0 );
|
|
114 |
HandleListBoxItemSelectedL( 0 );
|
|
115 |
}
|
|
116 |
//
|
|
117 |
SizeChanged();
|
|
118 |
ActivateL();
|
|
119 |
}
|
|
120 |
|
|
121 |
|
|
122 |
CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const
|
|
123 |
{
|
|
124 |
/*
|
|
125 |
__ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() );
|
|
126 |
return *iCurrentProcess;
|
|
127 |
*/
|
|
128 |
}
|
|
129 |
|
|
130 |
|
|
131 |
void CMemSpyViewProcesses::RefreshL()
|
|
132 |
{
|
|
133 |
SetListBoxModelL();
|
|
134 |
CMemSpyViewBase::RefreshL();
|
|
135 |
}
|
|
136 |
|
|
137 |
|
|
138 |
TMemSpyViewType CMemSpyViewProcesses::ViewType() const
|
|
139 |
{
|
|
140 |
return EMemSpyViewTypeProcesses;
|
|
141 |
}
|
|
142 |
|
|
143 |
|
|
144 |
CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL()
|
|
145 |
{
|
|
146 |
CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver );
|
|
147 |
CleanupStack::PushL( parent );
|
|
148 |
parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
|
|
149 |
CleanupStack::Pop( parent );
|
|
150 |
return parent;
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL()
|
|
155 |
{
|
|
156 |
CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 );
|
|
157 |
CleanupStack::PushL( child );
|
|
158 |
child->ConstructL( Rect(), *Parent() );
|
|
159 |
CleanupStack::Pop( child );
|
|
160 |
return child;
|
|
161 |
|
|
162 |
return 0;
|
|
163 |
}
|
|
164 |
|
|
165 |
|
|
166 |
void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
167 |
{
|
|
168 |
if ( aResourceId == MenuCascadeResourceId() )
|
|
169 |
{
|
|
170 |
TInt index = iListBox->CurrentItemIndex( );
|
|
171 |
const TBool hide = iProcesses[index]->IsDead() || iProcesses[index]->ThreadCount() == 0;
|
|
172 |
|
|
173 |
//aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); //to be added into API
|
|
174 |
aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide );
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand )
|
|
180 |
{
|
|
181 |
TBool handled = ETrue;
|
|
182 |
//
|
|
183 |
switch ( aCommand )
|
|
184 |
{
|
|
185 |
// Sorting
|
|
186 |
case EMemSpyCmdProcessSortById:
|
|
187 |
OnCmdSortByIdL();
|
|
188 |
break;
|
|
189 |
case EMemSpyCmdProcessSortByName:
|
|
190 |
OnCmdSortByNameL();
|
|
191 |
break;
|
|
192 |
case EMemSpyCmdProcessSortByThreadCount:
|
|
193 |
OnCmdSortByThreadCountL();
|
|
194 |
break;
|
|
195 |
case EMemSpyCmdProcessSortByCodeSegs:
|
|
196 |
OnCmdSortByCodeSegsL();
|
|
197 |
break;
|
|
198 |
case EMemSpyCmdProcessSortByHeapUsage:
|
|
199 |
OnCmdSortByHeapUsageL();
|
|
200 |
break;
|
|
201 |
case EMemSpyCmdProcessSortByStackUsage:
|
|
202 |
OnCmdSortByStackUsageL();
|
|
203 |
break;
|
|
204 |
// End
|
|
205 |
case EMemSpyCmdProcessEndTerminate:
|
|
206 |
OnCmdEndTerminateL();
|
|
207 |
break;
|
|
208 |
case EMemSpyCmdProcessEndKill:
|
|
209 |
OnCmdEndKillL();
|
|
210 |
break;
|
|
211 |
case EMemSpyCmdProcessEndPanic:
|
|
212 |
OnCmdEndPanicL();
|
|
213 |
break;
|
|
214 |
// Info
|
|
215 |
case EMemSpyCmdProcessInfoSummary:
|
|
216 |
OnCmdInfoSummaryL();
|
|
217 |
break;
|
|
218 |
case EMemSpyCmdProcessInfoHandles:
|
|
219 |
OnCmdInfoHandlesL();
|
|
220 |
break;
|
|
221 |
|
|
222 |
default:
|
|
223 |
handled = CMemSpyViewBase::HandleCommandL( aCommand );
|
|
224 |
break;
|
|
225 |
}
|
|
226 |
//
|
|
227 |
return handled;
|
|
228 |
}
|
|
229 |
|
|
230 |
|
|
231 |
void CMemSpyViewProcesses::OnCmdSortByIdL()
|
|
232 |
{
|
|
233 |
//iEngine.Container().SortById();
|
|
234 |
RefreshL();
|
|
235 |
}
|
|
236 |
|
|
237 |
|
|
238 |
void CMemSpyViewProcesses::OnCmdSortByNameL()
|
|
239 |
{
|
|
240 |
//iEngine.Container().SortByName();
|
|
241 |
RefreshL();
|
|
242 |
}
|
|
243 |
|
|
244 |
|
|
245 |
void CMemSpyViewProcesses::OnCmdSortByThreadCountL()
|
|
246 |
{
|
|
247 |
//iEngine.Container().SortByThreadCount();
|
|
248 |
RefreshL();
|
|
249 |
}
|
|
250 |
|
|
251 |
|
|
252 |
void CMemSpyViewProcesses::OnCmdSortByCodeSegsL()
|
|
253 |
{
|
|
254 |
//iEngine.Container().SortByCodeSegs();
|
|
255 |
RefreshL();
|
|
256 |
}
|
|
257 |
|
|
258 |
|
|
259 |
void CMemSpyViewProcesses::OnCmdSortByHeapUsageL()
|
|
260 |
{
|
|
261 |
//iEngine.Container().SortByHeapUsage();
|
|
262 |
RefreshL();
|
|
263 |
}
|
|
264 |
|
|
265 |
|
|
266 |
void CMemSpyViewProcesses::OnCmdSortByStackUsageL()
|
|
267 |
{
|
|
268 |
// iEngine.Container().SortByStackUsage();
|
|
269 |
RefreshL();
|
|
270 |
}
|
|
271 |
|
|
272 |
|
|
273 |
void CMemSpyViewProcesses::OnCmdInfoSummaryL()
|
|
274 |
{
|
|
275 |
//CMemSpyProcess& process = CurrentProcess();
|
|
276 |
//iEngine.HelperProcess().OutputProcessInfoL( process );
|
|
277 |
}
|
|
278 |
|
|
279 |
|
|
280 |
void CMemSpyViewProcesses::OnCmdInfoHandlesL()
|
|
281 |
{
|
|
282 |
/*
|
|
283 |
CMemSpyProcess& process = CurrentProcess();
|
|
284 |
//
|
|
285 |
const TInt threadCount = process.Count();
|
|
286 |
for( TInt i=0; i<threadCount; i++ )
|
|
287 |
{
|
|
288 |
CMemSpyThread& thread = process.At( i );
|
|
289 |
thread.InfoContainerForceSyncronousConstructionL().PrintL();
|
|
290 |
}
|
|
291 |
*/
|
|
292 |
}
|
|
293 |
|
|
294 |
|
|
295 |
void CMemSpyViewProcesses::OnCmdEndTerminateL()
|
|
296 |
{
|
|
297 |
TBool system = ETrue;
|
|
298 |
TBool doTerminate = ETrue;
|
|
299 |
TInt err = KErrNone;
|
|
300 |
|
|
301 |
iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
|
|
302 |
|
|
303 |
if ( system )
|
|
304 |
{
|
|
305 |
CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
|
|
306 |
doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
|
|
307 |
}
|
|
308 |
|
|
309 |
if ( doTerminate )
|
|
310 |
{
|
|
311 |
TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, ETerminate ) );
|
53
|
312 |
if( err == KErrNone )
|
51
|
313 |
RefreshL();
|
|
314 |
}
|
|
315 |
}
|
|
316 |
|
|
317 |
|
|
318 |
void CMemSpyViewProcesses::OnCmdEndPanicL()
|
|
319 |
{
|
|
320 |
TBool system = ETrue;
|
|
321 |
TBool doTerminate = ETrue;
|
|
322 |
TInt err = KErrNone;
|
|
323 |
|
|
324 |
iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
|
|
325 |
|
|
326 |
if ( system )
|
|
327 |
{
|
|
328 |
CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
|
|
329 |
doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
|
|
330 |
}
|
|
331 |
|
|
332 |
if ( doTerminate )
|
|
333 |
{
|
|
334 |
TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EPanic ) );
|
|
335 |
if( err == KErrNone )
|
|
336 |
RefreshL();
|
|
337 |
}
|
|
338 |
}
|
|
339 |
|
|
340 |
|
|
341 |
void CMemSpyViewProcesses::OnCmdEndKillL()
|
|
342 |
{
|
|
343 |
TBool system = ETrue;
|
|
344 |
TBool doTerminate = ETrue;
|
|
345 |
TInt err = KErrNone;
|
|
346 |
|
|
347 |
iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system );
|
|
348 |
|
|
349 |
if ( system )
|
|
350 |
{
|
|
351 |
CAknQueryDialog* importDialog = CAknQueryDialog::NewL();
|
|
352 |
doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) );
|
|
353 |
}
|
|
354 |
|
|
355 |
if ( doTerminate )
|
|
356 |
{
|
|
357 |
TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EKill ) )
|
|
358 |
if( err == KErrNone )
|
|
359 |
RefreshL();
|
|
360 |
}
|
|
361 |
}
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
void CMemSpyViewProcesses::SetListBoxModelL()
|
|
367 |
{
|
53
|
368 |
RArray<CMemSpyApiProcess*> processes;
|
|
369 |
iMemSpySession.GetProcessesL( processes ); // get processes array;
|
|
370 |
CleanupClosePushL( processes );
|
|
371 |
iProcesses.ResetAndDestroy();
|
|
372 |
for (TInt i=0; i<processes.Count(); i++)
|
|
373 |
{
|
|
374 |
iProcesses.Append( processes[i] );
|
|
375 |
}
|
|
376 |
|
|
377 |
CDesCArrayFlat* model = FormatModelLC( processes ); //TODO Format model method with advanced formatting
|
51
|
378 |
|
|
379 |
CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
|
53
|
380 |
listbox->Model()->SetItemTextArray( model );
|
|
381 |
listbox->Model()->SetOwnershipType( ELbmOwnsItemArray );
|
|
382 |
|
|
383 |
CleanupStack::Pop( model );
|
|
384 |
CleanupStack::PopAndDestroy( &processes );
|
51
|
385 |
}
|
|
386 |
|
|
387 |
|
|
388 |
void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ )
|
|
389 |
{
|
|
390 |
// Notify observer about an item being 'fired'
|
|
391 |
ReportEventL( MMemSpyViewObserver::EEventItemActioned );
|
|
392 |
}
|
|
393 |
|
|
394 |
|
|
395 |
void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex )
|
|
396 |
{
|
|
397 |
iCurrentProcessId = iProcesses[aIndex]->Id();
|
|
398 |
/*
|
|
399 |
if ( iCurrentProcess )
|
|
400 |
{
|
|
401 |
iCurrentProcess->Close();
|
|
402 |
}
|
|
403 |
|
|
404 |
// Obtain the process that corresponds to the selected item
|
|
405 |
CMemSpyEngineObjectContainer& container = iEngine.Container();
|
|
406 |
CMemSpyProcess& process = container.At( aIndex );
|
|
407 |
iCurrentProcess = &process;
|
|
408 |
|
|
409 |
// Notify observer about item selection
|
|
410 |
*/
|
|
411 |
ReportEventL( MMemSpyViewObserver::EEventItemSelected );
|
|
412 |
}
|
|
413 |
|
|
414 |
|
|
415 |
void CMemSpyViewProcesses::SizeChanged()
|
|
416 |
{
|
|
417 |
const TRect rect( Rect() );
|
|
418 |
CMemSpyViewBase::SizeChanged();
|
|
419 |
/*
|
|
420 |
if ( iListBox && iSearchField )
|
|
421 |
{
|
|
422 |
const TInt lafIndex_H = 1;
|
|
423 |
AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) );
|
|
424 |
AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() );
|
|
425 |
}
|
|
426 |
else
|
|
427 |
{
|
|
428 |
CMemSpyViewBase::SizeChanged();
|
|
429 |
}
|
|
430 |
*/
|
|
431 |
|
|
432 |
/*
|
|
433 |
// Search field
|
|
434 |
TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!?
|
|
435 |
searchFieldSize.SetWidth( rect.Width() );
|
|
436 |
const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize );
|
|
437 |
iSearchField->SetRect( searchFieldRect );
|
|
438 |
|
|
439 |
// Listbox
|
|
440 |
TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) );
|
|
441 |
iListBox->SetRect( rect.iTl, listBoxSize );
|
|
442 |
*/
|
|
443 |
}
|
|
444 |
|
|
445 |
|
|
446 |
TInt CMemSpyViewProcesses::CountComponentControls() const
|
|
447 |
{
|
|
448 |
TInt count = 0;
|
|
449 |
//
|
|
450 |
if ( iListBox != NULL )
|
|
451 |
{
|
|
452 |
++count;
|
|
453 |
}
|
|
454 |
/*if ( iSearchField != NULL )
|
|
455 |
{
|
|
456 |
++count;
|
|
457 |
}*/
|
|
458 |
//
|
|
459 |
return count;
|
|
460 |
}
|
|
461 |
|
|
462 |
|
|
463 |
CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const
|
|
464 |
{
|
|
465 |
CCoeControl* ret = iListBox;
|
|
466 |
//
|
|
467 |
if ( aIndex == 1 )
|
|
468 |
{
|
|
469 |
//ret = iSearchField;
|
|
470 |
}
|
|
471 |
//
|
|
472 |
return ret;
|
|
473 |
}
|
|
474 |
|
|
475 |
|
|
476 |
TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
|
|
477 |
{
|
|
478 |
TKeyResponse resp = EKeyWasNotConsumed;
|
|
479 |
//
|
|
480 |
if ( aType == EEventKey )
|
|
481 |
{
|
|
482 |
switch( aKeyEvent.iCode )
|
|
483 |
{
|
|
484 |
case EKeyUpArrow:
|
|
485 |
case EKeyDownArrow:
|
|
486 |
case EKeyEnter:
|
|
487 |
case EKeyOK:
|
|
488 |
if ( iListBox )
|
|
489 |
{
|
|
490 |
resp = iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
491 |
}
|
|
492 |
break;
|
|
493 |
default:
|
|
494 |
break;
|
|
495 |
}
|
|
496 |
//
|
|
497 |
if ( resp == EKeyWasNotConsumed )
|
|
498 |
{
|
|
499 |
// Do we need to show the find field?
|
|
500 |
//resp = iSearchField->OfferKeyEventL( aKeyEvent, aType );
|
|
501 |
}
|
|
502 |
}
|
|
503 |
//
|
|
504 |
return resp;
|
|
505 |
}
|
|
506 |
|
|
507 |
|
|
508 |
void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
|
|
509 |
{
|
|
510 |
CMemSpyViewBase::HandleControlEventL( aControl, aEventType );
|
|
511 |
//
|
|
512 |
if ( aEventType == MCoeControlObserver::EEventStateChanged )
|
|
513 |
{
|
|
514 |
/*
|
|
515 |
if ( aControl == iSearchField )
|
|
516 |
{
|
|
517 |
SelectListBoxItemByFindTextL();
|
|
518 |
}
|
|
519 |
*/
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
|
|
524 |
void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ )
|
|
525 |
{
|
|
526 |
if ( iListBox )
|
|
527 |
{
|
|
528 |
iListBox->SetFocus( IsFocused() );
|
|
529 |
}
|
|
530 |
/*if ( iSearchField )
|
|
531 |
{
|
|
532 |
iSearchField->SetFocus( IsFocused() );
|
|
533 |
}
|
|
534 |
*/
|
|
535 |
}
|
|
536 |
|
|
537 |
|
|
538 |
void CMemSpyViewProcesses::SelectListBoxItemByFindTextL()
|
|
539 |
{
|
|
540 |
/*
|
|
541 |
_LIT( KMemSpyWildcardCharacter, "*" );
|
|
542 |
|
|
543 |
TPtr pBuffer( iMatcherBuffer->Des() );
|
|
544 |
iSearchField->GetSearchText( pBuffer );
|
|
545 |
//pBuffer.Insert( 0, KMemSpyWildcardCharacter );
|
|
546 |
pBuffer.Append( KMemSpyWildcardCharacter );
|
|
547 |
|
|
548 |
CMemSpyEngineObjectContainer& container = iEngine.Container();
|
|
549 |
const TInt count = container.Count();
|
|
550 |
//
|
|
551 |
TInt index = 0;
|
|
552 |
while( index < count )
|
|
553 |
{
|
|
554 |
CMemSpyProcess& process = container.At( index );
|
|
555 |
const TPtrC processName( process.Name() );
|
|
556 |
//
|
|
557 |
if ( processName.MatchF( pBuffer ) >= 0 )
|
|
558 |
{
|
|
559 |
HandleListBoxItemSelectedL( index );
|
|
560 |
iListBox->ScrollToMakeItemVisible( index );
|
|
561 |
iListBox->SetCurrentItemIndexAndDraw( index );
|
|
562 |
return;
|
|
563 |
}
|
|
564 |
|
|
565 |
++index;
|
|
566 |
}
|
|
567 |
*/
|
|
568 |
}
|
|
569 |
|
|
570 |
//Model formating methods
|
|
571 |
//TODO: to be debbuged
|
|
572 |
|
53
|
573 |
CDesCArrayFlat* CMemSpyViewProcesses::FormatModelLC( const RArray<CMemSpyApiProcess*> &aProcesses )
|
51
|
574 |
{
|
53
|
575 |
CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items
|
|
576 |
CleanupStack::PushL( model );
|
|
577 |
|
51
|
578 |
_LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " );
|
|
579 |
|
|
580 |
for( TInt i=0; i < aProcesses.Count(); i++ )
|
|
581 |
{
|
|
582 |
HBufC* tempName = HBufC::NewL( KMaxFullName ); //aProcesses[i]->Name().Length() + 16
|
|
583 |
CleanupStack::PushL( tempName );
|
|
584 |
TPtr tempNamePtr( tempName->Des() );
|
|
585 |
tempNamePtr.Copy( aProcesses[i]->Name() );
|
|
586 |
|
|
587 |
TBuf<10> priority;
|
|
588 |
TProcessPriority tempPriority = aProcesses[i]->Priority();
|
|
589 |
MemSpyUiUtils::AppendPriority( priority, tempPriority );
|
|
590 |
|
|
591 |
// Convert the full name to the format we want in the UI
|
|
592 |
TBuf<KMaxFullName + 60> name;
|
|
593 |
TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there
|
|
594 |
TUint32 tempSID = aProcesses[i]->SID();
|
|
595 |
name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID ); //tempNamePtr
|
|
596 |
|
|
597 |
if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method
|
|
598 |
{
|
|
599 |
MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() );
|
|
600 |
}
|
|
601 |
else
|
|
602 |
{
|
|
603 |
_LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" );
|
|
604 |
name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority );
|
|
605 |
}
|
|
606 |
|
|
607 |
model->AppendL( name );
|
|
608 |
|
|
609 |
CleanupStack::PopAndDestroy( tempName );
|
|
610 |
}
|
|
611 |
|
|
612 |
return model;
|
|
613 |
}
|
|
614 |
|
|
615 |
|