uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
branchRCL_3
changeset 13 3a60ebea00d0
parent 9 3ac8bf5c5014
child 15 cd0ae4656946
equal deleted inserted replaced
12:f93c875b566e 13:3a60ebea00d0
   215     FUNC_LOG;
   215     FUNC_LOG;
   216     
   216     
   217 //    iActionRefs.Reset();
   217 //    iActionRefs.Reset();
   218 //    iCurrentActionIndex = 0;
   218 //    iCurrentActionIndex = 0;
   219     
   219     
   220     aWindowGroupList.RefreshL();
   220     aWindowGroupList.RefreshL(iTryOptional);
   221     
   221     
   222     for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
   222     for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
   223         {
   223         {
   224         if ( iLowOnMemWgs.Find(aWindowGroupList.LowOnMemWgs(i)) == KErrNotFound)
   224         if ( iLowOnMemWgs.Find(aWindowGroupList.LowOnMemWgs(i)) == KErrNotFound)
   225             {
   225             {
   424 
   424 
   425 
   425 
   426     if (!memoryFreeingActionRun)
   426     if (!memoryFreeingActionRun)
   427         {
   427         {
   428         // No usable memory freeing action has been found, so we give up
   428         // No usable memory freeing action has been found, so we give up
   429         TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
       
   430         TInt freeMemory;
   429         TInt freeMemory;
   431         FreeMemoryAboveTarget(freeMemory);
   430 
   432         iServer.CloseAppsFinished(freeMemory, EFalse);
   431         if ( !FreeMemoryAboveTarget(freeMemory) && !iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
   433         iMonitor.WaitAndSynchroniseMemoryState();
   432             { 
       
   433             iTryOptional = ETrue;
       
   434             iOptionalTried = ETrue;
       
   435             iMonitor.RunCloseAppActions(iMaxPriority);
       
   436             }
       
   437         else
       
   438             {
       
   439             iTryOptional = EFalse;
       
   440             iOptionalTried = EFalse;
       
   441 
       
   442             TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
       
   443             iServer.CloseAppsFinished(freeMemory, EFalse);
       
   444             iMonitor.WaitAndSynchroniseMemoryState();
       
   445             }
   434         }
   446         }
   435     }
   447     }
   436 
   448 
   437 // Should be called when the memory situation is good
   449 // Should be called when the memory situation is good
   438 // It results in notifications of the good memory state to all plugins with an outstanding FreeMemory request
   450 // It results in notifications of the good memory state to all plugins with an outstanding FreeMemory request
   634                     if (freeMemory >= iCurrentTarget && !iMonitor.NeedToPostponeMemGood())
   646                     if (freeMemory >= iCurrentTarget && !iMonitor.NeedToPostponeMemGood())
   635                     {                    
   647                     {                    
   636                     MemoryGood();
   648                     MemoryGood();
   637                     }
   649                     }
   638                      */
   650                      */
   639                     iServer.CloseAppsFinished(freeMemory, EFalse);
   651                     if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
   640                     iMonitor.WaitAndSynchroniseMemoryState();
   652                         { 
       
   653                         iTryOptional = ETrue;
       
   654                         iOptionalTried = EFalse;
       
   655                         iMonitor.RunCloseAppActions(iMaxPriority);
       
   656                         }
       
   657                     else
       
   658                         {
       
   659                         iTryOptional = EFalse;       
       
   660                         iServer.CloseAppsFinished(freeMemory, EFalse);
       
   661                         iMonitor.WaitAndSynchroniseMemoryState();
       
   662                         }
   641                     }
   663                     }
   642                 else
   664                 else
   643                     {
   665                     {
   644                     TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory);
   666                     TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory);
   645                     iRunningKillAppActions = ETrue;
   667                     iRunningKillAppActions = ETrue;