229 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
231 else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK |
230 { |
232 { |
231 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
233 TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); |
232 iMemAllocationsGrowing->Stop(); |
234 iMemAllocationsGrowing->Stop(); |
233 iMemAllocationsGoingDown->Continue(); |
235 iMemAllocationsGoingDown->Continue(); |
234 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood() && !iSynchTimer->IsActive() ) |
236 if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood()) |
|
237 { |
|
238 if(iSynchTimer->IsActive()) |
|
239 iSynchTimer->Cancel(); |
235 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
240 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); |
|
241 } |
236 } |
242 } |
237 #endif |
243 #endif |
238 } |
244 } |
239 |
245 |
240 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
246 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid) |
250 iForegroundAppUid = aForegroundAppUid; |
256 iForegroundAppUid = aForegroundAppUid; |
251 |
257 |
252 // Refresh the low and good memory thresholds as they may have changed due to the new foreground application |
258 // Refresh the low and good memory thresholds as they may have changed due to the new foreground application |
253 RefreshThresholds(aForegroundAppUid); |
259 RefreshThresholds(aForegroundAppUid); |
254 |
260 |
255 if(iCurrentTarget) |
261 if(iCurrentTarget || ALWAYS_SW_REND) |
256 { |
262 { |
257 StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); |
263 StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); |
258 } |
264 } |
259 } |
265 } |
260 |
266 |
273 TInt freeMemory; |
279 TInt freeMemory; |
274 TBool freeMemoryAboveCurrentTarget = FreeGraphicsMemoryAboveThresholdL(freeMemory); |
280 TBool freeMemoryAboveCurrentTarget = FreeGraphicsMemoryAboveThresholdL(freeMemory); |
275 |
281 |
276 TRACES2("MemoryMonitor::StartFreeSomeRamL freeMemoryAboveTarget = %d, freeMemory = %d", freeMemoryAboveCurrentTarget, freeMemory); |
282 TRACES2("MemoryMonitor::StartFreeSomeRamL freeMemoryAboveTarget = %d, freeMemory = %d", freeMemoryAboveCurrentTarget, freeMemory); |
277 |
283 |
|
284 if(ALWAYS_SW_REND) |
|
285 { |
|
286 if(iMemMode == EGOomLowMemMode) |
|
287 return; |
|
288 } |
|
289 else |
|
290 { |
278 if (freeMemoryAboveCurrentTarget) |
291 if (freeMemoryAboveCurrentTarget) |
279 { |
292 { |
280 /*if(freeMemory >= iGoodThreshold && !NeedToPostponeMemGood()) |
293 /*if(freeMemory >= iGoodThreshold && !NeedToPostponeMemGood()) |
281 { |
294 { |
282 iGOomActionList->MemoryGood(); |
295 iGOomActionList->MemoryGood(); |
283 } |
296 } |
284 */ |
297 */ |
285 if(!iGOomActionList->UseSwRendering()) |
298 if(!(iGOomActionList->UseSwRendering() && (iMemMode != EGOomLowMemMode))) |
286 { |
299 { |
287 iServer->CloseAppsFinished(freeMemory, ETrue); |
300 iServer->CloseAppsFinished(freeMemory, ETrue); |
288 WaitAndSynchroniseMemoryState(); |
301 WaitAndSynchroniseMemoryState(); |
289 return; |
302 if(aTrigger == EGOomTriggerRequestMemory) |
290 } |
303 User::Leave(KErrCompletion); |
291 } |
304 else |
292 |
305 return; |
|
306 } |
|
307 } |
|
308 } |
293 // update wg list only when actually about to use it |
309 // update wg list only when actually about to use it |
294 //iGOomWindowGroupList->Refresh(); |
310 //iGOomWindowGroupList->Refresh(); |
295 |
311 |
296 #ifdef _DEBUG |
312 #ifdef _DEBUG |
297 iLogger->StartL(); |
313 iLogger->StartL(); |
302 |
318 |
303 //iGOomActionList->SetCurrentTarget(aTargetFree); |
319 //iGOomActionList->SetCurrentTarget(aTargetFree); |
304 iGOomActionList->SetCurrentTarget(iCurrentTarget); |
320 iGOomActionList->SetCurrentTarget(iCurrentTarget); |
305 |
321 |
306 iTrigger = aTrigger; |
322 iTrigger = aTrigger; |
|
323 |
|
324 iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) |
307 // Run the memory freeing actions |
325 // Run the memory freeing actions |
308 iGOomActionList->FreeMemory(aMaxPriority); |
326 iGOomActionList->FreeMemory(aMaxPriority); |
309 |
327 |
|
328 SwitchMemMode(EGOomLowMemMode); |
|
329 } |
|
330 |
|
331 void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode) |
|
332 { |
|
333 if(iMemMode == aMemMode) |
|
334 return; |
|
335 |
|
336 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
337 TWsEvent event; |
|
338 |
|
339 if(aMemMode == EGOomLowMemMode) |
|
340 { |
|
341 iLowOnMemWgs.Reset(); |
|
342 iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs); |
|
343 event.SetType(KGoomMemoryLowEvent); |
|
344 } |
|
345 else |
|
346 { |
|
347 event.SetType(KGoomMemoryGoodEvent); |
|
348 } |
|
349 |
|
350 for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--) |
|
351 { |
|
352 iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event); |
|
353 } |
|
354 #endif |
|
355 |
|
356 iMemMode = aMemMode; |
310 } |
357 } |
311 |
358 |
312 void CMemoryMonitor::RunCloseAppActions(TInt aMaxPriority) |
359 void CMemoryMonitor::RunCloseAppActions(TInt aMaxPriority) |
313 { |
360 { |
314 FUNC_LOG; |
361 FUNC_LOG; |
774 { |
820 { |
775 FUNC_LOG; |
821 FUNC_LOG; |
776 TInt current = GetFreeMemory(); |
822 TInt current = GetFreeMemory(); |
777 if(current >= iGoodThreshold) |
823 if(current >= iGoodThreshold) |
778 { |
824 { |
779 if(!NeedToPostponeMemGood()) |
825 iClientsRequestingMemory.Reset(); |
780 { |
826 TRACES("SynchroniseMemoryState calling MemoryGOOD"); |
781 TRACES("SynchroniseMemoryState calling MemoryGOOD"); |
827 iGOomActionList->MemoryGood(); |
782 iGOomActionList->MemoryGood(); |
|
783 } |
|
784 else |
|
785 { |
|
786 iMemAllocationsGoingDown->Continue(); |
|
787 } |
|
788 } |
828 } |
789 else if(current < iLowThreshold) |
829 else if(current < iLowThreshold) |
790 { |
830 { |
791 iMemAllocationsGrowing->Stop(); |
831 iMemAllocationsGrowing->Stop(); |
792 iMemAllocationsGoingDown->Continue(); |
832 iMemAllocationsGoingDown->Continue(); |