equal
deleted
inserted
replaced
203 void CMemoryMonitor::FreeMemThresholdCrossedL(TInt /*aAction*/, TInt aThreshold) |
203 void CMemoryMonitor::FreeMemThresholdCrossedL(TInt /*aAction*/, TInt aThreshold) |
204 { |
204 { |
205 FUNC_LOG; |
205 FUNC_LOG; |
206 // keep only one notification active at a moment |
206 // keep only one notification active at a moment |
207 #ifdef USE_ASYNCYH_NOTIFICATIONS |
207 #ifdef USE_ASYNCYH_NOTIFICATIONS |
208 TInt current = GetFreeMemory(); |
208 |
209 if (aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK) |
209 if (aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK) |
210 { |
210 { |
|
211 TInt current = GetFreeMemory(); |
211 if(current >= iGoodThreshold && (!NeedToPostponeMemGood())) |
212 if(current >= iGoodThreshold && (!NeedToPostponeMemGood())) |
212 { |
213 { |
213 TRACES2("FreeMemThresholdCrossedL : crossed good threshold Free %d, GThresh %d, Calling MemoryGood",current, iGoodThreshold); |
214 TRACES2("FreeMemThresholdCrossedL : crossed good threshold Free %d, GThresh %d, Calling MemoryGood",current, iGoodThreshold); |
214 iGOomActionList->MemoryGood(); |
215 iGOomActionList->MemoryGood(); |
215 iMemAllocationsGrowing->Continue(); |
216 iMemAllocationsGrowing->Continue(); |
227 iMemAllocationsGoingDown->Continue(); |
228 iMemAllocationsGoingDown->Continue(); |
228 } |
229 } |
229 } |
230 } |
230 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
231 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
231 { |
232 { |
232 if(current < iLowThreshold) |
233 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
233 { |
234 iMemAllocationsGrowing->Stop(); |
234 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
235 iMemAllocationsGoingDown->Continue(); |
235 iMemAllocationsGrowing->Stop(); |
236 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood()) |
236 iMemAllocationsGoingDown->Continue(); |
237 { |
237 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood()) |
238 if(iSynchTimer->IsActive()) |
238 { |
239 iSynchTimer->Cancel(); |
239 if(iSynchTimer->IsActive()) |
240 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
240 iSynchTimer->Cancel(); |
241 } |
241 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
|
242 } |
|
243 } |
|
244 else |
|
245 TRACES2("FreeMemThresholdCrossedL : crossed low threshold %d, FALSE ALARM, FreeMem = %d", iLowThreshold, current); |
|
246 } |
242 } |
247 #endif |
243 #endif |
248 } |
244 } |
249 |
245 |
250 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
246 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
337 |
333 |
338 iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) |
334 iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) |
339 // Run the memory freeing actions |
335 // Run the memory freeing actions |
340 iGOomActionList->FreeMemory(aMaxPriority); |
336 iGOomActionList->FreeMemory(aMaxPriority); |
341 |
337 |
342 SwitchMemMode(EGOomLowMemMode); |
|
343 } |
338 } |
344 |
339 |
345 void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode) |
340 void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode) |
346 { |
341 { |
347 if(iMemMode == aMemMode) |
342 if(iMemMode == aMemMode) |
|
343 { |
|
344 if(iMemMode == EGOomGoodMemMode) |
|
345 { |
|
346 TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in GOOD Mode"); |
|
347 } |
|
348 else |
|
349 { |
|
350 TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in LOW Mode"); |
|
351 } |
348 return; |
352 return; |
|
353 } |
349 |
354 |
350 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
355 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
351 TWsEvent event; |
356 TWsEvent event; |
352 |
357 |
353 if(aMemMode == EGOomLowMemMode) |
358 if(aMemMode == EGOomLowMemMode) |
358 return; |
363 return; |
359 |
364 |
360 iLowOnMemWgs.Reset(); |
365 iLowOnMemWgs.Reset(); |
361 iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs); |
366 iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs); |
362 event.SetType(KGoomMemoryLowEvent); |
367 event.SetType(KGoomMemoryLowEvent); |
|
368 TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to SW, Sending KGoomMemoryLowEvent"); |
363 } |
369 } |
364 else |
370 else |
365 { |
371 { |
366 if(iRendswitched > 0) |
372 if(iRendswitched > 0) |
367 { |
373 { |
368 if(iRendswitched < 3) |
374 if(iRendswitched < 3) |
369 iRendswitched ++; |
375 iRendswitched ++; |
370 else |
376 else |
|
377 { |
|
378 TRACES("CMemoryMonitor::SwitchMemMode GOOM Detected SW-HW-SW looping. NOT switching to HW rendering mode"); |
371 return; |
379 return; |
|
380 } |
372 } |
381 } |
373 |
382 |
374 event.SetType(KGoomMemoryGoodEvent); |
383 event.SetType(KGoomMemoryGoodEvent); |
|
384 TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to HW, Sending KGoomMemoryGoodEvent"); |
375 } |
385 } |
376 |
386 |
377 for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--) |
387 for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--) |
378 { |
388 { |
379 iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event); |
389 iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event); |
|
390 TRACES1("CMemoryMonitor::SwitchMemMode. Sending event to wg %d",iLowOnMemWgs[i]); |
380 } |
391 } |
381 #endif |
392 #endif |
382 |
393 |
383 iMemMode = aMemMode; |
394 iMemMode = aMemMode; |
384 } |
395 } |