uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
branchRCL_3
changeset 18 1801340c26a2
parent 17 c9d868f1e20c
child 19 e5af45d51884
equal deleted inserted replaced
17:c9d868f1e20c 18:1801340c26a2
   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    
   208     TInt current = GetFreeMemory();
   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();
       
   212         if(current >= iGoodThreshold  && (!NeedToPostponeMemGood()))
   211         if(current >= iGoodThreshold  && (!NeedToPostponeMemGood()))
   213             {
   212             {
   214             TRACES2("FreeMemThresholdCrossedL : crossed good threshold Free %d, GThresh %d, Calling MemoryGood",current, iGoodThreshold);
   213             TRACES2("FreeMemThresholdCrossedL : crossed good threshold Free %d, GThresh %d, Calling MemoryGood",current, iGoodThreshold);
   215             iGOomActionList->MemoryGood();
   214             iGOomActionList->MemoryGood();
   216             iMemAllocationsGrowing->Continue();
   215             iMemAllocationsGrowing->Continue();
   228                 iMemAllocationsGoingDown->Continue();
   227                 iMemAllocationsGoingDown->Continue();
   229             }
   228             }
   230         }
   229         }
   231     else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK
   230     else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK
   232         {
   231         {
   233         TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold);
   232         if(current < iLowThreshold)
   234         iMemAllocationsGrowing->Stop();
   233             {
   235         iMemAllocationsGoingDown->Continue();
   234             TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold);
   236         if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood())
   235             iMemAllocationsGrowing->Stop();
   237             {
   236             iMemAllocationsGoingDown->Continue();
   238             if(iSynchTimer->IsActive())
   237             if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood())
   239                 iSynchTimer->Cancel();
   238                 {
   240             StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed);
   239                 if(iSynchTimer->IsActive())
   241             }
   240                     iSynchTimer->Cancel();
       
   241                 StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed);
       
   242                 }
       
   243             }
       
   244         else
       
   245             TRACES2("FreeMemThresholdCrossedL : crossed low threshold %d, FALSE ALARM, FreeMem = %d", iLowThreshold, current);
   242         }
   246         }
   243 #endif
   247 #endif
   244     }
   248     }
   245 
   249 
   246 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid)
   250 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid)
   251     
   255     
   252     if(aForegroundAppUid == 0)
   256     if(aForegroundAppUid == 0)
   253         {
   257         {
   254         return;
   258         return;
   255         }
   259         }
   256     iForegroundAppUid = aForegroundAppUid;    
   260     
       
   261     if(iForegroundAppUid != aForegroundAppUid)
       
   262         {
       
   263         iForegroundAppUid = aForegroundAppUid;
       
   264         iForegroundAppHasChanged = ETrue;
       
   265         iRendswitched = 0;
       
   266         }
       
   267     else
       
   268         {
       
   269         iForegroundAppHasChanged = EFalse;
       
   270         }
   257 
   271 
   258     // Refresh the low and good memory thresholds as they may have changed due to the new foreground application
   272     // Refresh the low and good memory thresholds as they may have changed due to the new foreground application
   259     RefreshThresholds(aForegroundAppUid);
   273     RefreshThresholds(aForegroundAppUid);
   260     
   274     
   261     if(iCurrentTarget || ALWAYS_SW_REND)
   275     if(iCurrentTarget || ALWAYS_SW_REND)
   336 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS    
   350 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS    
   337     TWsEvent event;
   351     TWsEvent event;
   338  
   352  
   339     if(aMemMode == EGOomLowMemMode)
   353     if(aMemMode == EGOomLowMemMode)
   340         {
   354         {
       
   355         if(iRendswitched < 3)
       
   356             iRendswitched ++;
       
   357         else
       
   358             return;
       
   359         
   341         iLowOnMemWgs.Reset();
   360         iLowOnMemWgs.Reset();
   342         iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs);
   361         iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs);
   343         event.SetType(KGoomMemoryLowEvent);
   362         event.SetType(KGoomMemoryLowEvent);
   344         }
   363         }
   345     else
   364     else
   346         {
   365         {
       
   366         if(iRendswitched > 0)
       
   367             {
       
   368             if(iRendswitched < 3)
       
   369                 iRendswitched ++;
       
   370             else
       
   371                 return;
       
   372             }
       
   373     
   347         event.SetType(KGoomMemoryGoodEvent);
   374         event.SetType(KGoomMemoryGoodEvent);
   348         }
   375         }
   349     
   376     
   350     for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
   377     for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
   351         {
   378         {