|
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 "MemSpyViewKernel.h" |
|
19 |
|
20 // System includes |
|
21 #include <hal.h> |
|
22 #ifdef __EPOC32__ |
|
23 #include <e32rom.h> |
|
24 #endif |
|
25 |
|
26 // Engine includes |
|
27 #include <memspy/engine/memspyengine.h> |
|
28 #include <memspy/engine/memspyengineobjectprocess.h> |
|
29 #include <memspy/engine/memspyengineobjectthread.h> |
|
30 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
31 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
32 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
33 |
|
34 // User includes |
|
35 #include "MemSpyUiUtils.h" |
|
36 #include "MemSpyViewMainMenu.h" |
|
37 #include "MemSpyContainerObserver.h" |
|
38 #include "MemSpyViewKernelHeap.h" |
|
39 #include "MemSpyViewKernelContainers.h" |
|
40 |
|
41 |
|
42 |
|
43 CMemSpyViewKernel::CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) |
|
44 : CMemSpyViewBase( aEngine, aObserver ) |
|
45 { |
|
46 } |
|
47 |
|
48 |
|
49 CMemSpyViewKernel::~CMemSpyViewKernel() |
|
50 { |
|
51 } |
|
52 |
|
53 |
|
54 void CMemSpyViewKernel::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
55 { |
|
56 _LIT( KTitle, "Kernel" ); |
|
57 SetTitleL( KTitle ); |
|
58 // |
|
59 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
60 |
|
61 // Make sure the correct item is selected |
|
62 const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); |
|
63 const TInt index = IndexByViewType( viewType ); |
|
64 iListBox->SetCurrentItemIndex( index ); |
|
65 HandleListBoxItemSelectedL( index ); |
|
66 } |
|
67 |
|
68 |
|
69 void CMemSpyViewKernel::RefreshL() |
|
70 { |
|
71 SetListBoxModelL(); |
|
72 CMemSpyViewBase::RefreshL(); |
|
73 } |
|
74 |
|
75 |
|
76 TMemSpyViewType CMemSpyViewKernel::ViewType() const |
|
77 { |
|
78 return EMemSpyViewTypeKernel; |
|
79 } |
|
80 |
|
81 |
|
82 CMemSpyViewBase* CMemSpyViewKernel::PrepareParentViewL() |
|
83 { |
|
84 CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); |
|
85 CleanupStack::PushL( parent ); |
|
86 parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); |
|
87 CleanupStack::Pop( parent ); |
|
88 return parent; |
|
89 } |
|
90 |
|
91 |
|
92 CMemSpyViewBase* CMemSpyViewKernel::PrepareChildViewL() |
|
93 { |
|
94 CMemSpyViewBase* child = NULL; |
|
95 const TInt index = iListBox->CurrentItemIndex(); |
|
96 // |
|
97 if ( index == 0 ) |
|
98 { |
|
99 child = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver ); |
|
100 } |
|
101 else if ( index == 1 ) |
|
102 { |
|
103 child = new(ELeave) CMemSpyViewKernelHeap( iEngine, iObserver ); |
|
104 } |
|
105 |
|
106 CleanupStack::PushL( child ); |
|
107 child->ConstructL( Rect(), *Parent() ); |
|
108 CleanupStack::Pop( child ); |
|
109 return child; |
|
110 } |
|
111 |
|
112 |
|
113 void CMemSpyViewKernel::SetListBoxModelL() |
|
114 { |
|
115 CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); |
|
116 CleanupStack::PushL( model ); |
|
117 |
|
118 TBuf<KMaxFullName + 1> item; |
|
119 |
|
120 // 1st item = Processes |
|
121 _LIT( KItem1Format, "\tObjects" ); |
|
122 item.Format( KItem1Format ); |
|
123 model->AppendL( item ); |
|
124 |
|
125 // 2nd item = System Config |
|
126 _LIT( KItem2Format, "\tHeap" ); |
|
127 model->AppendL( KItem2Format ); |
|
128 |
|
129 // Set up list box |
|
130 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
131 listbox->Model()->SetItemTextArray( model ); |
|
132 listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
133 CleanupStack::Pop( model ); |
|
134 } |
|
135 |
|
136 |
|
137 TInt CMemSpyViewKernel::IndexByViewType( TMemSpyViewType aType ) |
|
138 { |
|
139 TInt index = 0; |
|
140 // |
|
141 switch( aType ) |
|
142 { |
|
143 default: |
|
144 case EMemSpyViewTypeKernelContainers: |
|
145 index = 0; |
|
146 break; |
|
147 case EMemSpyViewTypeKernelHeap: |
|
148 index = 1; |
|
149 break; |
|
150 } |
|
151 // |
|
152 return index; |
|
153 } |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |