uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
branchRCL_3
changeset 13 3a60ebea00d0
parent 9 3ac8bf5c5014
child 15 cd0ae4656946
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -217,7 +217,7 @@
 //    iActionRefs.Reset();
 //    iCurrentActionIndex = 0;
     
-    aWindowGroupList.RefreshL();
+    aWindowGroupList.RefreshL(iTryOptional);
     
     for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
         {
@@ -426,11 +426,23 @@
     if (!memoryFreeingActionRun)
         {
         // No usable memory freeing action has been found, so we give up
-        TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
         TInt freeMemory;
-        FreeMemoryAboveTarget(freeMemory);
-        iServer.CloseAppsFinished(freeMemory, EFalse);
-        iMonitor.WaitAndSynchroniseMemoryState();
+
+        if ( !FreeMemoryAboveTarget(freeMemory) && !iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+            { 
+            iTryOptional = ETrue;
+            iOptionalTried = ETrue;
+            iMonitor.RunCloseAppActions(iMaxPriority);
+            }
+        else
+            {
+            iTryOptional = EFalse;
+            iOptionalTried = EFalse;
+
+            TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
+            iServer.CloseAppsFinished(freeMemory, EFalse);
+            iMonitor.WaitAndSynchroniseMemoryState();
+            }
         }
     }
 
@@ -636,8 +648,18 @@
                     MemoryGood();
                     }
                      */
-                    iServer.CloseAppsFinished(freeMemory, EFalse);
-                    iMonitor.WaitAndSynchroniseMemoryState();
+                    if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+                        { 
+                        iTryOptional = ETrue;
+                        iOptionalTried = EFalse;
+                        iMonitor.RunCloseAppActions(iMaxPriority);
+                        }
+                    else
+                        {
+                        iTryOptional = EFalse;       
+                        iServer.CloseAppsFinished(freeMemory, EFalse);
+                        iMonitor.WaitAndSynchroniseMemoryState();
+                        }
                     }
                 else
                     {