89 return iForegroundAppUid; |
89 return iForegroundAppUid; |
90 } |
90 } |
91 void SessionInCriticalAllocation(TBool aPostponeMemGood, TUint aClientId) |
91 void SessionInCriticalAllocation(TBool aPostponeMemGood, TUint aClientId) |
92 { |
92 { |
93 FUNC_LOG; |
93 FUNC_LOG; |
|
94 TInt oldCount = iClientsRequestingMemory.Count(); |
|
95 |
94 if (aPostponeMemGood) |
96 if (aPostponeMemGood) |
95 { |
97 { |
96 iPostponeMemGood++; |
|
97 if(iClientsRequestingMemory.Find(aClientId) == KErrNotFound) |
98 if(iClientsRequestingMemory.Find(aClientId) == KErrNotFound) |
98 iClientsRequestingMemory.Append(aClientId); |
99 iClientsRequestingMemory.Append(aClientId); |
99 |
100 |
100 TRACES2("SessionInCriticalAllocation : STARTING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count()); |
101 TRACES2("SessionInCriticalAllocation : STARTING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count()); |
101 } |
102 } |
102 else |
103 else |
103 { |
104 { |
104 iPostponeMemGood--; |
|
105 TInt idx = iClientsRequestingMemory.Find(aClientId); |
105 TInt idx = iClientsRequestingMemory.Find(aClientId); |
106 if(idx != KErrNotFound) |
106 if(idx != KErrNotFound) |
107 { |
107 { |
108 iClientsRequestingMemory.Remove(idx); |
108 iClientsRequestingMemory.Remove(idx); |
109 TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count()); |
109 TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count()); |
110 } |
110 } |
111 |
|
112 if(iPostponeMemGood<0) |
|
113 { |
|
114 iPostponeMemGood = 0; |
|
115 } |
|
116 } |
111 } |
117 TRACES1("SessionInCriticalAllocation : ClientsRequestingMemory Count %d", iClientsRequestingMemory.Count()); |
112 TRACES1("SessionInCriticalAllocation : ClientsRequestingMemory Count %d", iClientsRequestingMemory.Count()); |
118 if (iClientsRequestingMemory.Count() == 0) |
113 if (oldCount && iClientsRequestingMemory.Count() == 0) |
119 { |
114 { |
120 DoPostponedMemoryGood(); |
115 DoPostponedMemoryGood(); |
121 } |
116 } |
122 |
117 |
123 } |
118 } |
124 |
119 |
125 void DoPostponedMemoryGood(); |
120 void DoPostponedMemoryGood(); |
126 |
121 |
127 TBool NeedToPostponeMemGood() |
122 TBool NeedToPostponeMemGood() |
128 { |
123 { |
129 //return (iPostponeMemGood != 0); |
|
130 return (iClientsRequestingMemory.Count() != 0); |
124 return (iClientsRequestingMemory.Count() != 0); |
131 } |
125 } |
132 |
126 |
133 void WaitAndSynchroniseMemoryState(); |
127 void WaitAndSynchroniseMemoryState(); |
134 void SynchroniseMemoryState(); |
128 void SynchroniseMemoryState(); |
199 // could use pointer array |
193 // could use pointer array |
200 CGoomThresholdCrossed* iMemAllocationsGrowing; |
194 CGoomThresholdCrossed* iMemAllocationsGrowing; |
201 CGoomThresholdCrossed* iMemAllocationsGoingDown; |
195 CGoomThresholdCrossed* iMemAllocationsGoingDown; |
202 |
196 |
203 TInt iForegroundAppUid; |
197 TInt iForegroundAppUid; |
204 TInt iPostponeMemGood; |
|
205 |
198 |
206 RArray<TUint> iClientsRequestingMemory; |
199 RArray<TUint> iClientsRequestingMemory; |
207 |
200 |
208 TGOomTrigger iTrigger; |
201 TGOomTrigger iTrigger; |
209 |
202 |